update
This commit is contained in:
parent
851d04e56a
commit
76d9eda074
2
go.mod
2
go.mod
@ -7,7 +7,7 @@ require (
|
|||||||
github.com/gin-gonic/gin v1.3.0
|
github.com/gin-gonic/gin v1.3.0
|
||||||
github.com/golang/protobuf v1.2.0 // indirect
|
github.com/golang/protobuf v1.2.0 // indirect
|
||||||
github.com/jmoiron/sqlx v1.2.0
|
github.com/jmoiron/sqlx v1.2.0
|
||||||
github.com/json-iterator/go v1.1.5 // indirect
|
github.com/json-iterator/go v1.1.5
|
||||||
github.com/lib/pq v1.0.0
|
github.com/lib/pq v1.0.0
|
||||||
github.com/mattn/go-isatty v0.0.4 // indirect
|
github.com/mattn/go-isatty v0.0.4 // indirect
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||||
|
2
go.sum
2
go.sum
@ -1,5 +1,3 @@
|
|||||||
git.trj.tw/golang/utils v0.0.0-20181219032659-b1a8bce04189 h1:KHFlWRVFd5NIsnnFSy090+k6kT7KRotxUPTsho6F9lk=
|
|
||||||
git.trj.tw/golang/utils v0.0.0-20181219032659-b1a8bce04189/go.mod h1:yE+qbsUsijCTdwsaQRkPT1CXYk7ftMzXsCaaYx/0QI0=
|
|
||||||
git.trj.tw/golang/utils v0.0.0-20190116070516-b266ebeb2d82 h1:to19C8t9z6z4b1EMnMm8JIB4qDBCkBjEAhHH5yopSZ0=
|
git.trj.tw/golang/utils v0.0.0-20190116070516-b266ebeb2d82 h1:to19C8t9z6z4b1EMnMm8JIB4qDBCkBjEAhHH5yopSZ0=
|
||||||
git.trj.tw/golang/utils v0.0.0-20190116070516-b266ebeb2d82/go.mod h1:yE+qbsUsijCTdwsaQRkPT1CXYk7ftMzXsCaaYx/0QI0=
|
git.trj.tw/golang/utils v0.0.0-20190116070516-b266ebeb2d82/go.mod h1:yE+qbsUsijCTdwsaQRkPT1CXYk7ftMzXsCaaYx/0QI0=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
|
33
modules/apiact/line.go
Normal file
33
modules/apiact/line.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
package apiact
|
||||||
|
|
||||||
|
import "net/url"
|
||||||
|
|
||||||
|
// Line -
|
||||||
|
type Line struct {
|
||||||
|
URL string
|
||||||
|
APIVersion string
|
||||||
|
AccessToken string
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewLineApi -
|
||||||
|
func NewLineApi(apiVersion string) (line *Line, err error) {
|
||||||
|
if len(apiVersion) == 0 {
|
||||||
|
apiVersion = "v2"
|
||||||
|
}
|
||||||
|
line = &Line{}
|
||||||
|
line.URL = "https://api.line.me"
|
||||||
|
line.APIVersion = apiVersion
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Line) getAPIURL(urlPath string) (apiURL string, err error) {
|
||||||
|
u, err := url.Parse(p.URL)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
u, err = u.Parse("/v2")
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
@ -1,7 +1,6 @@
|
|||||||
package apiact
|
package apiact
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
@ -13,8 +12,11 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.trj.tw/golang/mtgbot/modules/config"
|
"git.trj.tw/golang/mtgbot/modules/config"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var json = jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
|
|
||||||
// TCGPlayer -
|
// TCGPlayer -
|
||||||
type TCGPlayer struct {
|
type TCGPlayer struct {
|
||||||
URL string
|
URL string
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
package lineobj
|
package lineobj
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var json = jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
|
|
||||||
// SourceObject -
|
// SourceObject -
|
||||||
type SourceObject struct {
|
type SourceObject struct {
|
||||||
Type string `json:"type" cc:"type"`
|
Type string `json:"type" cc:"type"`
|
||||||
|
Loading…
Reference in New Issue
Block a user