init project
This commit is contained in:
parent
cd5642dbb7
commit
b688b909e8
@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"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/responses"
|
||||
"net"
|
||||
@ -28,6 +29,19 @@ type Client struct {
|
||||
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) {
|
||||
client.httpClient = &http.Client{}
|
||||
|
||||
|
@ -2,4 +2,21 @@ package requests
|
||||
|
||||
type CommonRequest struct {
|
||||
*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
|
||||
}
|
||||
|
||||
func (request *HttpRequest) init() {
|
||||
request.baseRequest = defaultBaseRequest()
|
||||
request.Method = POST
|
||||
}
|
||||
|
||||
func (request *HttpRequest) BuildUrl() string {
|
||||
return ""
|
||||
}
|
||||
@ -11,3 +16,14 @@ func (request *HttpRequest) BuildUrl() string {
|
||||
func (request *HttpRequest) BuildQueries() string {
|
||||
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
|
||||
GetScheme() string
|
||||
GetDomain() string
|
||||
GetActionName() string
|
||||
|
||||
BuildUrl() string
|
||||
BuildQueries() string
|
||||
@ -67,6 +68,7 @@ type baseRequest struct {
|
||||
isInsecure *bool
|
||||
|
||||
AcceptFormat string
|
||||
actionName string
|
||||
|
||||
userAgent map[string]string
|
||||
product string
|
||||
@ -81,6 +83,10 @@ type baseRequest struct {
|
||||
stringToSign string
|
||||
}
|
||||
|
||||
func (request *baseRequest) GetActionName() string {
|
||||
return request.actionName
|
||||
}
|
||||
|
||||
func (request *baseRequest) SetScheme(scheme string) {
|
||||
request.Scheme = scheme
|
||||
}
|
||||
|
@ -2,10 +2,23 @@ package jedi
|
||||
|
||||
import "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk"
|
||||
|
||||
const (
|
||||
PRODUCT = "jedi"
|
||||
VERSION = "2020-08-04"
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
sdk.Client
|
||||
}
|
||||
|
||||
func NewClientWithAccessKey(accesskey, secrect string) *Client {
|
||||
return nil
|
||||
func (c *Client) SendSms(req *SendSmsRequest) (response *SendSmsResponse, err error) {
|
||||
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
|
||||
|
||||
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