init project
This commit is contained in:
parent
cd5642dbb7
commit
b688b909e8
@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/auth"
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/auth"
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/auth/credentials"
|
||||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||||
"net"
|
"net"
|
||||||
@ -28,6 +29,19 @@ type Client struct {
|
|||||||
config *Config
|
config *Config
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (client *Client) InitClientConfig() (config *Config) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (client *Client) InitWithAccessKey(accessKeyId, accessKeySecret, source string) (err error) {
|
||||||
|
config := client.InitWithConfig()
|
||||||
|
credential := &credentials.BaseCredential{
|
||||||
|
AccessKeyId: accessKeyId,
|
||||||
|
AccessKeySecret: accessKeySecret,
|
||||||
|
}
|
||||||
|
return client.InitWithOptions("", config, credential)
|
||||||
|
}
|
||||||
|
|
||||||
func (client *Client) InitWithOptions(host string, config *Config, credential auth.Credential) (err error) {
|
func (client *Client) InitWithOptions(host string, config *Config, credential auth.Credential) (err error) {
|
||||||
client.httpClient = &http.Client{}
|
client.httpClient = &http.Client{}
|
||||||
|
|
||||||
|
@ -2,4 +2,21 @@ package requests
|
|||||||
|
|
||||||
type CommonRequest struct {
|
type CommonRequest struct {
|
||||||
*baseRequest
|
*baseRequest
|
||||||
|
Product string
|
||||||
|
Ontology AcsRequest
|
||||||
|
}
|
||||||
|
|
||||||
|
func (request *CommonRequest) TransToAscRequest() {
|
||||||
|
httpReqeust := &HttpRequest{}
|
||||||
|
httpReqeust.baseRequest = request.baseRequest
|
||||||
|
httpReqeust.product = request.Product
|
||||||
|
request.Ontology = httpReqeust
|
||||||
|
}
|
||||||
|
|
||||||
|
func (request *CommonRequest) BuildUrl() string {
|
||||||
|
return request.Ontology.BuildUrl()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (request *CommonRequest) BuildQueries() string {
|
||||||
|
return request.Ontology.BuildQueries()
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,11 @@ type HttpRequest struct {
|
|||||||
*baseRequest
|
*baseRequest
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (request *HttpRequest) init() {
|
||||||
|
request.baseRequest = defaultBaseRequest()
|
||||||
|
request.Method = POST
|
||||||
|
}
|
||||||
|
|
||||||
func (request *HttpRequest) BuildUrl() string {
|
func (request *HttpRequest) BuildUrl() string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
@ -11,3 +16,14 @@ func (request *HttpRequest) BuildUrl() string {
|
|||||||
func (request *HttpRequest) BuildQueries() string {
|
func (request *HttpRequest) BuildQueries() string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (request *HttpRequest) GetActionName() string {
|
||||||
|
return request.actionName
|
||||||
|
}
|
||||||
|
|
||||||
|
func (request *HttpRequest) InitWithApiInfo(product, version, action string) {
|
||||||
|
request.init()
|
||||||
|
request.product = product
|
||||||
|
request.version = version
|
||||||
|
request.actionName = action
|
||||||
|
}
|
||||||
|
@ -46,6 +46,7 @@ type AcsRequest interface {
|
|||||||
GetMethod() string
|
GetMethod() string
|
||||||
GetScheme() string
|
GetScheme() string
|
||||||
GetDomain() string
|
GetDomain() string
|
||||||
|
GetActionName() string
|
||||||
|
|
||||||
BuildUrl() string
|
BuildUrl() string
|
||||||
BuildQueries() string
|
BuildQueries() string
|
||||||
@ -67,6 +68,7 @@ type baseRequest struct {
|
|||||||
isInsecure *bool
|
isInsecure *bool
|
||||||
|
|
||||||
AcceptFormat string
|
AcceptFormat string
|
||||||
|
actionName string
|
||||||
|
|
||||||
userAgent map[string]string
|
userAgent map[string]string
|
||||||
product string
|
product string
|
||||||
@ -81,6 +83,10 @@ type baseRequest struct {
|
|||||||
stringToSign string
|
stringToSign string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (request *baseRequest) GetActionName() string {
|
||||||
|
return request.actionName
|
||||||
|
}
|
||||||
|
|
||||||
func (request *baseRequest) SetScheme(scheme string) {
|
func (request *baseRequest) SetScheme(scheme string) {
|
||||||
request.Scheme = scheme
|
request.Scheme = scheme
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,23 @@ package jedi
|
|||||||
|
|
||||||
import "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk"
|
import "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk"
|
||||||
|
|
||||||
|
const (
|
||||||
|
PRODUCT = "jedi"
|
||||||
|
VERSION = "2020-08-04"
|
||||||
|
)
|
||||||
|
|
||||||
type Client struct {
|
type Client struct {
|
||||||
sdk.Client
|
sdk.Client
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewClientWithAccessKey(accesskey, secrect string) *Client {
|
func (c *Client) SendSms(req *SendSmsRequest) (response *SendSmsResponse, err error) {
|
||||||
return nil
|
response = CreateSendSmsResponse()
|
||||||
|
err = c.DoAction(req, response)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewClientWithAccessKey(accesskey, secrect, source string) (client *Client, err error) {
|
||||||
|
client = &Client{}
|
||||||
|
err = client.InitWithOptions("", nil, "")
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
@ -1 +1,33 @@
|
|||||||
package jedi
|
package jedi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||||
|
)
|
||||||
|
|
||||||
|
type SendSmsRequest struct {
|
||||||
|
*requests.HttpRequest
|
||||||
|
User string `position:"Query" name:"User" default:""`
|
||||||
|
Code string `position:"Query" name:"Code" default:"-"`
|
||||||
|
Prams string `position:"Query" name:"Prams" default:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SendSmsResponse struct {
|
||||||
|
*responses.BaseResponse
|
||||||
|
BizId string `json:"BizId"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateSendSmsRequest() (req *SendSmsRequest) {
|
||||||
|
req = &SendSmsRequest{
|
||||||
|
HttpRequest: &requests.HttpRequest{},
|
||||||
|
}
|
||||||
|
req.InitWithApiInfo(PRODUCT, VERSION, "/api/sms/send")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateSendSmsResponse() (response *SendSmsResponse) {
|
||||||
|
response = &SendSmsResponse{
|
||||||
|
BaseResponse: &responses.BaseResponse{},
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user