Documentation
¶
Index ¶
- func IsErrorResponse(err error) bool
- func NewRetryableHTTPClient(opts ...RetryableHTTPClientOption) *http.Client
- func Ptr[T any](v T) *T
- type CheckNameRequest
- type CheckNameResponse
- type Client
- func (c *Client) CheckName(ctx context.Context, request *CheckNameRequest, opts ...RequestOption) (*CheckNameResponse, *Response, error)
- func (c *Client) Do(req *http.Request, v any) (*Response, error)
- func (c *Client) DownloadBatch(ctx context.Context, request *DownloadBatchRequest, opts ...RequestOption) (*DownloadBatchResponse, *Response, error)
- func (c *Client) NewRequest(ctx context.Context, method, path string, data any, opts []RequestOption) (*http.Request, error)
- func (c *Client) QueryOver(ctx context.Context, opts ...RequestOption) (*QueryOverResponse, *Response, error)
- func (c *Client) UploadBatch(ctx context.Context, request *UploadBatchRequest, opts ...RequestOption) (*UploadBatchResponse, *Response, error)
- type ClientOption
- type DownloadBatchRequest
- type DownloadBatchResponse
- type ErrorDetail
- type ErrorResponse
- type QueryOverResponse
- type QueryOverResponseData
- type RawBody
- type RequestOption
- type Response
- type RetryableHTTPClientOption
- func WithRetryableHTTPClientBackoff(backoff retryablehttp.Backoff) RetryableHTTPClientOption
- func WithRetryableHTTPClientCheckRetry(checkRetry retryablehttp.CheckRetry) RetryableHTTPClientOption
- func WithRetryableHTTPClientLogger(logger retryablehttp.Logger) RetryableHTTPClientOption
- func WithRetryableHTTPClientRetryMax(retryMax int) RetryableHTTPClientOption
- func WithRetryableHTTPClientRetryWaitMax(waitMax time.Duration) RetryableHTTPClientOption
- func WithRetryableHTTPClientRetryWaitMin(waitMin time.Duration) RetryableHTTPClientOption
- type Service
- type UploadBatchRequest
- type UploadBatchResponse
- type UploadBatchResponseData
- type UploadHandlerResponseData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsErrorResponse ¶
func NewRetryableHTTPClient ¶
func NewRetryableHTTPClient(opts ...RetryableHTTPClientOption) *http.Client
Types ¶
type CheckNameRequest ¶
type CheckNameResponse ¶
type CheckNameResponse struct {
RCScore int `json:"rcscore"` // 相似度分數,會回傳RC>=91 或 RC=0,如果上傳結果失敗,回傳-1。
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(account, password string, opts ...ClientOption) (*Client, error)
NewClient returns a new AML API client with authentication.
func (*Client) CheckName ¶
func (c *Client) CheckName(ctx context.Context, request *CheckNameRequest, opts ...RequestOption) (*CheckNameResponse, *Response, error)
func (*Client) DownloadBatch ¶
func (c *Client) DownloadBatch(ctx context.Context, request *DownloadBatchRequest, opts ...RequestOption) (*DownloadBatchResponse, *Response, error)
func (*Client) NewRequest ¶
func (*Client) QueryOver ¶
func (c *Client) QueryOver(ctx context.Context, opts ...RequestOption) (*QueryOverResponse, *Response, error)
func (*Client) UploadBatch ¶
func (c *Client) UploadBatch(ctx context.Context, request *UploadBatchRequest, opts ...RequestOption) (*UploadBatchResponse, *Response, error)
type ClientOption ¶
func WithAuth ¶
func WithAuth(account, password string) ClientOption
WithAuth sets the account and password for the client
func WithBaseURL ¶
func WithBaseURL(urlStr string) ClientOption
WithBaseURL sets the baseURL for the client
func WithHTTPClient ¶
func WithHTTPClient(httpClient *http.Client) ClientOption
WithHTTPClient sets the httpClient for the client
func WithUserAgent ¶
func WithUserAgent(userAgent string) ClientOption
WithUserAgent sets the userAgent for the client
type DownloadBatchRequest ¶
type DownloadBatchRequest struct {
}
type DownloadBatchResponse ¶
type DownloadBatchResponse struct {
}
type ErrorDetail ¶
type ErrorDetail struct {
Row int `json:"row"`
PrimaryKey string `json:"primaryKey"`
ErrorMessage string `json:"errorMessage"`
}
ErrorDetail represents the detail of an error.
type ErrorResponse ¶
type ErrorResponse struct {
// contains filtered or unexported fields
}
ErrorResponse represents a tapd error response.
func (*ErrorResponse) Error ¶
func (e *ErrorResponse) Error() string
func (*ErrorResponse) Unwrap ¶
func (e *ErrorResponse) Unwrap() error
type QueryOverResponse ¶
type QueryOverResponseData ¶
QueryOverResponseData represents the data of a query over response.
type RawBody ¶
type RawBody struct {
Status string `json:"status"`
Data json.RawMessage `json:"data"`
Error json.RawMessage `json:"errors"`
}
RawBody represents a raw body.
type RequestOption ¶
func WithRequestHeader ¶
func WithRequestHeader(name, value string) RequestOption
func WithRequestHeaderFunc ¶
func WithRequestHeaderFunc(fn func(http.Header)) RequestOption
func WithRequestHeaders ¶
func WithRequestHeaders(headers map[string]string) RequestOption
func WithRequestUserAgent ¶
func WithRequestUserAgent(userAgent string) RequestOption
type RetryableHTTPClientOption ¶
type RetryableHTTPClientOption func(client *retryablehttp.Client)
func WithRetryableHTTPClientBackoff ¶
func WithRetryableHTTPClientBackoff(backoff retryablehttp.Backoff) RetryableHTTPClientOption
func WithRetryableHTTPClientCheckRetry ¶
func WithRetryableHTTPClientCheckRetry(checkRetry retryablehttp.CheckRetry) RetryableHTTPClientOption
func WithRetryableHTTPClientLogger ¶
func WithRetryableHTTPClientLogger(logger retryablehttp.Logger) RetryableHTTPClientOption
func WithRetryableHTTPClientRetryMax ¶
func WithRetryableHTTPClientRetryMax(retryMax int) RetryableHTTPClientOption
func WithRetryableHTTPClientRetryWaitMax ¶
func WithRetryableHTTPClientRetryWaitMax(waitMax time.Duration) RetryableHTTPClientOption
func WithRetryableHTTPClientRetryWaitMin ¶
func WithRetryableHTTPClientRetryWaitMin(waitMin time.Duration) RetryableHTTPClientOption
type Service ¶
type Service interface {
// UploadBatch 整批上傳檔案
UploadBatch(ctx context.Context, request *UploadBatchRequest, opts ...RequestOption) (*UploadBatchResponse, *Response, error)
DownloadBatch(ctx context.Context, request *DownloadBatchRequest, opts ...RequestOption) (*DownloadBatchResponse, *Response, error)
CheckName(ctx context.Context, request *CheckNameRequest, opts ...RequestOption) (*CheckNameResponse, *Response, error)
// QueryOver 查詢單筆線上查詢剩餘與超額筆數
QueryOver(ctx context.Context, opts ...RequestOption) (*QueryOverResponse, *Response, error)
}
type UploadBatchRequest ¶
type UploadBatchRequest struct {
}
type UploadBatchResponse ¶
type UploadBatchResponse struct {
}
type UploadBatchResponseData ¶
type UploadBatchResponseData struct {
BatchNo string `json:"batchNo"`
}
UploadBatchResponseData represents the data of an upload batch response.
type UploadHandlerResponseData ¶
UploadHandlerResponseData represents the data of an upload handler response.
Click to show internal directories.
Click to hide internal directories.