blob

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package blob provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT.

Index

Constants

View Source
const (
	DpopAccessTokenScopes dpopAccessTokenContextKey = "dpopAccessToken.Scopes"
)

Variables

This section is empty.

Functions

func NewDeleteBlobRequest

func NewDeleteBlobRequest(server string, key BlobKey, params *DeleteBlobParams) (*http.Request, error)

NewDeleteBlobRequest generates requests for DeleteBlob

func NewGetBlobRequest

func NewGetBlobRequest(server string, key BlobKey, params *GetBlobParams) (*http.Request, error)

NewGetBlobRequest generates requests for GetBlob

func NewListBlobsRequest

func NewListBlobsRequest(server string, params *ListBlobsParams) (*http.Request, error)

NewListBlobsRequest generates requests for ListBlobs

func NewPutBlobRequestWithBody

func NewPutBlobRequestWithBody(server string, key BlobKey, params *PutBlobParams, contentType string, body io.Reader) (*http.Request, error)

NewPutBlobRequestWithBody generates requests for PutBlob with any type of body

Types

type BadRequest

type BadRequest = ProblemDetails

BadRequest RFC 9457 problem details object.

type BlobKey

type BlobKey = string

BlobKey defines model for BlobKey.

type BlobListResponse

type BlobListResponse struct {
	Items []BlobMeta `json:"items"`

	// NextCursor Opaque cursor for the next page; null when there are no more.
	NextCursor *string `json:"next_cursor"`
}

BlobListResponse defines model for BlobListResponse.

type BlobMeta

type BlobMeta struct {
	// Etag Strong ETag of the form `"v<n>"`.
	Etag string `json:"etag"`

	// Key Blob key within the calling user's namespace.
	Key string `json:"key"`

	// Size Length in bytes of the stored data.
	Size int `json:"size"`

	// UpdatedAt Timestamp of the latest write.
	UpdatedAt time.Time `json:"updated_at"`

	// Version Monotonically-increasing version, starts at 1.
	Version int `json:"version"`
}

BlobMeta Per-blob metadata returned by list and put operations.

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 (*Client) DeleteBlob

func (c *Client) DeleteBlob(ctx context.Context, key BlobKey, params *DeleteBlobParams, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetBlob

func (c *Client) GetBlob(ctx context.Context, key BlobKey, params *GetBlobParams, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) ListBlobs

func (c *Client) ListBlobs(ctx context.Context, params *ListBlobsParams, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) PutBlobWithBody

func (c *Client) PutBlobWithBody(ctx context.Context, key BlobKey, params *PutBlobParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

type ClientInterface

type ClientInterface interface {
	// ListBlobs request
	ListBlobs(ctx context.Context, params *ListBlobsParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// DeleteBlob request
	DeleteBlob(ctx context.Context, key BlobKey, params *DeleteBlobParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetBlob request
	GetBlob(ctx context.Context, key BlobKey, params *GetBlobParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// PutBlobWithBody request with any body
	PutBlobWithBody(ctx context.Context, key BlobKey, params *PutBlobParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
}

The interface specification for the client above.

type ClientOption

type ClientOption func(*Client) error

ClientOption allows setting custom parameters during construction

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL overrides the baseURL.

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

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.

type ClientWithResponses

type ClientWithResponses struct {
	ClientInterface
}

ClientWithResponses builds on ClientInterface to offer response payloads

func NewClientWithResponses

func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)

NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling

func (*ClientWithResponses) DeleteBlobWithResponse

func (c *ClientWithResponses) DeleteBlobWithResponse(ctx context.Context, key BlobKey, params *DeleteBlobParams, reqEditors ...RequestEditorFn) (*DeleteBlobResp, error)

DeleteBlobWithResponse request returning *DeleteBlobResp

func (*ClientWithResponses) GetBlobWithResponse

func (c *ClientWithResponses) GetBlobWithResponse(ctx context.Context, key BlobKey, params *GetBlobParams, reqEditors ...RequestEditorFn) (*GetBlobResp, error)

GetBlobWithResponse request returning *GetBlobResp

func (*ClientWithResponses) ListBlobsWithResponse

func (c *ClientWithResponses) ListBlobsWithResponse(ctx context.Context, params *ListBlobsParams, reqEditors ...RequestEditorFn) (*ListBlobsResp, error)

ListBlobsWithResponse request returning *ListBlobsResp

func (*ClientWithResponses) PutBlobWithBodyWithResponse

func (c *ClientWithResponses) PutBlobWithBodyWithResponse(ctx context.Context, key BlobKey, params *PutBlobParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PutBlobResp, error)

PutBlobWithBodyWithResponse request with arbitrary body returning *PutBlobResp

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// ListBlobsWithResponse request
	ListBlobsWithResponse(ctx context.Context, params *ListBlobsParams, reqEditors ...RequestEditorFn) (*ListBlobsResp, error)

	// DeleteBlobWithResponse request
	DeleteBlobWithResponse(ctx context.Context, key BlobKey, params *DeleteBlobParams, reqEditors ...RequestEditorFn) (*DeleteBlobResp, error)

	// GetBlobWithResponse request
	GetBlobWithResponse(ctx context.Context, key BlobKey, params *GetBlobParams, reqEditors ...RequestEditorFn) (*GetBlobResp, error)

	// PutBlobWithBodyWithResponse request with any body
	PutBlobWithBodyWithResponse(ctx context.Context, key BlobKey, params *PutBlobParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PutBlobResp, error)
}

ClientWithResponsesInterface is the interface specification for the client with responses above.

type DPoPHeader

type DPoPHeader = string

DPoPHeader defines model for DPoPHeader.

type DeleteBlobParams

type DeleteBlobParams struct {
	// XRequestID Optional client-supplied correlation identifier.
	XRequestID *XRequestID `json:"X-Request-ID,omitempty"`

	// DPoP DPoP proof JWT per RFC 9449 §4. The server validates `htm`, `htu`,
	// `iat`, `jti`, `typ=dpop+jwt`, `alg` (must be ES256), and the embedded
	// `jwk`. Blob verifies the proof's JWK thumbprint against the token's
	// `cnf.jkt` binding.
	DPoP DPoPHeader `json:"DPoP"`
}

DeleteBlobParams defines parameters for DeleteBlob.

type DeleteBlobResp

type DeleteBlobResp struct {
	Body                      []byte
	HTTPResponse              *http.Response
	ApplicationproblemJSON400 *BadRequest
	ApplicationproblemJSON401 *Unauthorized
	ApplicationproblemJSON403 *Forbidden
	ApplicationproblemJSON429 *TooManyRequests
}

func ParseDeleteBlobResp

func ParseDeleteBlobResp(rsp *http.Response) (*DeleteBlobResp, error)

ParseDeleteBlobResp parses an HTTP response from a DeleteBlobWithResponse call

func (DeleteBlobResp) ContentType added in v0.20.0

func (r DeleteBlobResp) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (DeleteBlobResp) Status

func (r DeleteBlobResp) Status() string

Status returns HTTPResponse.Status

func (DeleteBlobResp) StatusCode

func (r DeleteBlobResp) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type Forbidden

type Forbidden = ProblemDetails

Forbidden RFC 9457 problem details object.

type GetBlobParams

type GetBlobParams struct {
	// XRequestID Optional client-supplied correlation identifier.
	XRequestID *XRequestID `json:"X-Request-ID,omitempty"`

	// DPoP DPoP proof JWT per RFC 9449 §4. The server validates `htm`, `htu`,
	// `iat`, `jti`, `typ=dpop+jwt`, `alg` (must be ES256), and the embedded
	// `jwk`. Blob verifies the proof's JWK thumbprint against the token's
	// `cnf.jkt` binding.
	DPoP DPoPHeader `json:"DPoP"`

	// IfNoneMatch Strong ETag previously returned for this key. 304 if it still matches.
	IfNoneMatch *string `json:"If-None-Match,omitempty"`
}

GetBlobParams defines parameters for GetBlob.

type GetBlobResp

type GetBlobResp struct {
	Body                      []byte
	HTTPResponse              *http.Response
	ApplicationproblemJSON400 *BadRequest
	ApplicationproblemJSON401 *Unauthorized
	ApplicationproblemJSON403 *Forbidden
	ApplicationproblemJSON404 *NotFound
	ApplicationproblemJSON429 *TooManyRequests
}

func ParseGetBlobResp

func ParseGetBlobResp(rsp *http.Response) (*GetBlobResp, error)

ParseGetBlobResp parses an HTTP response from a GetBlobWithResponse call

func (GetBlobResp) ContentType added in v0.20.0

func (r GetBlobResp) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (GetBlobResp) Status

func (r GetBlobResp) Status() string

Status returns HTTPResponse.Status

func (GetBlobResp) StatusCode

func (r GetBlobResp) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type HttpRequestDoer

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer performs HTTP requests.

The standard http.Client implements this interface.

type ListBlobsParams

type ListBlobsParams struct {
	// Prefix Filter to blob keys starting with this prefix.
	Prefix *string `form:"prefix,omitempty" json:"prefix,omitempty"`

	// Cursor Opaque keyset cursor returned by a prior page.
	Cursor *string `form:"cursor,omitempty" json:"cursor,omitempty"`

	// Limit Maximum number of items to return (1-200, default 50).
	Limit *int `form:"limit,omitempty" json:"limit,omitempty"`

	// XRequestID Optional client-supplied correlation identifier.
	XRequestID *XRequestID `json:"X-Request-ID,omitempty"`

	// DPoP DPoP proof JWT per RFC 9449 §4. The server validates `htm`, `htu`,
	// `iat`, `jti`, `typ=dpop+jwt`, `alg` (must be ES256), and the embedded
	// `jwk`. Blob verifies the proof's JWK thumbprint against the token's
	// `cnf.jkt` binding.
	DPoP DPoPHeader `json:"DPoP"`
}

ListBlobsParams defines parameters for ListBlobs.

type ListBlobsResp

type ListBlobsResp struct {
	Body                      []byte
	HTTPResponse              *http.Response
	JSON200                   *BlobListResponse
	ApplicationproblemJSON400 *BadRequest
	ApplicationproblemJSON401 *Unauthorized
	ApplicationproblemJSON403 *Forbidden
	ApplicationproblemJSON429 *TooManyRequests
}

func ParseListBlobsResp

func ParseListBlobsResp(rsp *http.Response) (*ListBlobsResp, error)

ParseListBlobsResp parses an HTTP response from a ListBlobsWithResponse call

func (ListBlobsResp) ContentType added in v0.20.0

func (r ListBlobsResp) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (ListBlobsResp) Status

func (r ListBlobsResp) Status() string

Status returns HTTPResponse.Status

func (ListBlobsResp) StatusCode

func (r ListBlobsResp) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type NotFound

type NotFound = ProblemDetails

NotFound RFC 9457 problem details object.

type PayloadTooLarge

type PayloadTooLarge = ProblemDetails

PayloadTooLarge RFC 9457 problem details object.

type ProblemDetails

type ProblemDetails struct {
	Detail               *string                `json:"detail,omitempty"`
	Instance             *string                `json:"instance,omitempty"`
	Status               *int                   `json:"status,omitempty"`
	Title                *string                `json:"title,omitempty"`
	Type                 *string                `json:"type,omitempty"`
	AdditionalProperties map[string]interface{} `json:"-"`
}

ProblemDetails RFC 9457 problem details object.

func (ProblemDetails) Get

func (a ProblemDetails) Get(fieldName string) (value interface{}, found bool)

Getter for additional properties for ProblemDetails. Returns the specified element and whether it was found

func (ProblemDetails) MarshalJSON

func (a ProblemDetails) MarshalJSON() ([]byte, error)

Override default JSON handling for ProblemDetails to handle AdditionalProperties

func (*ProblemDetails) Set

func (a *ProblemDetails) Set(fieldName string, value interface{})

Setter for additional properties for ProblemDetails

func (*ProblemDetails) UnmarshalJSON

func (a *ProblemDetails) UnmarshalJSON(b []byte) error

Override default JSON handling for ProblemDetails to handle AdditionalProperties

type PutBlobParams

type PutBlobParams struct {
	// XRequestID Optional client-supplied correlation identifier.
	XRequestID *XRequestID `json:"X-Request-ID,omitempty"`

	// DPoP DPoP proof JWT per RFC 9449 §4. The server validates `htm`, `htu`,
	// `iat`, `jti`, `typ=dpop+jwt`, `alg` (must be ES256), and the embedded
	// `jwk`. Blob verifies the proof's JWK thumbprint against the token's
	// `cnf.jkt` binding.
	DPoP DPoPHeader `json:"DPoP"`

	// IfMatch Replace only if the current ETag matches.
	IfMatch *string `json:"If-Match,omitempty"`

	// IfNoneMatch Set to `*` to require the key not to exist.
	IfNoneMatch *string `json:"If-None-Match,omitempty"`
}

PutBlobParams defines parameters for PutBlob.

type PutBlobResp

type PutBlobResp struct {
	Body                      []byte
	HTTPResponse              *http.Response
	JSON200                   *BlobMeta
	ApplicationproblemJSON400 *BadRequest
	ApplicationproblemJSON401 *Unauthorized
	ApplicationproblemJSON403 *Forbidden
	ApplicationproblemJSON412 *ProblemDetails
	ApplicationproblemJSON413 *PayloadTooLarge
	ApplicationproblemJSON429 *TooManyRequests
}

func ParsePutBlobResp

func ParsePutBlobResp(rsp *http.Response) (*PutBlobResp, error)

ParsePutBlobResp parses an HTTP response from a PutBlobWithResponse call

func (PutBlobResp) ContentType added in v0.20.0

func (r PutBlobResp) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (PutBlobResp) Status

func (r PutBlobResp) Status() string

Status returns HTTPResponse.Status

func (PutBlobResp) StatusCode

func (r PutBlobResp) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type RequestEditorFn

type RequestEditorFn func(ctx context.Context, req *http.Request) error

RequestEditorFn is the function signature for the RequestEditor callback function

type TooManyRequests

type TooManyRequests = ProblemDetails

TooManyRequests RFC 9457 problem details object.

type Unauthorized

type Unauthorized = ProblemDetails

Unauthorized RFC 9457 problem details object.

type XRequestID

type XRequestID = string

XRequestID defines model for XRequestID.

Jump to

Keyboard shortcuts

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