Documentation
¶
Overview ¶
Package uuidify provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen/v2 version v2.2.0 DO NOT EDIT.
Package uuidify provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen/v2 version v2.2.0 DO NOT EDIT.
Index ¶
- Constants
- func NewGetRequest(server string, params *GetParams) (*http.Request, error)
- type APIError
- type Client
- func (c *Client) Get(ctx context.Context, params *GetParams, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) ULID(ctx context.Context) (string, error)
- func (c *Client) ULIDBatch(ctx context.Context, count int) ([]string, error)
- func (c *Client) UUIDBatch(ctx context.Context, version string, count int) ([]string, error)
- func (c *Client) UUIDv1(ctx context.Context) (string, error)
- func (c *Client) UUIDv4(ctx context.Context) (string, error)
- func (c *Client) UUIDv7(ctx context.Context) (string, error)
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- type ClientWithResponsesInterface
- type DecodeError
- type GetParams
- type GetParamsAlgorithm
- type GetParamsFormat
- type GetParamsVersion
- type GetResponse
- type HttpRequestDoer
- type RequestEditorFn
- type RequestError
Constants ¶
const (
DefaultBaseURL = "https://api.uuidify.io"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// The endpoint of the server conforming to this interface, with scheme,
// https://api.deepmap.com for example. This can contain a path relative
// to the server, such as https://api.deepmap.com/dev-test, and all the
// paths in the swagger spec will be appended to the server.
Server string
// Doer for performing requests, typically a *http.Client with any
// customized settings, such as certificate chains.
Client HttpRequestDoer
// A list of callbacks for modifying requests which are generated before sending over
// the network.
RequestEditors []RequestEditorFn
}
Client which conforms to the OpenAPI3 specification for this service.
func NewClient ¶
func NewClient(server string, opts ...ClientOption) (*Client, error)
Creates a new Client, with reasonable defaults
func NewDefaultClient ¶ added in v0.6.0
func NewDefaultClient(opts ...ClientOption) (*Client, error)
NewDefaultClient creates a client preconfigured with the public API endpoint.
type ClientInterface ¶ added in v0.2.0
type ClientInterface interface {
// Get request
Get(ctx context.Context, params *GetParams, reqEditors ...RequestEditorFn) (*http.Response, error)
}
The interface specification for the client above.
type ClientOption ¶
ClientOption allows setting custom parameters during construction
func WithHTTPClient ¶
func WithHTTPClient(doer HttpRequestDoer) ClientOption
WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.
func WithRequestEditorFn ¶ added in v0.2.0
func WithRequestEditorFn(fn RequestEditorFn) ClientOption
WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.
func WithUserAgent ¶
func WithUserAgent(ua string) ClientOption
WithUserAgent ensures every request carries the provided User-Agent header.
type ClientWithResponses ¶ added in v0.2.0
type ClientWithResponses struct {
ClientInterface
}
ClientWithResponses builds on ClientInterface to offer response payloads
func NewClientWithResponses ¶ added in v0.2.0
func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)
NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling
func (*ClientWithResponses) GetWithResponse ¶ added in v0.2.0
func (c *ClientWithResponses) GetWithResponse(ctx context.Context, params *GetParams, reqEditors ...RequestEditorFn) (*GetResponse, error)
GetWithResponse request returning *GetResponse
type ClientWithResponsesInterface ¶ added in v0.2.0
type ClientWithResponsesInterface interface {
// GetWithResponse request
GetWithResponse(ctx context.Context, params *GetParams, reqEditors ...RequestEditorFn) (*GetResponse, error)
}
ClientWithResponsesInterface is the interface specification for the client with responses above.
type DecodeError ¶
type DecodeError struct {
Err error
}
DecodeError wraps errors that occur while decoding API responses.
func (*DecodeError) Error ¶
func (e *DecodeError) Error() string
func (*DecodeError) Unwrap ¶
func (e *DecodeError) Unwrap() error
type GetParams ¶ added in v0.2.0
type GetParams struct {
// Algorithm Generator algorithm selection
Algorithm *GetParamsAlgorithm `form:"algorithm,omitempty" json:"algorithm,omitempty"`
// Version UUID version.
// When algorithm=ulid, version is ignored and ULIDs are produced.
Version *GetParamsVersion `form:"version,omitempty" json:"version,omitempty"`
// Count Number of identifiers to generate.
Count *int `form:"count,omitempty" json:"count,omitempty"`
// Format Response format.
// - `json` → default structured JSON
// - `text` → newline-delimited plaintext output
Format *GetParamsFormat `form:"format,omitempty" json:"format,omitempty"`
}
GetParams defines parameters for Get.
type GetParamsAlgorithm ¶ added in v0.2.0
type GetParamsAlgorithm string
GetParamsAlgorithm defines parameters for Get.
const ( GetParamsAlgorithmUlid GetParamsAlgorithm = "ulid" GetParamsAlgorithmUuid GetParamsAlgorithm = "uuid" )
Defines values for GetParamsAlgorithm.
type GetParamsFormat ¶ added in v0.2.0
type GetParamsFormat string
GetParamsFormat defines parameters for Get.
const ( Json GetParamsFormat = "json" Text GetParamsFormat = "text" )
Defines values for GetParamsFormat.
type GetParamsVersion ¶ added in v0.2.0
type GetParamsVersion string
GetParamsVersion defines parameters for Get.
const ( GetParamsVersionUlid GetParamsVersion = "ulid" GetParamsVersionV1 GetParamsVersion = "v1" GetParamsVersionV4 GetParamsVersion = "v4" GetParamsVersionV7 GetParamsVersion = "v7" )
Defines values for GetParamsVersion.
type GetResponse ¶ added in v0.2.0
type GetResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *struct {
// contains filtered or unexported fields
}
JSON400 *struct {
Error *string `json:"error,omitempty"`
}
}
func ParseGetResponse ¶ added in v0.2.0
func ParseGetResponse(rsp *http.Response) (*GetResponse, error)
ParseGetResponse parses an HTTP response from a GetWithResponse call
func (GetResponse) Status ¶ added in v0.2.0
func (r GetResponse) Status() string
Status returns HTTPResponse.Status
func (GetResponse) StatusCode ¶ added in v0.2.0
func (r GetResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type HttpRequestDoer ¶ added in v0.2.0
Doer performs HTTP requests.
The standard http.Client implements this interface.
type RequestEditorFn ¶ added in v0.2.0
RequestEditorFn is the function signature for the RequestEditor callback function
type RequestError ¶
type RequestError struct {
Err error
}
RequestError wraps lower-level request construction or transport errors.
func (*RequestError) Error ¶
func (e *RequestError) Error() string
func (*RequestError) Unwrap ¶
func (e *RequestError) Unwrap() error