user

package
v0.0.0-...-554ca4b Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

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

Code generated by github.com/deepmap/oapi-codegen version v1.16.3 DO NOT EDIT.

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

Code generated by github.com/deepmap/oapi-codegen version v1.16.3 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGetUserRequest

func NewGetUserRequest(server string, userId string) (*http.Request, error)

NewGetUserRequest generates requests for GetUser

func NewLoginUserRequest

func NewLoginUserRequest(server string, body LoginUserJSONRequestBody) (*http.Request, error)

NewLoginUserRequest calls the generic LoginUser builder with application/json body

func NewLoginUserRequestWithBody

func NewLoginUserRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)

NewLoginUserRequestWithBody generates requests for LoginUser with any type of body

func NewRegisterUserRequest

func NewRegisterUserRequest(server string, body RegisterUserJSONRequestBody) (*http.Request, error)

NewRegisterUserRequest calls the generic RegisterUser builder with application/json body

func NewRegisterUserRequestWithBody

func NewRegisterUserRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)

NewRegisterUserRequestWithBody generates requests for RegisterUser with any type of body

func NewUpdateUserRequest

func NewUpdateUserRequest(server string, userId string, body UpdateUserJSONRequestBody) (*http.Request, error)

NewUpdateUserRequest calls the generic UpdateUser builder with application/json body

func NewUpdateUserRequestWithBody

func NewUpdateUserRequestWithBody(server string, userId string, contentType string, body io.Reader) (*http.Request, error)

NewUpdateUserRequestWithBody generates requests for UpdateUser with any type of body

Types

type Client

type Client struct {
	// The endpoint of the server conforming to this interface, with scheme,
	// https://api.deepmap.com for example. This can contain a path relative
	// to the server, such as https://api.deepmap.com/dev-test, and all the
	// paths in the swagger spec will be appended to the server.
	Server string

	// Doer for performing requests, typically a *http.Client with any
	// customized settings, such as certificate chains.
	Client HttpRequestDoer

	// A list of callbacks for modifying requests which are generated before sending over
	// the network.
	RequestEditors []RequestEditorFn
}

Client which conforms to the OpenAPI3 specification for this service.

func NewClient

func NewClient(server string, opts ...ClientOption) (*Client, error)

Creates a new Client, with reasonable defaults

func (*Client) GetUser

func (c *Client) GetUser(ctx context.Context, userId string, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) LoginUser

func (c *Client) LoginUser(ctx context.Context, body LoginUserJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) LoginUserWithBody

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

func (*Client) RegisterUser

func (c *Client) RegisterUser(ctx context.Context, body RegisterUserJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) RegisterUserWithBody

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

func (*Client) UpdateUser

func (c *Client) UpdateUser(ctx context.Context, userId string, body UpdateUserJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) UpdateUserWithBody

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

type ClientInterface

type ClientInterface interface {
	// LoginUserWithBody request with any body
	LoginUserWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	LoginUser(ctx context.Context, body LoginUserJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

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

	RegisterUser(ctx context.Context, body RegisterUserJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetUser request
	GetUser(ctx context.Context, userId string, reqEditors ...RequestEditorFn) (*http.Response, error)

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

	UpdateUser(ctx context.Context, userId string, body UpdateUserJSONRequestBody, 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) GetUserWithResponse

func (c *ClientWithResponses) GetUserWithResponse(ctx context.Context, userId string, reqEditors ...RequestEditorFn) (*GetUserResponse, error)

GetUserWithResponse request returning *GetUserResponse

func (*ClientWithResponses) LoginUserWithBodyWithResponse

func (c *ClientWithResponses) LoginUserWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*LoginUserResponse, error)

LoginUserWithBodyWithResponse request with arbitrary body returning *LoginUserResponse

func (*ClientWithResponses) LoginUserWithResponse

func (c *ClientWithResponses) LoginUserWithResponse(ctx context.Context, body LoginUserJSONRequestBody, reqEditors ...RequestEditorFn) (*LoginUserResponse, error)

func (*ClientWithResponses) RegisterUserWithBodyWithResponse

func (c *ClientWithResponses) RegisterUserWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*RegisterUserResponse, error)

RegisterUserWithBodyWithResponse request with arbitrary body returning *RegisterUserResponse

func (*ClientWithResponses) RegisterUserWithResponse

func (c *ClientWithResponses) RegisterUserWithResponse(ctx context.Context, body RegisterUserJSONRequestBody, reqEditors ...RequestEditorFn) (*RegisterUserResponse, error)

func (*ClientWithResponses) UpdateUserWithBodyWithResponse

func (c *ClientWithResponses) UpdateUserWithBodyWithResponse(ctx context.Context, userId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateUserResponse, error)

UpdateUserWithBodyWithResponse request with arbitrary body returning *UpdateUserResponse

func (*ClientWithResponses) UpdateUserWithResponse

func (c *ClientWithResponses) UpdateUserWithResponse(ctx context.Context, userId string, body UpdateUserJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateUserResponse, error)

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// LoginUserWithBodyWithResponse request with any body
	LoginUserWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*LoginUserResponse, error)

	LoginUserWithResponse(ctx context.Context, body LoginUserJSONRequestBody, reqEditors ...RequestEditorFn) (*LoginUserResponse, error)

	// RegisterUserWithBodyWithResponse request with any body
	RegisterUserWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*RegisterUserResponse, error)

	RegisterUserWithResponse(ctx context.Context, body RegisterUserJSONRequestBody, reqEditors ...RequestEditorFn) (*RegisterUserResponse, error)

	// GetUserWithResponse request
	GetUserWithResponse(ctx context.Context, userId string, reqEditors ...RequestEditorFn) (*GetUserResponse, error)

	// UpdateUserWithBodyWithResponse request with any body
	UpdateUserWithBodyWithResponse(ctx context.Context, userId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateUserResponse, error)

	UpdateUserWithResponse(ctx context.Context, userId string, body UpdateUserJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateUserResponse, error)
}

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

type Error

type Error struct {
	// Code Error code
	Code *string `json:"code,omitempty"`

	// Message Error message
	Message *string `json:"message,omitempty"`
}

Error defines model for Error.

type GetUserResponse

type GetUserResponse struct {
	User *User `json:"user,omitempty"`
}

GetUserResponse defines model for GetUserResponse.

func ParseGetUserResponse

func ParseGetUserResponse(rsp *http.Response) (*GetUserResponse, error)

ParseGetUserResponse parses an HTTP response from a GetUserWithResponse call

func (GetUserResponse) Status

func (r GetUserResponse) Status() string

Status returns HTTPResponse.Status

func (GetUserResponse) StatusCode

func (r GetUserResponse) 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 LoginRequest

type LoginRequest struct {
	// Email User email address
	Email openapi_types.Email `json:"email"`

	// Password User password
	Password string `json:"password"`
}

LoginRequest defines model for LoginRequest.

type LoginResponse

type LoginResponse struct {
	// Token JWT authentication token
	Token *string `json:"token,omitempty"`
	User  *User   `json:"user,omitempty"`
}

LoginResponse defines model for LoginResponse.

type LoginUserJSONRequestBody

type LoginUserJSONRequestBody = LoginRequest

LoginUserJSONRequestBody defines body for LoginUser for application/json ContentType.

type LoginUserResponse

type LoginUserResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *LoginResponse
	JSON400      *Error
	JSON401      *Error
	JSON500      *Error
}

func ParseLoginUserResponse

func ParseLoginUserResponse(rsp *http.Response) (*LoginUserResponse, error)

ParseLoginUserResponse parses an HTTP response from a LoginUserWithResponse call

func (LoginUserResponse) Status

func (r LoginUserResponse) Status() string

Status returns HTTPResponse.Status

func (LoginUserResponse) StatusCode

func (r LoginUserResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type RegisterRequest

type RegisterRequest struct {
	// Avatar User avatar URL (optional)
	Avatar *string `json:"avatar,omitempty"`

	// Email User email address
	Email openapi_types.Email `json:"email"`

	// Name User name
	Name string `json:"name"`

	// Password User password (minimum 6 characters)
	Password string `json:"password"`
}

RegisterRequest defines model for RegisterRequest.

type RegisterResponse

type RegisterResponse struct {
	// Token JWT authentication token
	Token *string `json:"token,omitempty"`
	User  *User   `json:"user,omitempty"`
}

RegisterResponse defines model for RegisterResponse.

type RegisterUserJSONRequestBody

type RegisterUserJSONRequestBody = RegisterRequest

RegisterUserJSONRequestBody defines body for RegisterUser for application/json ContentType.

type RegisterUserResponse

type RegisterUserResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON201      *RegisterResponse
	JSON400      *Error
	JSON409      *Error
	JSON500      *Error
}

func ParseRegisterUserResponse

func ParseRegisterUserResponse(rsp *http.Response) (*RegisterUserResponse, error)

ParseRegisterUserResponse parses an HTTP response from a RegisterUserWithResponse call

func (RegisterUserResponse) Status

func (r RegisterUserResponse) Status() string

Status returns HTTPResponse.Status

func (RegisterUserResponse) StatusCode

func (r RegisterUserResponse) 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 UpdateUserJSONRequestBody

type UpdateUserJSONRequestBody = UpdateUserRequest

UpdateUserJSONRequestBody defines body for UpdateUser for application/json ContentType.

type UpdateUserRequest

type UpdateUserRequest struct {
	// Avatar User avatar URL (optional)
	Avatar *string `json:"avatar,omitempty"`

	// Name User name (optional)
	Name *string `json:"name,omitempty"`

	// Password New password (optional, minimum 6 characters)
	Password *string `json:"password,omitempty"`
}

UpdateUserRequest defines model for UpdateUserRequest.

type UpdateUserResponse

type UpdateUserResponse struct {
	User *User `json:"user,omitempty"`
}

UpdateUserResponse defines model for UpdateUserResponse.

func ParseUpdateUserResponse

func ParseUpdateUserResponse(rsp *http.Response) (*UpdateUserResponse, error)

ParseUpdateUserResponse parses an HTTP response from a UpdateUserWithResponse call

func (UpdateUserResponse) Status

func (r UpdateUserResponse) Status() string

Status returns HTTPResponse.Status

func (UpdateUserResponse) StatusCode

func (r UpdateUserResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type User

type User struct {
	// Avatar User avatar URL
	Avatar *string `json:"avatar,omitempty"`

	// CreatedAt Creation timestamp
	CreatedAt *int64 `json:"created_at,omitempty"`

	// Email User email address
	Email *openapi_types.Email `json:"email,omitempty"`

	// Id User ID
	Id *string `json:"id,omitempty"`

	// Name User name
	Name *string `json:"name,omitempty"`

	// UpdatedAt Last update timestamp
	UpdatedAt *int64 `json:"updated_at,omitempty"`
}

User defines model for User.

Jump to

Keyboard shortcuts

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