push

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: 11 Imported by: 0

Documentation

Overview

Package push 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 NewDeletePushTokenRequest

func NewDeletePushTokenRequest(server string, id openapi_types.UUID, params *DeletePushTokenParams) (*http.Request, error)

NewDeletePushTokenRequest generates requests for DeletePushToken

func NewListPushTokensRequest

func NewListPushTokensRequest(server string, params *ListPushTokensParams) (*http.Request, error)

NewListPushTokensRequest generates requests for ListPushTokens

func NewRegisterPushTokenRequest

func NewRegisterPushTokenRequest(server string, params *RegisterPushTokenParams, body RegisterPushTokenJSONRequestBody) (*http.Request, error)

NewRegisterPushTokenRequest calls the generic RegisterPushToken builder with application/json body

func NewRegisterPushTokenRequestWithBody

func NewRegisterPushTokenRequestWithBody(server string, params *RegisterPushTokenParams, contentType string, body io.Reader) (*http.Request, error)

NewRegisterPushTokenRequestWithBody generates requests for RegisterPushToken with any type of body

Types

type BadRequest

type BadRequest = ProblemDetails

BadRequest RFC 9457 problem details object.

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) DeletePushToken

func (c *Client) DeletePushToken(ctx context.Context, id openapi_types.UUID, params *DeletePushTokenParams, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) ListPushTokens

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

func (*Client) RegisterPushToken

func (c *Client) RegisterPushToken(ctx context.Context, params *RegisterPushTokenParams, body RegisterPushTokenJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) RegisterPushTokenWithBody

func (c *Client) RegisterPushTokenWithBody(ctx context.Context, params *RegisterPushTokenParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

type ClientInterface

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

	// RegisterPushTokenWithBody request with any body
	RegisterPushTokenWithBody(ctx context.Context, params *RegisterPushTokenParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	RegisterPushToken(ctx context.Context, params *RegisterPushTokenParams, body RegisterPushTokenJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// DeletePushToken request
	DeletePushToken(ctx context.Context, id openapi_types.UUID, params *DeletePushTokenParams, 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) DeletePushTokenWithResponse

func (c *ClientWithResponses) DeletePushTokenWithResponse(ctx context.Context, id openapi_types.UUID, params *DeletePushTokenParams, reqEditors ...RequestEditorFn) (*DeletePushTokenResp, error)

DeletePushTokenWithResponse request returning *DeletePushTokenResp

func (*ClientWithResponses) ListPushTokensWithResponse

func (c *ClientWithResponses) ListPushTokensWithResponse(ctx context.Context, params *ListPushTokensParams, reqEditors ...RequestEditorFn) (*ListPushTokensResp, error)

ListPushTokensWithResponse request returning *ListPushTokensResp

func (*ClientWithResponses) RegisterPushTokenWithBodyWithResponse

func (c *ClientWithResponses) RegisterPushTokenWithBodyWithResponse(ctx context.Context, params *RegisterPushTokenParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*RegisterPushTokenResp, error)

RegisterPushTokenWithBodyWithResponse request with arbitrary body returning *RegisterPushTokenResp

func (*ClientWithResponses) RegisterPushTokenWithResponse

func (c *ClientWithResponses) RegisterPushTokenWithResponse(ctx context.Context, params *RegisterPushTokenParams, body RegisterPushTokenJSONRequestBody, reqEditors ...RequestEditorFn) (*RegisterPushTokenResp, error)

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// ListPushTokensWithResponse request
	ListPushTokensWithResponse(ctx context.Context, params *ListPushTokensParams, reqEditors ...RequestEditorFn) (*ListPushTokensResp, error)

	// RegisterPushTokenWithBodyWithResponse request with any body
	RegisterPushTokenWithBodyWithResponse(ctx context.Context, params *RegisterPushTokenParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*RegisterPushTokenResp, error)

	RegisterPushTokenWithResponse(ctx context.Context, params *RegisterPushTokenParams, body RegisterPushTokenJSONRequestBody, reqEditors ...RequestEditorFn) (*RegisterPushTokenResp, error)

	// DeletePushTokenWithResponse request
	DeletePushTokenWithResponse(ctx context.Context, id openapi_types.UUID, params *DeletePushTokenParams, reqEditors ...RequestEditorFn) (*DeletePushTokenResp, error)
}

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

type DPoPHeader

type DPoPHeader = string

DPoPHeader defines model for DPoPHeader.

type DeletePushTokenParams

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

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

DeletePushTokenParams defines parameters for DeletePushToken.

type DeletePushTokenResp

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

func ParseDeletePushTokenResp

func ParseDeletePushTokenResp(rsp *http.Response) (*DeletePushTokenResp, error)

ParseDeletePushTokenResp parses an HTTP response from a DeletePushTokenWithResponse call

func (DeletePushTokenResp) ContentType added in v0.20.0

func (r DeletePushTokenResp) ContentType() string

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

func (DeletePushTokenResp) Status

func (r DeletePushTokenResp) Status() string

Status returns HTTPResponse.Status

func (DeletePushTokenResp) StatusCode

func (r DeletePushTokenResp) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type Forbidden

type Forbidden = ProblemDetails

Forbidden RFC 9457 problem details object.

type HttpRequestDoer

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

Doer performs HTTP requests.

The standard http.Client implements this interface.

type ListPushTokensParams

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

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

ListPushTokensParams defines parameters for ListPushTokens.

type ListPushTokensResp

type ListPushTokensResp struct {
	Body                      []byte
	HTTPResponse              *http.Response
	JSON200                   *PushTokenList
	ApplicationproblemJSON401 *Unauthorized
	ApplicationproblemJSON403 *Forbidden
	ApplicationproblemJSON429 *TooManyRequests
}

func ParseListPushTokensResp

func ParseListPushTokensResp(rsp *http.Response) (*ListPushTokensResp, error)

ParseListPushTokensResp parses an HTTP response from a ListPushTokensWithResponse call

func (ListPushTokensResp) ContentType added in v0.20.0

func (r ListPushTokensResp) ContentType() string

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

func (ListPushTokensResp) Status

func (r ListPushTokensResp) Status() string

Status returns HTTPResponse.Status

func (ListPushTokensResp) StatusCode

func (r ListPushTokensResp) 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 Platform

type Platform string

Platform Push delivery channel.

const (
	Apns Platform = "apns"
	Fcm  Platform = "fcm"
)

Defines values for Platform.

func (Platform) Valid

func (e Platform) Valid() bool

Valid indicates whether the value is a known member of the Platform enum.

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 PushToken

type PushToken struct {
	AppId      string             `json:"app_id"`
	CreatedAt  time.Time          `json:"created_at"`
	DeviceId   string             `json:"device_id"`
	Id         openapi_types.UUID `json:"id"`
	LastSeenAt time.Time          `json:"last_seen_at"`

	// Platform Push delivery channel.
	Platform  Platform  `json:"platform"`
	UpdatedAt time.Time `json:"updated_at"`
}

PushToken defines model for PushToken.

type PushTokenList

type PushTokenList struct {
	Tokens []PushToken `json:"tokens"`
}

PushTokenList defines model for PushTokenList.

type RegisterPushTokenJSONRequestBody

type RegisterPushTokenJSONRequestBody = RegisterTokenRequest

RegisterPushTokenJSONRequestBody defines body for RegisterPushToken for application/json ContentType.

type RegisterPushTokenParams

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

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

RegisterPushTokenParams defines parameters for RegisterPushToken.

type RegisterPushTokenResp

type RegisterPushTokenResp struct {
	Body                      []byte
	HTTPResponse              *http.Response
	JSON201                   *RegisterTokenResponse
	ApplicationproblemJSON400 *BadRequest
	ApplicationproblemJSON401 *Unauthorized
	ApplicationproblemJSON403 *Forbidden
	ApplicationproblemJSON413 *PayloadTooLarge
	ApplicationproblemJSON429 *TooManyRequests
}

func ParseRegisterPushTokenResp

func ParseRegisterPushTokenResp(rsp *http.Response) (*RegisterPushTokenResp, error)

ParseRegisterPushTokenResp parses an HTTP response from a RegisterPushTokenWithResponse call

func (RegisterPushTokenResp) ContentType added in v0.20.0

func (r RegisterPushTokenResp) ContentType() string

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

func (RegisterPushTokenResp) Status

func (r RegisterPushTokenResp) Status() string

Status returns HTTPResponse.Status

func (RegisterPushTokenResp) StatusCode

func (r RegisterPushTokenResp) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type RegisterTokenRequest

type RegisterTokenRequest struct {
	// AppId iOS bundle identifier (e.g. `com.naughtbot.mobile`) or
	// Android package name. Used as the APNs `apns-topic`.
	AppId string `json:"app_id"`

	// DeviceId Caller's device identifier. Must equal the access token's
	// `device_id` claim — handlers reject mismatches with 403.
	DeviceId string `json:"device_id"`

	// Platform Push delivery channel.
	Platform Platform `json:"platform"`

	// PushToken APNs device token (hex) or FCM registration token. Capped at
	// 1024 chars; oversize bodies receive 413.
	PushToken string `json:"push_token"`
}

RegisterTokenRequest defines model for RegisterTokenRequest.

type RegisterTokenResponse

type RegisterTokenResponse struct {
	// Id Server-assigned row id.
	Id openapi_types.UUID `json:"id"`
}

RegisterTokenResponse defines model for RegisterTokenResponse.

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