7
0

init project

This commit is contained in:
liangzy 2020-08-04 12:23:34 +08:00
parent cd5642dbb7
commit b688b909e8
6 changed files with 100 additions and 2 deletions

View File

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

View File

@ -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()
} }

View File

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

View File

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

View File

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

View File

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