This commit is contained in:
Jay 2019-01-20 20:33:47 +08:00
parent 851d04e56a
commit 76d9eda074
5 changed files with 41 additions and 5 deletions

2
go.mod
View File

@ -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
View File

@ -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
View 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
}

View File

@ -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

View File

@ -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"`