Documentation ¶
Index ¶
- Constants
- func NewRequestBodyWithStruct(body interface{}) (io.ReadCloser, error)
- type Client
- type PFRequest
- type PFResponse
- func (r *PFResponse) Body() io.ReadCloser
- func (r *PFResponse) ElapsedTime() time.Duration
- func (r *PFResponse) Header(key string) string
- func (r *PFResponse) Headers() map[string]string
- func (r *PFResponse) IsFail() bool
- func (r *PFResponse) ParseJsonBody(result interface{}) error
- func (r *PFResponse) ParseResponse()
- func (r *PFResponse) RequestId() string
- func (r *PFResponse) ServiceError() *PFServiceError
- func (r *PFResponse) SetHttpResponse(response *http.Response)
- func (r *PFResponse) StatusCode() int
- func (r *PFResponse) StatusText() string
- type PFServiceError
- type PaddleFlowClient
- type PaddleFlowClientConfiguration
- type RequestBuilder
- func (b *RequestBuilder) Do() error
- func (b *RequestBuilder) WithBody(body interface{}) *RequestBuilder
- func (b *RequestBuilder) WithHeader(key, value string) *RequestBuilder
- func (b *RequestBuilder) WithHeaders(headers map[string]string) *RequestBuilder
- func (b *RequestBuilder) WithMethod(method string) *RequestBuilder
- func (b *RequestBuilder) WithQueryParam(key, value string) *RequestBuilder
- func (b *RequestBuilder) WithQueryParamFilter(key, value string) *RequestBuilder
- func (b *RequestBuilder) WithQueryParams(params map[string][]string) *RequestBuilder
- func (b *RequestBuilder) WithResult(result interface{}) *RequestBuilder
- func (b *RequestBuilder) WithURL(url string) *RequestBuilder
Constants ¶
View Source
const ( BCE_REQUEST_ID = "x-pf-request-id" BCE_DATE = "x-pf-date" )
Constants of the HTTP headers for paddleFlow
View Source
const ( EACCESS_DENIED = "AccessDenied" EINTERNAL_ERROR = "InternalError" EINVALID_HTTP_REQUEST = "InvalidHTTPRequest" EMALFORMED_JSON = "MalformedJSON" EPRECONDITION_FAILED = "PreconditionFailed" )
View Source
const (
API_V1_PREFIX = "/api/core/v1"
)
Variables ¶
This section is empty.
Functions ¶
func NewRequestBodyWithStruct ¶
func NewRequestBodyWithStruct(body interface{}) (io.ReadCloser, error)
Types ¶
type Client ¶
type Client interface {
SendRequest(*PFRequest) (*PFResponse, error)
}
Client is the general interface which can perform sending request. Different service will define its own client in case of specific extension.
type PFRequest ¶
func (*PFRequest) BuildHttpRequest ¶
func (b *PFRequest) BuildHttpRequest()
func (*PFRequest) SetRequestId ¶
type PFResponse ¶
type PFResponse struct {
// contains filtered or unexported fields
}
func (*PFResponse) Body ¶
func (r *PFResponse) Body() io.ReadCloser
func (*PFResponse) ElapsedTime ¶
func (r *PFResponse) ElapsedTime() time.Duration
func (*PFResponse) Header ¶
func (r *PFResponse) Header(key string) string
func (*PFResponse) Headers ¶
func (r *PFResponse) Headers() map[string]string
func (*PFResponse) IsFail ¶
func (r *PFResponse) IsFail() bool
func (*PFResponse) ParseJsonBody ¶
func (r *PFResponse) ParseJsonBody(result interface{}) error
func (*PFResponse) ParseResponse ¶
func (r *PFResponse) ParseResponse()
func (*PFResponse) RequestId ¶
func (r *PFResponse) RequestId() string
func (*PFResponse) ServiceError ¶
func (r *PFResponse) ServiceError() *PFServiceError
func (*PFResponse) SetHttpResponse ¶
func (r *PFResponse) SetHttpResponse(response *http.Response)
func (*PFResponse) StatusCode ¶
func (r *PFResponse) StatusCode() int
func (*PFResponse) StatusText ¶
func (r *PFResponse) StatusText() string
type PFServiceError ¶
func NewPFServiceError ¶
func NewPFServiceError(code, msg, reqId string, status int) *PFServiceError
func (*PFServiceError) Error ¶
func (b *PFServiceError) Error() string
type PaddleFlowClient ¶
type PaddleFlowClient struct {
Config *PaddleFlowClientConfiguration
}
func NewPaddleFlowClient ¶
func NewPaddleFlowClient(conf *PaddleFlowClientConfiguration) *PaddleFlowClient
func (*PaddleFlowClient) SendRequest ¶
func (c *PaddleFlowClient) SendRequest(req *PFRequest) (*PFResponse, error)
type PaddleFlowClientConfiguration ¶
func (*PaddleFlowClientConfiguration) String ¶
func (b *PaddleFlowClientConfiguration) String() string
type RequestBuilder ¶
type RequestBuilder struct {
// contains filtered or unexported fields
}
RequestBuilder holds config data for bce request. Some of fields are required and the others are optional. The builder pattern can simplify the execution of requests.
func NewRequestBuilder ¶
func NewRequestBuilder(client Client) *RequestBuilder
create RequestBuilder with the client.
func (*RequestBuilder) Do ¶
func (b *RequestBuilder) Do() error
Do will send request to core and get result with the builder's parameters.
func (*RequestBuilder) WithBody ¶
func (b *RequestBuilder) WithBody(body interface{}) *RequestBuilder
func (*RequestBuilder) WithHeader ¶
func (b *RequestBuilder) WithHeader(key, value string) *RequestBuilder
func (*RequestBuilder) WithHeaders ¶
func (b *RequestBuilder) WithHeaders(headers map[string]string) *RequestBuilder
func (*RequestBuilder) WithMethod ¶
func (b *RequestBuilder) WithMethod(method string) *RequestBuilder
func (*RequestBuilder) WithQueryParam ¶
func (b *RequestBuilder) WithQueryParam(key, value string) *RequestBuilder
set query param with the key/value directly.
func (*RequestBuilder) WithQueryParamFilter ¶
func (b *RequestBuilder) WithQueryParamFilter(key, value string) *RequestBuilder
set query param with the key/value only when the value is not blank.
func (*RequestBuilder) WithQueryParams ¶
func (b *RequestBuilder) WithQueryParams(params map[string][]string) *RequestBuilder
func (*RequestBuilder) WithResult ¶
func (b *RequestBuilder) WithResult(result interface{}) *RequestBuilder
func (*RequestBuilder) WithURL ¶
func (b *RequestBuilder) WithURL(url string) *RequestBuilder
Click to show internal directories.
Click to hide internal directories.