client

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2022 License: Apache-2.0 Imports: 7 Imported by: 442

Documentation

Overview

This file is auto-generated, don't edit it. Thanks. *

  • This is for OpenApi SDK

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultAny

func DefaultAny(inputValue interface{}, defaultValue interface{}) (_result interface{})

*

  • If inputValue is not null, return it or return defaultValue
  • @param inputValue users input value
  • @param defaultValue default value
  • @return the final result

Types

type Client

type Client struct {
	Endpoint             *string
	RegionId             *string
	Protocol             *string
	Method               *string
	UserAgent            *string
	EndpointRule         *string
	EndpointMap          map[string]*string
	Suffix               *string
	ReadTimeout          *int
	ConnectTimeout       *int
	HttpProxy            *string
	HttpsProxy           *string
	Socks5Proxy          *string
	Socks5NetWork        *string
	NoProxy              *string
	Network              *string
	ProductId            *string
	MaxIdleConns         *int
	EndpointType         *string
	OpenPlatformEndpoint *string
	Credential           credential.Credential
	SignatureVersion     *string
	SignatureAlgorithm   *string
	Headers              map[string]*string
	Spi                  spi.ClientInterface
	GlobalParameters     *GlobalParameters
}

func NewClient

func NewClient(config *Config) (*Client, error)

*

  • Init client with Config
  • @param config config contains the necessary information to create a client

func (*Client) CallApi

func (client *Client) CallApi(params *Params, request *OpenApiRequest, runtime *util.RuntimeOptions) (_result map[string]interface{}, _err error)

func (*Client) CheckConfig

func (client *Client) CheckConfig(config *Config) (_err error)

*

  • If the endpointRule and config.endpoint are empty, throw error
  • @param config config contains the necessary information to create a client

func (*Client) DoROARequest

func (client *Client) DoROARequest(action *string, version *string, protocol *string, method *string, authType *string, pathname *string, bodyType *string, request *OpenApiRequest, runtime *util.RuntimeOptions) (_result map[string]interface{}, _err error)

*

  • Encapsulate the request and invoke the network
  • @param action api name
  • @param version product version
  • @param protocol http or https
  • @param method e.g. GET
  • @param authType authorization type e.g. AK
  • @param pathname pathname of every api
  • @param bodyType response body type e.g. String
  • @param request object of OpenApiRequest
  • @param runtime which controls some details of call api, such as retry times
  • @return the response

func (*Client) DoROARequestWithForm

func (client *Client) DoROARequestWithForm(action *string, version *string, protocol *string, method *string, authType *string, pathname *string, bodyType *string, request *OpenApiRequest, runtime *util.RuntimeOptions) (_result map[string]interface{}, _err error)

*

  • Encapsulate the request and invoke the network with form body
  • @param action api name
  • @param version product version
  • @param protocol http or https
  • @param method e.g. GET
  • @param authType authorization type e.g. AK
  • @param pathname pathname of every api
  • @param bodyType response body type e.g. String
  • @param request object of OpenApiRequest
  • @param runtime which controls some details of call api, such as retry times
  • @return the response

func (*Client) DoRPCRequest

func (client *Client) DoRPCRequest(action *string, version *string, protocol *string, method *string, authType *string, bodyType *string, request *OpenApiRequest, runtime *util.RuntimeOptions) (_result map[string]interface{}, _err error)

*

  • Encapsulate the request and invoke the network
  • @param action api name
  • @param version product version
  • @param protocol http or https
  • @param method e.g. GET
  • @param authType authorization type e.g. AK
  • @param bodyType response body type e.g. String
  • @param request object of OpenApiRequest
  • @param runtime which controls some details of call api, such as retry times
  • @return the response

func (*Client) DoRequest

func (client *Client) DoRequest(params *Params, request *OpenApiRequest, runtime *util.RuntimeOptions) (_result map[string]interface{}, _err error)

*

  • Encapsulate the request and invoke the network
  • @param action api name
  • @param version product version
  • @param protocol http or https
  • @param method e.g. GET
  • @param authType authorization type e.g. AK
  • @param bodyType response body type e.g. String
  • @param request object of OpenApiRequest
  • @param runtime which controls some details of call api, such as retry times
  • @return the response

func (*Client) Execute

func (client *Client) Execute(params *Params, request *OpenApiRequest, runtime *util.RuntimeOptions) (_result map[string]interface{}, _err error)

*

  • Encapsulate the request and invoke the network
  • @param action api name
  • @param version product version
  • @param protocol http or https
  • @param method e.g. GET
  • @param authType authorization type e.g. AK
  • @param bodyType response body type e.g. String
  • @param request object of OpenApiRequest
  • @param runtime which controls some details of call api, such as retry times
  • @return the response

func (*Client) GetAccessKeyId

func (client *Client) GetAccessKeyId() (_result *string, _err error)

*

  • Get accesskey id by using credential
  • @return accesskey id

func (*Client) GetAccessKeySecret

func (client *Client) GetAccessKeySecret() (_result *string, _err error)

*

  • Get accesskey secret by using credential
  • @return accesskey secret

func (*Client) GetBearerToken added in v0.1.17

func (client *Client) GetBearerToken() (_result *string, _err error)

*

  • Get bearer token by credential
  • @return bearer token

func (*Client) GetRpcHeaders

func (client *Client) GetRpcHeaders() (_result map[string]*string, _err error)

*

  • get RPC header for debug

func (*Client) GetSecurityToken

func (client *Client) GetSecurityToken() (_result *string, _err error)

*

  • Get security token by using credential
  • @return security token

func (*Client) GetType added in v0.1.17

func (client *Client) GetType() (_result *string, _err error)

*

  • Get credential type by credential
  • @return credential type e.g. access_key

func (*Client) GetUserAgent

func (client *Client) GetUserAgent() (_result *string)

*

  • Get user agent
  • @return user agent

func (*Client) Init

func (client *Client) Init(config *Config) (_err error)

func (*Client) SetRpcHeaders

func (client *Client) SetRpcHeaders(headers map[string]*string) (_err error)

*

  • set RPC header for debug
  • @param headers headers for debug, this header can be used only once.

type Config

type Config struct {
	// accesskey id
	AccessKeyId *string `json:"accessKeyId,omitempty" xml:"accessKeyId,omitempty"`
	// accesskey secret
	AccessKeySecret *string `json:"accessKeySecret,omitempty" xml:"accessKeySecret,omitempty"`
	// security token
	SecurityToken *string `json:"securityToken,omitempty" xml:"securityToken,omitempty"`
	// http protocol
	Protocol *string `json:"protocol,omitempty" xml:"protocol,omitempty"`
	// http method
	Method *string `json:"method,omitempty" xml:"method,omitempty"`
	// region id
	RegionId *string `json:"regionId,omitempty" xml:"regionId,omitempty"`
	// read timeout
	ReadTimeout *int `json:"readTimeout,omitempty" xml:"readTimeout,omitempty"`
	// connect timeout
	ConnectTimeout *int `json:"connectTimeout,omitempty" xml:"connectTimeout,omitempty"`
	// http proxy
	HttpProxy *string `json:"httpProxy,omitempty" xml:"httpProxy,omitempty"`
	// https proxy
	HttpsProxy *string `json:"httpsProxy,omitempty" xml:"httpsProxy,omitempty"`
	// credential
	Credential credential.Credential `json:"credential,omitempty" xml:"credential,omitempty"`
	// endpoint
	Endpoint *string `json:"endpoint,omitempty" xml:"endpoint,omitempty"`
	// proxy white list
	NoProxy *string `json:"noProxy,omitempty" xml:"noProxy,omitempty"`
	// max idle conns
	MaxIdleConns *int `json:"maxIdleConns,omitempty" xml:"maxIdleConns,omitempty"`
	// network for endpoint
	Network *string `json:"network,omitempty" xml:"network,omitempty"`
	// user agent
	UserAgent *string `json:"userAgent,omitempty" xml:"userAgent,omitempty"`
	// suffix for endpoint
	Suffix *string `json:"suffix,omitempty" xml:"suffix,omitempty"`
	// socks5 proxy
	Socks5Proxy *string `json:"socks5Proxy,omitempty" xml:"socks5Proxy,omitempty"`
	// socks5 network
	Socks5NetWork *string `json:"socks5NetWork,omitempty" xml:"socks5NetWork,omitempty"`
	// endpoint type
	EndpointType *string `json:"endpointType,omitempty" xml:"endpointType,omitempty"`
	// OpenPlatform endpoint
	OpenPlatformEndpoint *string `json:"openPlatformEndpoint,omitempty" xml:"openPlatformEndpoint,omitempty"`
	// Deprecated
	// credential type
	Type *string `json:"type,omitempty" xml:"type,omitempty"`
	// Signature Version
	SignatureVersion *string `json:"signatureVersion,omitempty" xml:"signatureVersion,omitempty"`
	// Signature Algorithm
	SignatureAlgorithm *string `json:"signatureAlgorithm,omitempty" xml:"signatureAlgorithm,omitempty"`
	// Global Parameters
	GlobalParameters *GlobalParameters `json:"globalParameters,omitempty" xml:"globalParameters,omitempty"`
}

*

  • Model for initing client

func (Config) GoString

func (s Config) GoString() string

func (*Config) SetAccessKeyId

func (s *Config) SetAccessKeyId(v string) *Config

func (*Config) SetAccessKeySecret

func (s *Config) SetAccessKeySecret(v string) *Config

func (*Config) SetConnectTimeout

func (s *Config) SetConnectTimeout(v int) *Config

func (*Config) SetCredential

func (s *Config) SetCredential(v credential.Credential) *Config

func (*Config) SetEndpoint

func (s *Config) SetEndpoint(v string) *Config

func (*Config) SetEndpointType

func (s *Config) SetEndpointType(v string) *Config

func (*Config) SetGlobalParameters added in v0.2.0

func (s *Config) SetGlobalParameters(v *GlobalParameters) *Config

func (*Config) SetHttpProxy

func (s *Config) SetHttpProxy(v string) *Config

func (*Config) SetHttpsProxy

func (s *Config) SetHttpsProxy(v string) *Config

func (*Config) SetMaxIdleConns

func (s *Config) SetMaxIdleConns(v int) *Config

func (*Config) SetMethod

func (s *Config) SetMethod(v string) *Config

func (*Config) SetNetwork

func (s *Config) SetNetwork(v string) *Config

func (*Config) SetNoProxy

func (s *Config) SetNoProxy(v string) *Config

func (*Config) SetOpenPlatformEndpoint

func (s *Config) SetOpenPlatformEndpoint(v string) *Config

func (*Config) SetProtocol

func (s *Config) SetProtocol(v string) *Config

func (*Config) SetReadTimeout

func (s *Config) SetReadTimeout(v int) *Config

func (*Config) SetRegionId

func (s *Config) SetRegionId(v string) *Config

func (*Config) SetSecurityToken

func (s *Config) SetSecurityToken(v string) *Config

func (*Config) SetSignatureAlgorithm

func (s *Config) SetSignatureAlgorithm(v string) *Config

func (*Config) SetSignatureVersion

func (s *Config) SetSignatureVersion(v string) *Config

func (*Config) SetSocks5NetWork

func (s *Config) SetSocks5NetWork(v string) *Config

func (*Config) SetSocks5Proxy

func (s *Config) SetSocks5Proxy(v string) *Config

func (*Config) SetSuffix

func (s *Config) SetSuffix(v string) *Config

func (*Config) SetType

func (s *Config) SetType(v string) *Config

func (*Config) SetUserAgent

func (s *Config) SetUserAgent(v string) *Config

func (Config) String

func (s Config) String() string

type GlobalParameters added in v0.2.0

type GlobalParameters struct {
	Headers map[string]*string `json:"headers,omitempty" xml:"headers,omitempty"`
	Queries map[string]*string `json:"queries,omitempty" xml:"queries,omitempty"`
}

func (GlobalParameters) GoString added in v0.2.0

func (s GlobalParameters) GoString() string

func (*GlobalParameters) SetHeaders added in v0.2.0

func (s *GlobalParameters) SetHeaders(v map[string]*string) *GlobalParameters

func (*GlobalParameters) SetQueries added in v0.2.0

func (s *GlobalParameters) SetQueries(v map[string]*string) *GlobalParameters

func (GlobalParameters) String added in v0.2.0

func (s GlobalParameters) String() string

type OpenApiRequest

type OpenApiRequest struct {
	Headers          map[string]*string `json:"headers,omitempty" xml:"headers,omitempty"`
	Query            map[string]*string `json:"query,omitempty" xml:"query,omitempty"`
	Body             interface{}        `json:"body,omitempty" xml:"body,omitempty"`
	Stream           io.Reader          `json:"stream,omitempty" xml:"stream,omitempty"`
	HostMap          map[string]*string `json:"hostMap,omitempty" xml:"hostMap,omitempty"`
	EndpointOverride *string            `json:"endpointOverride,omitempty" xml:"endpointOverride,omitempty"`
}

func (OpenApiRequest) GoString

func (s OpenApiRequest) GoString() string

func (*OpenApiRequest) SetBody

func (s *OpenApiRequest) SetBody(v interface{}) *OpenApiRequest

func (*OpenApiRequest) SetEndpointOverride added in v0.1.17

func (s *OpenApiRequest) SetEndpointOverride(v string) *OpenApiRequest

func (*OpenApiRequest) SetHeaders

func (s *OpenApiRequest) SetHeaders(v map[string]*string) *OpenApiRequest

func (*OpenApiRequest) SetHostMap

func (s *OpenApiRequest) SetHostMap(v map[string]*string) *OpenApiRequest

func (*OpenApiRequest) SetQuery

func (s *OpenApiRequest) SetQuery(v map[string]*string) *OpenApiRequest

func (*OpenApiRequest) SetStream

func (s *OpenApiRequest) SetStream(v io.Reader) *OpenApiRequest

func (OpenApiRequest) String

func (s OpenApiRequest) String() string

type Params

type Params struct {
	Action      *string `json:"action,omitempty" xml:"action,omitempty" require:"true"`
	Version     *string `json:"version,omitempty" xml:"version,omitempty" require:"true"`
	Protocol    *string `json:"protocol,omitempty" xml:"protocol,omitempty" require:"true"`
	Pathname    *string `json:"pathname,omitempty" xml:"pathname,omitempty" require:"true"`
	Method      *string `json:"method,omitempty" xml:"method,omitempty" require:"true"`
	AuthType    *string `json:"authType,omitempty" xml:"authType,omitempty" require:"true"`
	BodyType    *string `json:"bodyType,omitempty" xml:"bodyType,omitempty" require:"true"`
	ReqBodyType *string `json:"reqBodyType,omitempty" xml:"reqBodyType,omitempty" require:"true"`
	Style       *string `json:"style,omitempty" xml:"style,omitempty"`
}

func (Params) GoString

func (s Params) GoString() string

func (*Params) SetAction

func (s *Params) SetAction(v string) *Params

func (*Params) SetAuthType

func (s *Params) SetAuthType(v string) *Params

func (*Params) SetBodyType

func (s *Params) SetBodyType(v string) *Params

func (*Params) SetMethod

func (s *Params) SetMethod(v string) *Params

func (*Params) SetPathname

func (s *Params) SetPathname(v string) *Params

func (*Params) SetProtocol

func (s *Params) SetProtocol(v string) *Params

func (*Params) SetReqBodyType

func (s *Params) SetReqBodyType(v string) *Params

func (*Params) SetStyle

func (s *Params) SetStyle(v string) *Params

func (*Params) SetVersion

func (s *Params) SetVersion(v string) *Params

func (Params) String

func (s Params) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL