codegen

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2025 License: AGPL-3.0 Imports: 29 Imported by: 0

Documentation

Overview

Code generated by ogen, DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithServerURL

func WithServerURL(ctx context.Context, u *url.URL) context.Context

WithServerURL sets context key to override server URL.

Types

type Alg

type Alg string

The algorithm this key can be used for. Ref: #/components/schemas/Alg

const (
	AlgHS256            Alg = "HS256"
	AlgHS384            Alg = "HS384"
	AlgHS512            Alg = "HS512"
	AlgRS256            Alg = "RS256"
	AlgRS384            Alg = "RS384"
	AlgRS512            Alg = "RS512"
	AlgES256            Alg = "ES256"
	AlgES384            Alg = "ES384"
	AlgES512            Alg = "ES512"
	AlgPS256            Alg = "PS256"
	AlgPS384            Alg = "PS384"
	AlgPS512            Alg = "PS512"
	AlgEdDSA            Alg = "EdDSA"
	AlgRSAOAEP          Alg = "RSA-OAEP"
	AlgRSAOAEP256       Alg = "RSA-OAEP-256"
	AlgA128KW           Alg = "A128KW"
	AlgA192KW           Alg = "A192KW"
	AlgA256KW           Alg = "A256KW"
	AlgDir              Alg = "dir"
	AlgECDHES           Alg = "ECDH-ES"
	AlgECDHESA128KW     Alg = "ECDH-ES+A128KW"
	AlgECDHESA192KW     Alg = "ECDH-ES+A192KW"
	AlgECDHESA256KW     Alg = "ECDH-ES+A256KW"
	AlgA128GCMKW        Alg = "A128GCMKW"
	AlgA192GCMKW        Alg = "A192GCMKW"
	AlgA256GCMKW        Alg = "A256GCMKW"
	AlgPBES2HS256A128KW Alg = "PBES2-HS256+A128KW"
	AlgPBES2HS384A192KW Alg = "PBES2-HS384+A192KW"
	AlgPBES2HS512A256KW Alg = "PBES2-HS512+A256KW"
	AlgA128CBCHS256     Alg = "A128CBC-HS256"
	AlgA192CBCHS384     Alg = "A192CBC-HS384"
	AlgA256CBCHS512     Alg = "A256CBC-HS512"
	AlgA128GCM          Alg = "A128GCM"
	AlgA192GCM          Alg = "A192GCM"
	AlgA256GCM          Alg = "A256GCM"
)

func (Alg) AllValues

func (Alg) AllValues() []Alg

AllValues returns all Alg values.

func (*Alg) Decode

func (s *Alg) Decode(d *jx.Decoder) error

Decode decodes Alg from json.

func (Alg) Encode

func (s Alg) Encode(e *jx.Encoder)

Encode encodes Alg as json.

func (Alg) MarshalJSON

func (s Alg) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (Alg) MarshalText

func (s Alg) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*Alg) UnmarshalJSON

func (s *Alg) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*Alg) UnmarshalText

func (s *Alg) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (Alg) Validate

func (s Alg) Validate() error

type BearerAuth

type BearerAuth struct {
	Token string
}

func (*BearerAuth) GetToken

func (s *BearerAuth) GetToken() string

GetToken returns the value of Token.

func (*BearerAuth) SetToken

func (s *BearerAuth) SetToken(val string)

SetToken sets the value of Token.

type CheckSessionRes

type CheckSessionRes interface {
	// contains filtered or unexported methods
}

type Claims

type Claims struct {
	// The unique identifier of the user. Can be null if the session is anonymous.
	UserID OptNilUUID `json:"userID"`
	// The roles granted by the token.
	Roles []Role `json:"roles"`
}

Ref: #/components/schemas/Claims

func (*Claims) Decode

func (s *Claims) Decode(d *jx.Decoder) error

Decode decodes Claims from json.

func (*Claims) Encode

func (s *Claims) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*Claims) GetRoles

func (s *Claims) GetRoles() []Role

GetRoles returns the value of Roles.

func (*Claims) GetUserID

func (s *Claims) GetUserID() OptNilUUID

GetUserID returns the value of UserID.

func (*Claims) MarshalJSON

func (s *Claims) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*Claims) SetRoles

func (s *Claims) SetRoles(val []Role)

SetRoles sets the value of Roles.

func (*Claims) SetUserID

func (s *Claims) SetUserID(val OptNilUUID)

SetUserID sets the value of UserID.

func (*Claims) UnmarshalJSON

func (s *Claims) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*Claims) Validate

func (s *Claims) Validate() error

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client implements OAS client.

func NewClient

func NewClient(serverURL string, sec SecuritySource, opts ...ClientOption) (*Client, error)

NewClient initializes new Client defined by OAS.

func (*Client) CheckSession

func (c *Client) CheckSession(ctx context.Context) (CheckSessionRes, error)

CheckSession invokes checkSession operation.

Takes an empty request with authorization headers, and check the validity of those headers. If the headers can be used to access any protected resource, the session is considered valid and the decoded claims are returned as a success response. Otherwise, an error will be sent, explaining why the session is invalid.

GET /session

func (*Client) CreateAnonSession

func (c *Client) CreateAnonSession(ctx context.Context) (CreateAnonSessionRes, error)

CreateAnonSession invokes createAnonSession operation.

Create a new anonymous session. An anonymous session is delivered without constraint, and grants basic access to apis with low protection.

PUT /session/anon

func (*Client) CreateSession

func (c *Client) CreateSession(ctx context.Context, request *LoginForm) (CreateSessionRes, error)

CreateSession invokes createSession operation.

Create a new session, using a set of credentials. The provided credentials will be used to validate the identity of the caller. Once the credentials have been verified, a token is issued. The access rights it grants may depend on the profile of the user.

PUT /session

func (*Client) EmailExists

func (c *Client) EmailExists(ctx context.Context, params EmailExistsParams) (EmailExistsRes, error)

EmailExists invokes emailExists operation.

Returns an empty, successful response if the email is already associated to an user. Otherwise, it fails with a not found (404) error status.

GET /credentials/email

func (*Client) GetPublicKey

func (c *Client) GetPublicKey(ctx context.Context, params GetPublicKeyParams) (GetPublicKeyRes, error)

GetPublicKey invokes getPublicKey operation.

Get a public key from its usage.

GET /public-keys

func (*Client) ListPublicKeys

func (c *Client) ListPublicKeys(ctx context.Context, params ListPublicKeysParams) (ListPublicKeysRes, error)

ListPublicKeys invokes listPublicKeys operation.

Get all public keys from the service that match a given usage.

GET /public-keys/list

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) (PingRes, error)

Ping invokes ping operation.

Check the status of the service. If the service is running, a successful response is returned.

GET /ping

func (*Client) Register

func (c *Client) Register(ctx context.Context, request *RegisterForm) (RegisterRes, error)

Register invokes register operation.

Create a new user. The form must contain a short code, that was sent through a registration link at the user desired email. On success, a valid access token is returned, that can be used to access higher-privilege routes.

PUT /credentials

func (*Client) RequestEmailUpdate

func (c *Client) RequestEmailUpdate(ctx context.Context, request *RequestEmailUpdateForm) (RequestEmailUpdateRes, error)

RequestEmailUpdate invokes requestEmailUpdate operation.

Create a new short code for updating the email of an user. This short code is sent to the new address. If the user clicks on it, it should take it to a page that will forward the short code back to this API. Once done, the email associated to the user will be updated automatically. This route requires to be called by an authenticated user. Anonymous sessions cannot trigger an email update request. NOTE that this request does not verify the availability of an email. You may check this beforehand,

using

the `Email Exists` endpoint. If multiple email update links are requested for the same email, only the last one will be valid.

PUT /short-code/update-email

func (*Client) RequestPasswordReset

func (c *Client) RequestPasswordReset(ctx context.Context, request *RequestPasswordResetForm) (RequestPasswordResetRes, error)

RequestPasswordReset invokes requestPasswordReset operation.

Create a new short code for updating the password of an user. This short code is sent to the new address. If the user clicks on it, it should take it to a page that will forward the short code back to this API. Once done, the password of the user is updated. This route does not require authentication (although it requires at least an anonymous session). This allow users who forgot their password to reset it. If multiple password update links are requested for the same email, only the last one will be valid.

PUT /short-code/update-password

func (*Client) RequestRegistration

func (c *Client) RequestRegistration(ctx context.Context, request *RequestRegistrationForm) (RequestRegistrationRes, error)

RequestRegistration invokes requestRegistration operation.

To prevent spam in our user database, registration must be done through a link sent by e-mail, so we can ensure this address is valid. When a user registers, the short code it received must be sent along with the registration payload.

The email

of the payload MUST match the email the short code was sent to, and is used to retrieve the short code. NOTE that this request does not verify the availability of an email. You may check this beforehand,

using

the `Email Exists` endpoint. If multiple registration links are requested for the same email, only the last one will be valid.

PUT /short-code/register

func (*Client) ResetPassword

func (c *Client) ResetPassword(ctx context.Context, request *ResetPasswordForm) (ResetPasswordRes, error)

ResetPassword invokes resetPassword operation.

Reset the password of an user. This route allows an unauthenticated session to update the password of a user. To prevent security issues, this route requires a short code that was sent to the email of the user that requested the password reset.

PATCH /credentials/password/reset

func (*Client) UpdateEmail

func (c *Client) UpdateEmail(ctx context.Context, request *UpdateEmailForm) (UpdateEmailRes, error)

UpdateEmail invokes updateEmail operation.

Update the email of an user. This route requires a valid short code, that was sent to the new email. If the short code is valid, the email of the user is updated with the email address the short code was sent to.

PATCH /credentials/email

func (*Client) UpdatePassword

func (c *Client) UpdatePassword(ctx context.Context, request *UpdatePasswordForm) (UpdatePasswordRes, error)

UpdatePassword invokes updatePassword operation.

Update the password of an user. This route requires the original password of the user, to double check the identity of the caller.

PATCH /credentials/password

type ClientOption

type ClientOption interface {
	// contains filtered or unexported methods
}

ClientOption is client config option.

func WithClient

func WithClient(client ht.Client) ClientOption

WithClient specifies http client to use.

type ConflictError

type ConflictError struct {
	// The error message.
	Error string `json:"error"`
}

Ref: #/components/schemas/ConflictError

func (*ConflictError) Decode

func (s *ConflictError) Decode(d *jx.Decoder) error

Decode decodes ConflictError from json.

func (*ConflictError) Encode

func (s *ConflictError) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*ConflictError) GetError

func (s *ConflictError) GetError() string

GetError returns the value of Error.

func (*ConflictError) MarshalJSON

func (s *ConflictError) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*ConflictError) SetError

func (s *ConflictError) SetError(val string)

SetError sets the value of Error.

func (*ConflictError) UnmarshalJSON

func (s *ConflictError) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type CreateAnonSessionIMATeapot

type CreateAnonSessionIMATeapot struct{}

CreateAnonSessionIMATeapot is response for CreateAnonSession operation.

type CreateAnonSessionRes

type CreateAnonSessionRes interface {
	// contains filtered or unexported methods
}

type CreateSessionRes

type CreateSessionRes interface {
	// contains filtered or unexported methods
}

type Email

type Email string

func (*Email) Decode

func (s *Email) Decode(d *jx.Decoder) error

Decode decodes Email from json.

func (Email) Encode

func (s Email) Encode(e *jx.Encoder)

Encode encodes Email as json.

func (Email) MarshalJSON

func (s Email) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*Email) UnmarshalJSON

func (s *Email) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (Email) Validate

func (s Email) Validate() error

type EmailExistsNoContent

type EmailExistsNoContent struct{}

EmailExistsNoContent is response for EmailExists operation.

type EmailExistsParams

type EmailExistsParams struct {
	Email Email
}

EmailExistsParams is parameters of emailExists operation.

type EmailExistsRes

type EmailExistsRes interface {
	// contains filtered or unexported methods
}

type ErrorHandler

type ErrorHandler = ogenerrors.ErrorHandler

ErrorHandler is error handler.

type ForbiddenError

type ForbiddenError struct {
	// The error message.
	Error string `json:"error"`
}

Ref: #/components/schemas/ForbiddenError

func (*ForbiddenError) Decode

func (s *ForbiddenError) Decode(d *jx.Decoder) error

Decode decodes ForbiddenError from json.

func (*ForbiddenError) Encode

func (s *ForbiddenError) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*ForbiddenError) GetError

func (s *ForbiddenError) GetError() string

GetError returns the value of Error.

func (*ForbiddenError) MarshalJSON

func (s *ForbiddenError) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*ForbiddenError) SetError

func (s *ForbiddenError) SetError(val string)

SetError sets the value of Error.

func (*ForbiddenError) UnmarshalJSON

func (s *ForbiddenError) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type GetPublicKeyParams

type GetPublicKeyParams struct {
	// The unique identifier of the key, conveyed through its KID field.
	Kid KID
}

GetPublicKeyParams is parameters of getPublicKey operation.

type GetPublicKeyRes

type GetPublicKeyRes interface {
	// contains filtered or unexported methods
}

type Handler

type Handler interface {
	// CheckSession implements checkSession operation.
	//
	// Takes an empty request with authorization headers, and check the validity of those headers. If the
	// headers can
	// be used to access any protected resource, the session is considered valid and the decoded claims
	// are returned
	// as a success response. Otherwise, an error will be sent, explaining why the session is invalid.
	//
	// GET /session
	CheckSession(ctx context.Context) (CheckSessionRes, error)
	// CreateAnonSession implements createAnonSession operation.
	//
	// Create a new anonymous session. An anonymous session is delivered without constraint, and grants
	// basic access
	// to apis with low protection.
	//
	// PUT /session/anon
	CreateAnonSession(ctx context.Context) (CreateAnonSessionRes, error)
	// CreateSession implements createSession operation.
	//
	// Create a new session, using a set of credentials. The provided credentials will be used to
	// validate the
	// identity of the caller. Once the credentials have been verified, a token is issued. The access
	// rights it grants
	// may depend on the profile of the user.
	//
	// PUT /session
	CreateSession(ctx context.Context, req *LoginForm) (CreateSessionRes, error)
	// EmailExists implements emailExists operation.
	//
	// Returns an empty, successful response if the email is already associated to an user. Otherwise, it
	// fails
	// with a not found (404) error status.
	//
	// GET /credentials/email
	EmailExists(ctx context.Context, params EmailExistsParams) (EmailExistsRes, error)
	// GetPublicKey implements getPublicKey operation.
	//
	// Get a public key from its usage.
	//
	// GET /public-keys
	GetPublicKey(ctx context.Context, params GetPublicKeyParams) (GetPublicKeyRes, error)
	// ListPublicKeys implements listPublicKeys operation.
	//
	// Get all public keys from the service that match a given usage.
	//
	// GET /public-keys/list
	ListPublicKeys(ctx context.Context, params ListPublicKeysParams) (ListPublicKeysRes, error)
	// Ping implements ping operation.
	//
	// Check the status of the service. If the service is running, a successful response is returned.
	//
	// GET /ping
	Ping(ctx context.Context) (PingRes, error)
	// Register implements register operation.
	//
	// Create a new user. The form must contain a short code, that was sent through a registration link
	// at the user
	// desired email.
	// On success, a valid access token is returned, that can be used to access higher-privilege routes.
	//
	// PUT /credentials
	Register(ctx context.Context, req *RegisterForm) (RegisterRes, error)
	// RequestEmailUpdate implements requestEmailUpdate operation.
	//
	// Create a new short code for updating the email of an user. This short code is sent to the new
	// address.
	// If the user clicks on it, it should take it to a page that will forward the short code back to
	// this API.
	// Once done, the email associated to the user will be updated automatically.
	// This route requires to be called by an authenticated user. Anonymous sessions cannot trigger an
	// email
	// update request.
	// NOTE that this request does not verify the availability of an email. You may check this beforehand,
	//  using
	// the `Email Exists` endpoint.
	// If multiple email update links are requested for the same email, only the last one will be valid.
	//
	// PUT /short-code/update-email
	RequestEmailUpdate(ctx context.Context, req *RequestEmailUpdateForm) (RequestEmailUpdateRes, error)
	// RequestPasswordReset implements requestPasswordReset operation.
	//
	// Create a new short code for updating the password of an user. This short code is sent to the new
	// address.
	// If the user clicks on it, it should take it to a page that will forward the short code back to
	// this API.
	// Once done, the password of the user is updated.
	// This route does not require authentication (although it requires at least an anonymous session).
	// This
	// allow users who forgot their password to reset it.
	// If multiple password update links are requested for the same email, only the last one will be
	// valid.
	//
	// PUT /short-code/update-password
	RequestPasswordReset(ctx context.Context, req *RequestPasswordResetForm) (RequestPasswordResetRes, error)
	// RequestRegistration implements requestRegistration operation.
	//
	// To prevent spam in our user database, registration must be done through a link sent by e-mail, so
	// we can
	// ensure this address is valid.
	// When a user registers, the short code it received must be sent along with the registration payload.
	//  The email
	// of the payload MUST match the email the short code was sent to, and is used to retrieve the short
	// code.
	// NOTE that this request does not verify the availability of an email. You may check this beforehand,
	//  using
	// the `Email Exists` endpoint.
	// If multiple registration links are requested for the same email, only the last one will be valid.
	//
	// PUT /short-code/register
	RequestRegistration(ctx context.Context, req *RequestRegistrationForm) (RequestRegistrationRes, error)
	// ResetPassword implements resetPassword operation.
	//
	// Reset the password of an user. This route allows an unauthenticated session to update the password
	// of a user.
	// To prevent security issues, this route requires a short code that was sent to the email of the
	// user that
	// requested the password reset.
	//
	// PATCH /credentials/password/reset
	ResetPassword(ctx context.Context, req *ResetPasswordForm) (ResetPasswordRes, error)
	// UpdateEmail implements updateEmail operation.
	//
	// Update the email of an user. This route requires a valid short code, that was sent to the new
	// email.
	// If the short code is valid, the email of the user is updated with the email address the short code
	// was
	// sent to.
	//
	// PATCH /credentials/email
	UpdateEmail(ctx context.Context, req *UpdateEmailForm) (UpdateEmailRes, error)
	// UpdatePassword implements updatePassword operation.
	//
	// Update the password of an user. This route requires the original password of the user, to double
	// check
	// the identity of the caller.
	//
	// PATCH /credentials/password
	UpdatePassword(ctx context.Context, req *UpdatePasswordForm) (UpdatePasswordRes, error)
	// NewError creates *UnexpectedErrorStatusCode from error returned by handler.
	//
	// Used for common default response.
	NewError(ctx context.Context, err error) *UnexpectedErrorStatusCode
}

Handler handles operations described by OpenAPI v3 specification.

type Invoker

type Invoker interface {
	// CheckSession invokes checkSession operation.
	//
	// Takes an empty request with authorization headers, and check the validity of those headers. If the
	// headers can
	// be used to access any protected resource, the session is considered valid and the decoded claims
	// are returned
	// as a success response. Otherwise, an error will be sent, explaining why the session is invalid.
	//
	// GET /session
	CheckSession(ctx context.Context) (CheckSessionRes, error)
	// CreateAnonSession invokes createAnonSession operation.
	//
	// Create a new anonymous session. An anonymous session is delivered without constraint, and grants
	// basic access
	// to apis with low protection.
	//
	// PUT /session/anon
	CreateAnonSession(ctx context.Context) (CreateAnonSessionRes, error)
	// CreateSession invokes createSession operation.
	//
	// Create a new session, using a set of credentials. The provided credentials will be used to
	// validate the
	// identity of the caller. Once the credentials have been verified, a token is issued. The access
	// rights it grants
	// may depend on the profile of the user.
	//
	// PUT /session
	CreateSession(ctx context.Context, request *LoginForm) (CreateSessionRes, error)
	// EmailExists invokes emailExists operation.
	//
	// Returns an empty, successful response if the email is already associated to an user. Otherwise, it
	// fails
	// with a not found (404) error status.
	//
	// GET /credentials/email
	EmailExists(ctx context.Context, params EmailExistsParams) (EmailExistsRes, error)
	// GetPublicKey invokes getPublicKey operation.
	//
	// Get a public key from its usage.
	//
	// GET /public-keys
	GetPublicKey(ctx context.Context, params GetPublicKeyParams) (GetPublicKeyRes, error)
	// ListPublicKeys invokes listPublicKeys operation.
	//
	// Get all public keys from the service that match a given usage.
	//
	// GET /public-keys/list
	ListPublicKeys(ctx context.Context, params ListPublicKeysParams) (ListPublicKeysRes, error)
	// Ping invokes ping operation.
	//
	// Check the status of the service. If the service is running, a successful response is returned.
	//
	// GET /ping
	Ping(ctx context.Context) (PingRes, error)
	// Register invokes register operation.
	//
	// Create a new user. The form must contain a short code, that was sent through a registration link
	// at the user
	// desired email.
	// On success, a valid access token is returned, that can be used to access higher-privilege routes.
	//
	// PUT /credentials
	Register(ctx context.Context, request *RegisterForm) (RegisterRes, error)
	// RequestEmailUpdate invokes requestEmailUpdate operation.
	//
	// Create a new short code for updating the email of an user. This short code is sent to the new
	// address.
	// If the user clicks on it, it should take it to a page that will forward the short code back to
	// this API.
	// Once done, the email associated to the user will be updated automatically.
	// This route requires to be called by an authenticated user. Anonymous sessions cannot trigger an
	// email
	// update request.
	// NOTE that this request does not verify the availability of an email. You may check this beforehand,
	//  using
	// the `Email Exists` endpoint.
	// If multiple email update links are requested for the same email, only the last one will be valid.
	//
	// PUT /short-code/update-email
	RequestEmailUpdate(ctx context.Context, request *RequestEmailUpdateForm) (RequestEmailUpdateRes, error)
	// RequestPasswordReset invokes requestPasswordReset operation.
	//
	// Create a new short code for updating the password of an user. This short code is sent to the new
	// address.
	// If the user clicks on it, it should take it to a page that will forward the short code back to
	// this API.
	// Once done, the password of the user is updated.
	// This route does not require authentication (although it requires at least an anonymous session).
	// This
	// allow users who forgot their password to reset it.
	// If multiple password update links are requested for the same email, only the last one will be
	// valid.
	//
	// PUT /short-code/update-password
	RequestPasswordReset(ctx context.Context, request *RequestPasswordResetForm) (RequestPasswordResetRes, error)
	// RequestRegistration invokes requestRegistration operation.
	//
	// To prevent spam in our user database, registration must be done through a link sent by e-mail, so
	// we can
	// ensure this address is valid.
	// When a user registers, the short code it received must be sent along with the registration payload.
	//  The email
	// of the payload MUST match the email the short code was sent to, and is used to retrieve the short
	// code.
	// NOTE that this request does not verify the availability of an email. You may check this beforehand,
	//  using
	// the `Email Exists` endpoint.
	// If multiple registration links are requested for the same email, only the last one will be valid.
	//
	// PUT /short-code/register
	RequestRegistration(ctx context.Context, request *RequestRegistrationForm) (RequestRegistrationRes, error)
	// ResetPassword invokes resetPassword operation.
	//
	// Reset the password of an user. This route allows an unauthenticated session to update the password
	// of a user.
	// To prevent security issues, this route requires a short code that was sent to the email of the
	// user that
	// requested the password reset.
	//
	// PATCH /credentials/password/reset
	ResetPassword(ctx context.Context, request *ResetPasswordForm) (ResetPasswordRes, error)
	// UpdateEmail invokes updateEmail operation.
	//
	// Update the email of an user. This route requires a valid short code, that was sent to the new
	// email.
	// If the short code is valid, the email of the user is updated with the email address the short code
	// was
	// sent to.
	//
	// PATCH /credentials/email
	UpdateEmail(ctx context.Context, request *UpdateEmailForm) (UpdateEmailRes, error)
	// UpdatePassword invokes updatePassword operation.
	//
	// Update the password of an user. This route requires the original password of the user, to double
	// check
	// the identity of the caller.
	//
	// PATCH /credentials/password
	UpdatePassword(ctx context.Context, request *UpdatePasswordForm) (UpdatePasswordRes, error)
}

Invoker invokes operations described by OpenAPI v3 specification.

type JWK

type JWK struct {
	Kty             KTY     `json:"kty"`
	Use             Use     `json:"use"`
	KeyOps          []KeyOp `json:"key_ops"`
	Alg             Alg     `json:"alg"`
	Kid             OptKID  `json:"kid"`
	AdditionalProps JWKAdditional
}

Ref: #/components/schemas/JWK

func (*JWK) Decode

func (s *JWK) Decode(d *jx.Decoder) error

Decode decodes JWK from json.

func (*JWK) Encode

func (s *JWK) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*JWK) GetAdditionalProps

func (s *JWK) GetAdditionalProps() JWKAdditional

GetAdditionalProps returns the value of AdditionalProps.

func (*JWK) GetAlg

func (s *JWK) GetAlg() Alg

GetAlg returns the value of Alg.

func (*JWK) GetKeyOps

func (s *JWK) GetKeyOps() []KeyOp

GetKeyOps returns the value of KeyOps.

func (*JWK) GetKid

func (s *JWK) GetKid() OptKID

GetKid returns the value of Kid.

func (*JWK) GetKty

func (s *JWK) GetKty() KTY

GetKty returns the value of Kty.

func (*JWK) GetUse

func (s *JWK) GetUse() Use

GetUse returns the value of Use.

func (*JWK) MarshalJSON

func (s *JWK) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*JWK) SetAdditionalProps

func (s *JWK) SetAdditionalProps(val JWKAdditional)

SetAdditionalProps sets the value of AdditionalProps.

func (*JWK) SetAlg

func (s *JWK) SetAlg(val Alg)

SetAlg sets the value of Alg.

func (*JWK) SetKeyOps

func (s *JWK) SetKeyOps(val []KeyOp)

SetKeyOps sets the value of KeyOps.

func (*JWK) SetKid

func (s *JWK) SetKid(val OptKID)

SetKid sets the value of Kid.

func (*JWK) SetKty

func (s *JWK) SetKty(val KTY)

SetKty sets the value of Kty.

func (*JWK) SetUse

func (s *JWK) SetUse(val Use)

SetUse sets the value of Use.

func (*JWK) UnmarshalJSON

func (s *JWK) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*JWK) Validate

func (s *JWK) Validate() error

type JWKAdditional

type JWKAdditional map[string]jx.Raw

func (*JWKAdditional) Decode

func (s *JWKAdditional) Decode(d *jx.Decoder) error

Decode decodes JWKAdditional from json.

func (JWKAdditional) Encode

func (s JWKAdditional) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (JWKAdditional) MarshalJSON

func (s JWKAdditional) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*JWKAdditional) UnmarshalJSON

func (s *JWKAdditional) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type KID

type KID uuid.UUID

func (*KID) Decode

func (s *KID) Decode(d *jx.Decoder) error

Decode decodes KID from json.

func (KID) Encode

func (s KID) Encode(e *jx.Encoder)

Encode encodes KID as json.

func (KID) MarshalJSON

func (s KID) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*KID) UnmarshalJSON

func (s *KID) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type KTY

type KTY string

The type of the key embedded in the JWK. Ref: #/components/schemas/KTY

const (
	KTYOct KTY = "oct"
	KTYRSA KTY = "RSA"
	KTYEC  KTY = "EC"
	KTYOKP KTY = "OKP"
)

func (KTY) AllValues

func (KTY) AllValues() []KTY

AllValues returns all KTY values.

func (*KTY) Decode

func (s *KTY) Decode(d *jx.Decoder) error

Decode decodes KTY from json.

func (KTY) Encode

func (s KTY) Encode(e *jx.Encoder)

Encode encodes KTY as json.

func (KTY) MarshalJSON

func (s KTY) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (KTY) MarshalText

func (s KTY) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*KTY) UnmarshalJSON

func (s *KTY) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*KTY) UnmarshalText

func (s *KTY) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (KTY) Validate

func (s KTY) Validate() error

type KeyOp

type KeyOp string

The operation that can be performed using the key. Ref: #/components/schemas/KeyOp

const (
	KeyOpSign       KeyOp = "sign"
	KeyOpVerify     KeyOp = "verify"
	KeyOpEncrypt    KeyOp = "encrypt"
	KeyOpDecrypt    KeyOp = "decrypt"
	KeyOpWrapKey    KeyOp = "wrapKey"
	KeyOpUnwrapKey  KeyOp = "unwrapKey"
	KeyOpDeriveKey  KeyOp = "deriveKey"
	KeyOpDeriveBits KeyOp = "deriveBits"
)

func (KeyOp) AllValues

func (KeyOp) AllValues() []KeyOp

AllValues returns all KeyOp values.

func (*KeyOp) Decode

func (s *KeyOp) Decode(d *jx.Decoder) error

Decode decodes KeyOp from json.

func (KeyOp) Encode

func (s KeyOp) Encode(e *jx.Encoder)

Encode encodes KeyOp as json.

func (KeyOp) MarshalJSON

func (s KeyOp) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (KeyOp) MarshalText

func (s KeyOp) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*KeyOp) UnmarshalJSON

func (s *KeyOp) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*KeyOp) UnmarshalText

func (s *KeyOp) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (KeyOp) Validate

func (s KeyOp) Validate() error

type KeyUsage

type KeyUsage string

The intended usage of the key. Ref: #/components/schemas/KeyUsage

const (
	KeyUsageAuth    KeyUsage = "auth"
	KeyUsageRefresh KeyUsage = "refresh"
)

func (KeyUsage) AllValues

func (KeyUsage) AllValues() []KeyUsage

AllValues returns all KeyUsage values.

func (KeyUsage) MarshalText

func (s KeyUsage) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*KeyUsage) UnmarshalText

func (s *KeyUsage) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (KeyUsage) Validate

func (s KeyUsage) Validate() error

type Labeler

type Labeler struct {
	// contains filtered or unexported fields
}

Labeler is used to allow adding custom attributes to the server request metrics.

func LabelerFromContext

func LabelerFromContext(ctx context.Context) (*Labeler, bool)

LabelerFromContext retrieves the Labeler from the provided context, if present.

If no Labeler was found in the provided context a new, empty Labeler is returned and the second return value is false. In this case it is safe to use the Labeler but any attributes added to it will not be used.

func (*Labeler) Add

func (l *Labeler) Add(attrs ...attribute.KeyValue)

Add attributes to the Labeler.

func (*Labeler) AttributeSet

func (l *Labeler) AttributeSet() attribute.Set

AttributeSet returns the attributes added to the Labeler as an attribute.Set.

type ListPublicKeysIMATeapot

type ListPublicKeysIMATeapot struct{}

ListPublicKeysIMATeapot is response for ListPublicKeys operation.

type ListPublicKeysOKApplicationJSON

type ListPublicKeysOKApplicationJSON []JWK

func (*ListPublicKeysOKApplicationJSON) Decode

Decode decodes ListPublicKeysOKApplicationJSON from json.

func (ListPublicKeysOKApplicationJSON) Encode

Encode encodes ListPublicKeysOKApplicationJSON as json.

func (ListPublicKeysOKApplicationJSON) MarshalJSON

func (s ListPublicKeysOKApplicationJSON) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*ListPublicKeysOKApplicationJSON) UnmarshalJSON

func (s *ListPublicKeysOKApplicationJSON) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (ListPublicKeysOKApplicationJSON) Validate

type ListPublicKeysParams

type ListPublicKeysParams struct {
	// The intended usage of the keys.
	Usage KeyUsage
}

ListPublicKeysParams is parameters of listPublicKeys operation.

type ListPublicKeysRes

type ListPublicKeysRes interface {
	// contains filtered or unexported methods
}

type LoginForm

type LoginForm struct {
	Email    Email    `json:"email"`
	Password Password `json:"password"`
}

Data used to authenticate a user. It usually includes some private information only known to the user (password, secret question, etc), that is checked against some protected data on the server. If this information is correct, the user is authenticated and granted a special token. Ref: #/components/schemas/LoginForm

func (*LoginForm) Decode

func (s *LoginForm) Decode(d *jx.Decoder) error

Decode decodes LoginForm from json.

func (*LoginForm) Encode

func (s *LoginForm) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*LoginForm) GetEmail

func (s *LoginForm) GetEmail() Email

GetEmail returns the value of Email.

func (*LoginForm) GetPassword

func (s *LoginForm) GetPassword() Password

GetPassword returns the value of Password.

func (*LoginForm) MarshalJSON

func (s *LoginForm) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*LoginForm) SetEmail

func (s *LoginForm) SetEmail(val Email)

SetEmail sets the value of Email.

func (*LoginForm) SetPassword

func (s *LoginForm) SetPassword(val Password)

SetPassword sets the value of Password.

func (*LoginForm) UnmarshalJSON

func (s *LoginForm) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*LoginForm) Validate

func (s *LoginForm) Validate() error

type Middleware

type Middleware = middleware.Middleware

Middleware is middleware type.

type NotFoundError

type NotFoundError struct {
	// The error message.
	Error string `json:"error"`
}

Ref: #/components/schemas/NotFoundError

func (*NotFoundError) Decode

func (s *NotFoundError) Decode(d *jx.Decoder) error

Decode decodes NotFoundError from json.

func (*NotFoundError) Encode

func (s *NotFoundError) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*NotFoundError) GetError

func (s *NotFoundError) GetError() string

GetError returns the value of Error.

func (*NotFoundError) MarshalJSON

func (s *NotFoundError) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*NotFoundError) SetError

func (s *NotFoundError) SetError(val string)

SetError sets the value of Error.

func (*NotFoundError) UnmarshalJSON

func (s *NotFoundError) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type OperationName

type OperationName = string

OperationName is the ogen operation name

const (
	CheckSessionOperation         OperationName = "CheckSession"
	CreateAnonSessionOperation    OperationName = "CreateAnonSession"
	CreateSessionOperation        OperationName = "CreateSession"
	EmailExistsOperation          OperationName = "EmailExists"
	GetPublicKeyOperation         OperationName = "GetPublicKey"
	ListPublicKeysOperation       OperationName = "ListPublicKeys"
	PingOperation                 OperationName = "Ping"
	RegisterOperation             OperationName = "Register"
	RequestEmailUpdateOperation   OperationName = "RequestEmailUpdate"
	RequestPasswordResetOperation OperationName = "RequestPasswordReset"
	RequestRegistrationOperation  OperationName = "RequestRegistration"
	ResetPasswordOperation        OperationName = "ResetPassword"
	UpdateEmailOperation          OperationName = "UpdateEmail"
	UpdatePasswordOperation       OperationName = "UpdatePassword"
)

type OptKID

type OptKID struct {
	Value KID
	Set   bool
}

OptKID is optional KID.

func NewOptKID

func NewOptKID(v KID) OptKID

NewOptKID returns new OptKID with value set to v.

func (*OptKID) Decode

func (o *OptKID) Decode(d *jx.Decoder) error

Decode decodes KID from json.

func (OptKID) Encode

func (o OptKID) Encode(e *jx.Encoder)

Encode encodes KID as json.

func (OptKID) Get

func (o OptKID) Get() (v KID, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptKID) IsSet

func (o OptKID) IsSet() bool

IsSet returns true if OptKID was set.

func (OptKID) MarshalJSON

func (s OptKID) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptKID) Or

func (o OptKID) Or(d KID) KID

Or returns value if set, or given parameter if does not.

func (*OptKID) Reset

func (o *OptKID) Reset()

Reset unsets value.

func (*OptKID) SetTo

func (o *OptKID) SetTo(v KID)

SetTo sets value to v.

func (*OptKID) UnmarshalJSON

func (s *OptKID) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type OptNilUUID

type OptNilUUID struct {
	Value uuid.UUID
	Set   bool
	Null  bool
}

OptNilUUID is optional nullable uuid.UUID.

func NewOptNilUUID

func NewOptNilUUID(v uuid.UUID) OptNilUUID

NewOptNilUUID returns new OptNilUUID with value set to v.

func (*OptNilUUID) Decode

func (o *OptNilUUID) Decode(d *jx.Decoder) error

Decode decodes uuid.UUID from json.

func (OptNilUUID) Encode

func (o OptNilUUID) Encode(e *jx.Encoder)

Encode encodes uuid.UUID as json.

func (OptNilUUID) Get

func (o OptNilUUID) Get() (v uuid.UUID, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptNilUUID) IsNull

func (o OptNilUUID) IsNull() bool

IsSet returns true if value is Null.

func (OptNilUUID) IsSet

func (o OptNilUUID) IsSet() bool

IsSet returns true if OptNilUUID was set.

func (OptNilUUID) MarshalJSON

func (s OptNilUUID) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptNilUUID) Or

func (o OptNilUUID) Or(d uuid.UUID) uuid.UUID

Or returns value if set, or given parameter if does not.

func (*OptNilUUID) Reset

func (o *OptNilUUID) Reset()

Reset unsets value.

func (*OptNilUUID) SetTo

func (o *OptNilUUID) SetTo(v uuid.UUID)

SetTo sets value to v.

func (*OptNilUUID) SetToNull

func (o *OptNilUUID) SetToNull()

SetNull sets value to null.

func (*OptNilUUID) UnmarshalJSON

func (s *OptNilUUID) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type OptUserID

type OptUserID struct {
	Value UserID
	Set   bool
}

OptUserID is optional UserID.

func NewOptUserID

func NewOptUserID(v UserID) OptUserID

NewOptUserID returns new OptUserID with value set to v.

func (*OptUserID) Decode

func (o *OptUserID) Decode(d *jx.Decoder) error

Decode decodes UserID from json.

func (OptUserID) Encode

func (o OptUserID) Encode(e *jx.Encoder)

Encode encodes UserID as json.

func (OptUserID) Get

func (o OptUserID) Get() (v UserID, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptUserID) IsSet

func (o OptUserID) IsSet() bool

IsSet returns true if OptUserID was set.

func (OptUserID) MarshalJSON

func (s OptUserID) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptUserID) Or

func (o OptUserID) Or(d UserID) UserID

Or returns value if set, or given parameter if does not.

func (*OptUserID) Reset

func (o *OptUserID) Reset()

Reset unsets value.

func (*OptUserID) SetTo

func (o *OptUserID) SetTo(v UserID)

SetTo sets value to v.

func (*OptUserID) UnmarshalJSON

func (s *OptUserID) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type Option

type Option interface {
	ServerOption
	ClientOption
}

Option is config option.

func WithMeterProvider

func WithMeterProvider(provider metric.MeterProvider) Option

WithMeterProvider specifies a meter provider to use for creating a meter.

If none is specified, the otel.GetMeterProvider() is used.

func WithTracerProvider

func WithTracerProvider(provider trace.TracerProvider) Option

WithTracerProvider specifies a tracer provider to use for creating a tracer.

If none is specified, the global provider is used.

type Password

type Password string

func (*Password) Decode

func (s *Password) Decode(d *jx.Decoder) error

Decode decodes Password from json.

func (Password) Encode

func (s Password) Encode(e *jx.Encoder)

Encode encodes Password as json.

func (Password) MarshalJSON

func (s Password) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*Password) UnmarshalJSON

func (s *Password) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (Password) Validate

func (s Password) Validate() error

type PingIMATeapot

type PingIMATeapot struct{}

PingIMATeapot is response for Ping operation.

type PingOK

type PingOK struct {
	Data io.Reader
}

func (PingOK) Read

func (s PingOK) Read(p []byte) (n int, err error)

Read reads data from the Data reader.

Kept to satisfy the io.Reader interface.

type PingRes

type PingRes interface {
	// contains filtered or unexported methods
}

type RegisterForm

type RegisterForm struct {
	// The email of the new user. This email must be available, and also match the one that received
	// the short code / registration link.
	Email     Email     `json:"email"`
	Password  Password  `json:"password"`
	ShortCode ShortCode `json:"shortCode"`
}

Data used to create a user. Ref: #/components/schemas/RegisterForm

func (*RegisterForm) Decode

func (s *RegisterForm) Decode(d *jx.Decoder) error

Decode decodes RegisterForm from json.

func (*RegisterForm) Encode

func (s *RegisterForm) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*RegisterForm) GetEmail

func (s *RegisterForm) GetEmail() Email

GetEmail returns the value of Email.

func (*RegisterForm) GetPassword

func (s *RegisterForm) GetPassword() Password

GetPassword returns the value of Password.

func (*RegisterForm) GetShortCode

func (s *RegisterForm) GetShortCode() ShortCode

GetShortCode returns the value of ShortCode.

func (*RegisterForm) MarshalJSON

func (s *RegisterForm) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*RegisterForm) SetEmail

func (s *RegisterForm) SetEmail(val Email)

SetEmail sets the value of Email.

func (*RegisterForm) SetPassword

func (s *RegisterForm) SetPassword(val Password)

SetPassword sets the value of Password.

func (*RegisterForm) SetShortCode

func (s *RegisterForm) SetShortCode(val ShortCode)

SetShortCode sets the value of ShortCode.

func (*RegisterForm) UnmarshalJSON

func (s *RegisterForm) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*RegisterForm) Validate

func (s *RegisterForm) Validate() error

type RegisterRes

type RegisterRes interface {
	// contains filtered or unexported methods
}

type RequestEmailUpdateForm

type RequestEmailUpdateForm struct {
	// The bew email of the new user. This email must be available at the time of validation.
	Email Email `json:"email"`
}

Create a new email update link. Ref: #/components/schemas/RequestEmailUpdateForm

func (*RequestEmailUpdateForm) Decode

func (s *RequestEmailUpdateForm) Decode(d *jx.Decoder) error

Decode decodes RequestEmailUpdateForm from json.

func (*RequestEmailUpdateForm) Encode

func (s *RequestEmailUpdateForm) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*RequestEmailUpdateForm) GetEmail

func (s *RequestEmailUpdateForm) GetEmail() Email

GetEmail returns the value of Email.

func (*RequestEmailUpdateForm) MarshalJSON

func (s *RequestEmailUpdateForm) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*RequestEmailUpdateForm) SetEmail

func (s *RequestEmailUpdateForm) SetEmail(val Email)

SetEmail sets the value of Email.

func (*RequestEmailUpdateForm) UnmarshalJSON

func (s *RequestEmailUpdateForm) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*RequestEmailUpdateForm) Validate

func (s *RequestEmailUpdateForm) Validate() error

type RequestEmailUpdateIMATeapot

type RequestEmailUpdateIMATeapot struct{}

RequestEmailUpdateIMATeapot is response for RequestEmailUpdate operation.

type RequestEmailUpdateNoContent

type RequestEmailUpdateNoContent struct{}

RequestEmailUpdateNoContent is response for RequestEmailUpdate operation.

type RequestEmailUpdateRes

type RequestEmailUpdateRes interface {
	// contains filtered or unexported methods
}

type RequestPasswordResetForm

type RequestPasswordResetForm struct {
	// The email of the user. This email must match a user in the database.
	Email Email `json:"email"`
}

Create a new password update link. Ref: #/components/schemas/RequestPasswordResetForm

func (*RequestPasswordResetForm) Decode

func (s *RequestPasswordResetForm) Decode(d *jx.Decoder) error

Decode decodes RequestPasswordResetForm from json.

func (*RequestPasswordResetForm) Encode

func (s *RequestPasswordResetForm) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*RequestPasswordResetForm) GetEmail

func (s *RequestPasswordResetForm) GetEmail() Email

GetEmail returns the value of Email.

func (*RequestPasswordResetForm) MarshalJSON

func (s *RequestPasswordResetForm) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*RequestPasswordResetForm) SetEmail

func (s *RequestPasswordResetForm) SetEmail(val Email)

SetEmail sets the value of Email.

func (*RequestPasswordResetForm) UnmarshalJSON

func (s *RequestPasswordResetForm) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*RequestPasswordResetForm) Validate

func (s *RequestPasswordResetForm) Validate() error

type RequestPasswordResetNoContent

type RequestPasswordResetNoContent struct{}

RequestPasswordResetNoContent is response for RequestPasswordReset operation.

type RequestPasswordResetRes

type RequestPasswordResetRes interface {
	// contains filtered or unexported methods
}

type RequestRegistrationForm

type RequestRegistrationForm struct {
	// The email of the new user. This email must be available at the time of registration.
	Email Email `json:"email"`
}

Create a new registration link. Ref: #/components/schemas/RequestRegistrationForm

func (*RequestRegistrationForm) Decode

func (s *RequestRegistrationForm) Decode(d *jx.Decoder) error

Decode decodes RequestRegistrationForm from json.

func (*RequestRegistrationForm) Encode

func (s *RequestRegistrationForm) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*RequestRegistrationForm) GetEmail

func (s *RequestRegistrationForm) GetEmail() Email

GetEmail returns the value of Email.

func (*RequestRegistrationForm) MarshalJSON

func (s *RequestRegistrationForm) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*RequestRegistrationForm) SetEmail

func (s *RequestRegistrationForm) SetEmail(val Email)

SetEmail sets the value of Email.

func (*RequestRegistrationForm) UnmarshalJSON

func (s *RequestRegistrationForm) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*RequestRegistrationForm) Validate

func (s *RequestRegistrationForm) Validate() error

type RequestRegistrationIMATeapot

type RequestRegistrationIMATeapot struct{}

RequestRegistrationIMATeapot is response for RequestRegistration operation.

type RequestRegistrationNoContent

type RequestRegistrationNoContent struct{}

RequestRegistrationNoContent is response for RequestRegistration operation.

type RequestRegistrationRes

type RequestRegistrationRes interface {
	// contains filtered or unexported methods
}

type ResetPasswordForm

type ResetPasswordForm struct {
	// The ID of the user that requested a password reset is sent in the reset link of the reset password
	// email.
	UserID UserID `json:"userID"`
	// The new password of the user.
	Password  Password  `json:"password"`
	ShortCode ShortCode `json:"shortCode"`
}

Data used to reset the password of a user. Ref: #/components/schemas/ResetPasswordForm

func (*ResetPasswordForm) Decode

func (s *ResetPasswordForm) Decode(d *jx.Decoder) error

Decode decodes ResetPasswordForm from json.

func (*ResetPasswordForm) Encode

func (s *ResetPasswordForm) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*ResetPasswordForm) GetPassword

func (s *ResetPasswordForm) GetPassword() Password

GetPassword returns the value of Password.

func (*ResetPasswordForm) GetShortCode

func (s *ResetPasswordForm) GetShortCode() ShortCode

GetShortCode returns the value of ShortCode.

func (*ResetPasswordForm) GetUserID

func (s *ResetPasswordForm) GetUserID() UserID

GetUserID returns the value of UserID.

func (*ResetPasswordForm) MarshalJSON

func (s *ResetPasswordForm) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*ResetPasswordForm) SetPassword

func (s *ResetPasswordForm) SetPassword(val Password)

SetPassword sets the value of Password.

func (*ResetPasswordForm) SetShortCode

func (s *ResetPasswordForm) SetShortCode(val ShortCode)

SetShortCode sets the value of ShortCode.

func (*ResetPasswordForm) SetUserID

func (s *ResetPasswordForm) SetUserID(val UserID)

SetUserID sets the value of UserID.

func (*ResetPasswordForm) UnmarshalJSON

func (s *ResetPasswordForm) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*ResetPasswordForm) Validate

func (s *ResetPasswordForm) Validate() error

type ResetPasswordNoContent

type ResetPasswordNoContent struct{}

ResetPasswordNoContent is response for ResetPassword operation.

type ResetPasswordRes

type ResetPasswordRes interface {
	// contains filtered or unexported methods
}

type Role

type Role string

func (*Role) Decode

func (s *Role) Decode(d *jx.Decoder) error

Decode decodes Role from json.

func (Role) Encode

func (s Role) Encode(e *jx.Encoder)

Encode encodes Role as json.

func (Role) MarshalJSON

func (s Role) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*Role) UnmarshalJSON

func (s *Role) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type Route

type Route struct {
	// contains filtered or unexported fields
}

Route is route object.

func (Route) Args

func (r Route) Args() []string

Args returns parsed arguments.

func (Route) Name

func (r Route) Name() string

Name returns ogen operation name.

It is guaranteed to be unique and not empty.

func (Route) OperationID

func (r Route) OperationID() string

OperationID returns OpenAPI operationId.

func (Route) PathPattern

func (r Route) PathPattern() string

PathPattern returns OpenAPI path.

func (Route) Summary

func (r Route) Summary() string

Summary returns OpenAPI summary.

type SecurityHandler

type SecurityHandler interface {
	// HandleBearerAuth handles bearerAuth security.
	HandleBearerAuth(ctx context.Context, operationName OperationName, t BearerAuth) (context.Context, error)
}

SecurityHandler is handler for security parameters.

type SecuritySource

type SecuritySource interface {
	// BearerAuth provides bearerAuth security value.
	BearerAuth(ctx context.Context, operationName OperationName) (BearerAuth, error)
}

SecuritySource is provider of security values (tokens, passwords, etc.).

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server implements http server based on OpenAPI v3 specification and calls Handler to handle requests.

func NewServer

func NewServer(h Handler, sec SecurityHandler, opts ...ServerOption) (*Server, error)

NewServer creates new Server.

func (*Server) FindPath

func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool)

FindPath finds Route for given method and URL.

func (*Server) FindRoute

func (s *Server) FindRoute(method, path string) (Route, bool)

FindRoute finds Route for given method and path.

Note: this method does not unescape path or handle reserved characters in path properly. Use FindPath instead.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves http request as defined by OpenAPI v3 specification, calling handler that matches the path or returning not found error.

type ServerOption

type ServerOption interface {
	// contains filtered or unexported methods
}

ServerOption is server config option.

func WithErrorHandler

func WithErrorHandler(h ErrorHandler) ServerOption

WithErrorHandler specifies error handler to use.

func WithMaxMultipartMemory

func WithMaxMultipartMemory(max int64) ServerOption

WithMaxMultipartMemory specifies limit of memory for storing file parts. File parts which can't be stored in memory will be stored on disk in temporary files.

func WithMethodNotAllowed

func WithMethodNotAllowed(methodNotAllowed func(w http.ResponseWriter, r *http.Request, allowed string)) ServerOption

WithMethodNotAllowed specifies Method Not Allowed handler to use.

func WithMiddleware

func WithMiddleware(m ...Middleware) ServerOption

WithMiddleware specifies middlewares to use.

func WithNotFound

func WithNotFound(notFound http.HandlerFunc) ServerOption

WithNotFound specifies Not Found handler to use.

func WithPathPrefix

func WithPathPrefix(prefix string) ServerOption

WithPathPrefix specifies server path prefix.

type ShortCode

type ShortCode string

func (*ShortCode) Decode

func (s *ShortCode) Decode(d *jx.Decoder) error

Decode decodes ShortCode from json.

func (ShortCode) Encode

func (s ShortCode) Encode(e *jx.Encoder)

Encode encodes ShortCode as json.

func (ShortCode) MarshalJSON

func (s ShortCode) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*ShortCode) UnmarshalJSON

func (s *ShortCode) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (ShortCode) Validate

func (s ShortCode) Validate() error

type Token

type Token struct {
	// The token used to authenticate the session. This token can be passed as a header to http requests
	// on
	// protected routes.
	AccessToken string `json:"accessToken"`
}

Ref: #/components/schemas/Token

func (*Token) Decode

func (s *Token) Decode(d *jx.Decoder) error

Decode decodes Token from json.

func (*Token) Encode

func (s *Token) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*Token) GetAccessToken

func (s *Token) GetAccessToken() string

GetAccessToken returns the value of AccessToken.

func (*Token) MarshalJSON

func (s *Token) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*Token) SetAccessToken

func (s *Token) SetAccessToken(val string)

SetAccessToken sets the value of AccessToken.

func (*Token) UnmarshalJSON

func (s *Token) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type UnexpectedError

type UnexpectedError struct {
	// The error message.
	Error string `json:"error"`
}

Ref: #/components/schemas/UnexpectedError

func (*UnexpectedError) Decode

func (s *UnexpectedError) Decode(d *jx.Decoder) error

Decode decodes UnexpectedError from json.

func (*UnexpectedError) Encode

func (s *UnexpectedError) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*UnexpectedError) GetError

func (s *UnexpectedError) GetError() string

GetError returns the value of Error.

func (*UnexpectedError) MarshalJSON

func (s *UnexpectedError) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*UnexpectedError) SetError

func (s *UnexpectedError) SetError(val string)

SetError sets the value of Error.

func (*UnexpectedError) UnmarshalJSON

func (s *UnexpectedError) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type UnexpectedErrorStatusCode

type UnexpectedErrorStatusCode struct {
	StatusCode int
	Response   UnexpectedError
}

UnexpectedErrorStatusCode wraps UnexpectedError with StatusCode.

func (*UnexpectedErrorStatusCode) Error

func (s *UnexpectedErrorStatusCode) Error() string

func (*UnexpectedErrorStatusCode) GetResponse

func (s *UnexpectedErrorStatusCode) GetResponse() UnexpectedError

GetResponse returns the value of Response.

func (*UnexpectedErrorStatusCode) GetStatusCode

func (s *UnexpectedErrorStatusCode) GetStatusCode() int

GetStatusCode returns the value of StatusCode.

func (*UnexpectedErrorStatusCode) SetResponse

func (s *UnexpectedErrorStatusCode) SetResponse(val UnexpectedError)

SetResponse sets the value of Response.

func (*UnexpectedErrorStatusCode) SetStatusCode

func (s *UnexpectedErrorStatusCode) SetStatusCode(val int)

SetStatusCode sets the value of StatusCode.

type UnimplementedHandler

type UnimplementedHandler struct{}

UnimplementedHandler is no-op Handler which returns http.ErrNotImplemented.

func (UnimplementedHandler) CheckSession

func (UnimplementedHandler) CheckSession(ctx context.Context) (r CheckSessionRes, _ error)

CheckSession implements checkSession operation.

Takes an empty request with authorization headers, and check the validity of those headers. If the headers can be used to access any protected resource, the session is considered valid and the decoded claims are returned as a success response. Otherwise, an error will be sent, explaining why the session is invalid.

GET /session

func (UnimplementedHandler) CreateAnonSession

func (UnimplementedHandler) CreateAnonSession(ctx context.Context) (r CreateAnonSessionRes, _ error)

CreateAnonSession implements createAnonSession operation.

Create a new anonymous session. An anonymous session is delivered without constraint, and grants basic access to apis with low protection.

PUT /session/anon

func (UnimplementedHandler) CreateSession

func (UnimplementedHandler) CreateSession(ctx context.Context, req *LoginForm) (r CreateSessionRes, _ error)

CreateSession implements createSession operation.

Create a new session, using a set of credentials. The provided credentials will be used to validate the identity of the caller. Once the credentials have been verified, a token is issued. The access rights it grants may depend on the profile of the user.

PUT /session

func (UnimplementedHandler) EmailExists

EmailExists implements emailExists operation.

Returns an empty, successful response if the email is already associated to an user. Otherwise, it fails with a not found (404) error status.

GET /credentials/email

func (UnimplementedHandler) GetPublicKey

GetPublicKey implements getPublicKey operation.

Get a public key from its usage.

GET /public-keys

func (UnimplementedHandler) ListPublicKeys

ListPublicKeys implements listPublicKeys operation.

Get all public keys from the service that match a given usage.

GET /public-keys/list

func (UnimplementedHandler) NewError

NewError creates *UnexpectedErrorStatusCode from error returned by handler.

Used for common default response.

func (UnimplementedHandler) Ping

Ping implements ping operation.

Check the status of the service. If the service is running, a successful response is returned.

GET /ping

func (UnimplementedHandler) Register

Register implements register operation.

Create a new user. The form must contain a short code, that was sent through a registration link at the user desired email. On success, a valid access token is returned, that can be used to access higher-privilege routes.

PUT /credentials

func (UnimplementedHandler) RequestEmailUpdate

RequestEmailUpdate implements requestEmailUpdate operation.

Create a new short code for updating the email of an user. This short code is sent to the new address. If the user clicks on it, it should take it to a page that will forward the short code back to this API. Once done, the email associated to the user will be updated automatically. This route requires to be called by an authenticated user. Anonymous sessions cannot trigger an email update request. NOTE that this request does not verify the availability of an email. You may check this beforehand,

using

the `Email Exists` endpoint. If multiple email update links are requested for the same email, only the last one will be valid.

PUT /short-code/update-email

func (UnimplementedHandler) RequestPasswordReset

RequestPasswordReset implements requestPasswordReset operation.

Create a new short code for updating the password of an user. This short code is sent to the new address. If the user clicks on it, it should take it to a page that will forward the short code back to this API. Once done, the password of the user is updated. This route does not require authentication (although it requires at least an anonymous session). This allow users who forgot their password to reset it. If multiple password update links are requested for the same email, only the last one will be valid.

PUT /short-code/update-password

func (UnimplementedHandler) RequestRegistration

RequestRegistration implements requestRegistration operation.

To prevent spam in our user database, registration must be done through a link sent by e-mail, so we can ensure this address is valid. When a user registers, the short code it received must be sent along with the registration payload.

The email

of the payload MUST match the email the short code was sent to, and is used to retrieve the short code. NOTE that this request does not verify the availability of an email. You may check this beforehand,

using

the `Email Exists` endpoint. If multiple registration links are requested for the same email, only the last one will be valid.

PUT /short-code/register

func (UnimplementedHandler) ResetPassword

ResetPassword implements resetPassword operation.

Reset the password of an user. This route allows an unauthenticated session to update the password of a user. To prevent security issues, this route requires a short code that was sent to the email of the user that requested the password reset.

PATCH /credentials/password/reset

func (UnimplementedHandler) UpdateEmail

UpdateEmail implements updateEmail operation.

Update the email of an user. This route requires a valid short code, that was sent to the new email. If the short code is valid, the email of the user is updated with the email address the short code was sent to.

PATCH /credentials/email

func (UnimplementedHandler) UpdatePassword

UpdatePassword implements updatePassword operation.

Update the password of an user. This route requires the original password of the user, to double check the identity of the caller.

PATCH /credentials/password

type UpdateEmailForm

type UpdateEmailForm struct {
	// The id of the user that requested the email update. This ID is usually sent along the short code
	// in the email update link.
	UserID    OptUserID `json:"userID"`
	ShortCode ShortCode `json:"shortCode"`
}

Data used to update the email of a user. Ref: #/components/schemas/UpdateEmailForm

func (*UpdateEmailForm) Decode

func (s *UpdateEmailForm) Decode(d *jx.Decoder) error

Decode decodes UpdateEmailForm from json.

func (*UpdateEmailForm) Encode

func (s *UpdateEmailForm) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*UpdateEmailForm) GetShortCode

func (s *UpdateEmailForm) GetShortCode() ShortCode

GetShortCode returns the value of ShortCode.

func (*UpdateEmailForm) GetUserID

func (s *UpdateEmailForm) GetUserID() OptUserID

GetUserID returns the value of UserID.

func (*UpdateEmailForm) MarshalJSON

func (s *UpdateEmailForm) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*UpdateEmailForm) SetShortCode

func (s *UpdateEmailForm) SetShortCode(val ShortCode)

SetShortCode sets the value of ShortCode.

func (*UpdateEmailForm) SetUserID

func (s *UpdateEmailForm) SetUserID(val OptUserID)

SetUserID sets the value of UserID.

func (*UpdateEmailForm) UnmarshalJSON

func (s *UpdateEmailForm) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*UpdateEmailForm) Validate

func (s *UpdateEmailForm) Validate() error

type UpdateEmailOK

type UpdateEmailOK struct {
	// The new email of the user.
	Email Email `json:"email"`
}

func (*UpdateEmailOK) Decode

func (s *UpdateEmailOK) Decode(d *jx.Decoder) error

Decode decodes UpdateEmailOK from json.

func (*UpdateEmailOK) Encode

func (s *UpdateEmailOK) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*UpdateEmailOK) GetEmail

func (s *UpdateEmailOK) GetEmail() Email

GetEmail returns the value of Email.

func (*UpdateEmailOK) MarshalJSON

func (s *UpdateEmailOK) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*UpdateEmailOK) SetEmail

func (s *UpdateEmailOK) SetEmail(val Email)

SetEmail sets the value of Email.

func (*UpdateEmailOK) UnmarshalJSON

func (s *UpdateEmailOK) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*UpdateEmailOK) Validate

func (s *UpdateEmailOK) Validate() error

type UpdateEmailRes

type UpdateEmailRes interface {
	// contains filtered or unexported methods
}

type UpdatePasswordForm

type UpdatePasswordForm struct {
	Email Email `json:"email"`
	// The new password of the user.
	Password Password `json:"password"`
	// The current password of the user, used for further verification of the caller identity.
	CurrentPassword Password `json:"currentPassword"`
}

Data used to update the password of a user. Ref: #/components/schemas/UpdatePasswordForm

func (*UpdatePasswordForm) Decode

func (s *UpdatePasswordForm) Decode(d *jx.Decoder) error

Decode decodes UpdatePasswordForm from json.

func (*UpdatePasswordForm) Encode

func (s *UpdatePasswordForm) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*UpdatePasswordForm) GetCurrentPassword

func (s *UpdatePasswordForm) GetCurrentPassword() Password

GetCurrentPassword returns the value of CurrentPassword.

func (*UpdatePasswordForm) GetEmail

func (s *UpdatePasswordForm) GetEmail() Email

GetEmail returns the value of Email.

func (*UpdatePasswordForm) GetPassword

func (s *UpdatePasswordForm) GetPassword() Password

GetPassword returns the value of Password.

func (*UpdatePasswordForm) MarshalJSON

func (s *UpdatePasswordForm) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*UpdatePasswordForm) SetCurrentPassword

func (s *UpdatePasswordForm) SetCurrentPassword(val Password)

SetCurrentPassword sets the value of CurrentPassword.

func (*UpdatePasswordForm) SetEmail

func (s *UpdatePasswordForm) SetEmail(val Email)

SetEmail sets the value of Email.

func (*UpdatePasswordForm) SetPassword

func (s *UpdatePasswordForm) SetPassword(val Password)

SetPassword sets the value of Password.

func (*UpdatePasswordForm) UnmarshalJSON

func (s *UpdatePasswordForm) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*UpdatePasswordForm) Validate

func (s *UpdatePasswordForm) Validate() error

type UpdatePasswordNoContent

type UpdatePasswordNoContent struct{}

UpdatePasswordNoContent is response for UpdatePassword operation.

type UpdatePasswordRes

type UpdatePasswordRes interface {
	// contains filtered or unexported methods
}

type Use

type Use string

The intended use of the public key. Ref: #/components/schemas/Use

const (
	UseSig Use = "sig"
	UseEnc Use = "enc"
)

func (Use) AllValues

func (Use) AllValues() []Use

AllValues returns all Use values.

func (*Use) Decode

func (s *Use) Decode(d *jx.Decoder) error

Decode decodes Use from json.

func (Use) Encode

func (s Use) Encode(e *jx.Encoder)

Encode encodes Use as json.

func (Use) MarshalJSON

func (s Use) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (Use) MarshalText

func (s Use) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*Use) UnmarshalJSON

func (s *Use) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*Use) UnmarshalText

func (s *Use) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (Use) Validate

func (s Use) Validate() error

type UserID

type UserID uuid.UUID

func (*UserID) Decode

func (s *UserID) Decode(d *jx.Decoder) error

Decode decodes UserID from json.

func (UserID) Encode

func (s UserID) Encode(e *jx.Encoder)

Encode encodes UserID as json.

func (UserID) MarshalJSON

func (s UserID) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*UserID) UnmarshalJSON

func (s *UserID) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

Jump to

Keyboard shortcuts

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