server

package
v6.2.12 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2026 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

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

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGetPresentationsRequest

func NewGetPresentationsRequest(server string, serviceID string, params *GetPresentationsParams) (*http.Request, error)

NewGetPresentationsRequest generates requests for GetPresentations

func NewRegisterPresentationRequest

func NewRegisterPresentationRequest(server string, serviceID string, body RegisterPresentationJSONRequestBody) (*http.Request, error)

NewRegisterPresentationRequest calls the generic RegisterPresentation builder with application/json body

func NewRegisterPresentationRequestWithBody

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

NewRegisterPresentationRequestWithBody generates requests for RegisterPresentation with any type of body

func RegisterHandlers

func RegisterHandlers(router EchoRouter, si ServerInterface)

RegisterHandlers adds each server route to the EchoRouter.

func RegisterHandlersWithBaseURL

func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string)

Registers handlers, and prepends BaseURL to the paths, so that the paths can be served under a prefix.

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

func (c *Client) GetPresentations(ctx context.Context, serviceID string, params *GetPresentationsParams, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) RegisterPresentation

func (c *Client) RegisterPresentation(ctx context.Context, serviceID string, body RegisterPresentationJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) RegisterPresentationWithBody

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

type ClientInterface

type ClientInterface interface {
	// GetPresentations request
	GetPresentations(ctx context.Context, serviceID string, params *GetPresentationsParams, reqEditors ...RequestEditorFn) (*http.Response, error)

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

	RegisterPresentation(ctx context.Context, serviceID string, body RegisterPresentationJSONRequestBody, 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) GetPresentationsWithResponse

func (c *ClientWithResponses) GetPresentationsWithResponse(ctx context.Context, serviceID string, params *GetPresentationsParams, reqEditors ...RequestEditorFn) (*GetPresentationsResponse, error)

GetPresentationsWithResponse request returning *GetPresentationsResponse

func (*ClientWithResponses) RegisterPresentationWithBodyWithResponse

func (c *ClientWithResponses) RegisterPresentationWithBodyWithResponse(ctx context.Context, serviceID string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*RegisterPresentationResponse, error)

RegisterPresentationWithBodyWithResponse request with arbitrary body returning *RegisterPresentationResponse

func (*ClientWithResponses) RegisterPresentationWithResponse

func (c *ClientWithResponses) RegisterPresentationWithResponse(ctx context.Context, serviceID string, body RegisterPresentationJSONRequestBody, reqEditors ...RequestEditorFn) (*RegisterPresentationResponse, error)

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// GetPresentationsWithResponse request
	GetPresentationsWithResponse(ctx context.Context, serviceID string, params *GetPresentationsParams, reqEditors ...RequestEditorFn) (*GetPresentationsResponse, error)

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

	RegisterPresentationWithResponse(ctx context.Context, serviceID string, body RegisterPresentationJSONRequestBody, reqEditors ...RequestEditorFn) (*RegisterPresentationResponse, error)
}

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

type EchoRouter

type EchoRouter interface {
	CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
}

This is a simple interface which specifies echo.Route addition functions which are present on both echo.Echo and echo.Group, since we want to allow using either of them for path registration

type GetPresentations200JSONResponse

type GetPresentations200JSONResponse PresentationsResponse

func (GetPresentations200JSONResponse) VisitGetPresentationsResponse

func (response GetPresentations200JSONResponse) VisitGetPresentationsResponse(w http.ResponseWriter) error

type GetPresentationsParams

type GetPresentationsParams struct {
	Timestamp *int `form:"timestamp,omitempty" json:"timestamp,omitempty"`
}

GetPresentationsParams defines parameters for GetPresentations.

type GetPresentationsRequestObject

type GetPresentationsRequestObject struct {
	ServiceID string `json:"serviceID"`
	Params    GetPresentationsParams
}

type GetPresentationsResponse

type GetPresentationsResponse struct {
	Body                          []byte
	HTTPResponse                  *http.Response
	JSON200                       *PresentationsResponse
	ApplicationproblemJSONDefault *struct {
		// Detail A human-readable explanation specific to this occurrence of the problem.
		Detail string `json:"detail"`

		// Status HTTP statuscode
		Status float32 `json:"status"`

		// Title A short, human-readable summary of the problem type.
		Title string `json:"title"`
	}
}

func ParseGetPresentationsResponse

func ParseGetPresentationsResponse(rsp *http.Response) (*GetPresentationsResponse, error)

ParseGetPresentationsResponse parses an HTTP response from a GetPresentationsWithResponse call

func (GetPresentationsResponse) Status

func (r GetPresentationsResponse) Status() string

Status returns HTTPResponse.Status

func (GetPresentationsResponse) StatusCode

func (r GetPresentationsResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetPresentationsResponseObject

type GetPresentationsResponseObject interface {
	VisitGetPresentationsResponse(w http.ResponseWriter) error
}

type GetPresentationsdefaultApplicationProblemPlusJSONResponse

type GetPresentationsdefaultApplicationProblemPlusJSONResponse struct {
	Body struct {
		// Detail A human-readable explanation specific to this occurrence of the problem.
		Detail string `json:"detail"`

		// Status HTTP statuscode
		Status float32 `json:"status"`

		// Title A short, human-readable summary of the problem type.
		Title string `json:"title"`
	}
	StatusCode int
}

func (GetPresentationsdefaultApplicationProblemPlusJSONResponse) VisitGetPresentationsResponse

func (response GetPresentationsdefaultApplicationProblemPlusJSONResponse) VisitGetPresentationsResponse(w http.ResponseWriter) error

type HttpRequestDoer

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

Doer performs HTTP requests.

The standard http.Client implements this interface.

type PresentationsResponse

type PresentationsResponse = client.PresentationsResponse

type RegisterPresentation201Response

type RegisterPresentation201Response struct {
}

func (RegisterPresentation201Response) VisitRegisterPresentationResponse

func (response RegisterPresentation201Response) VisitRegisterPresentationResponse(w http.ResponseWriter) error

type RegisterPresentation400ApplicationProblemPlusJSONResponse

type RegisterPresentation400ApplicationProblemPlusJSONResponse struct {
	// Detail A human-readable explanation specific to this occurrence of the problem.
	Detail string `json:"detail"`

	// Status HTTP statuscode
	Status float32 `json:"status"`

	// Title A short, human-readable summary of the problem type.
	Title string `json:"title"`
}

func (RegisterPresentation400ApplicationProblemPlusJSONResponse) VisitRegisterPresentationResponse

func (response RegisterPresentation400ApplicationProblemPlusJSONResponse) VisitRegisterPresentationResponse(w http.ResponseWriter) error

type RegisterPresentationJSONRequestBody

type RegisterPresentationJSONRequestBody = VerifiablePresentation

RegisterPresentationJSONRequestBody defines body for RegisterPresentation for application/json ContentType.

type RegisterPresentationRequestObject

type RegisterPresentationRequestObject struct {
	ServiceID string `json:"serviceID"`
	Body      *RegisterPresentationJSONRequestBody
}

type RegisterPresentationResponse

type RegisterPresentationResponse struct {
	Body                      []byte
	HTTPResponse              *http.Response
	ApplicationproblemJSON400 *struct {
		// Detail A human-readable explanation specific to this occurrence of the problem.
		Detail string `json:"detail"`

		// Status HTTP statuscode
		Status float32 `json:"status"`

		// Title A short, human-readable summary of the problem type.
		Title string `json:"title"`
	}
	ApplicationproblemJSONDefault *struct {
		// Detail A human-readable explanation specific to this occurrence of the problem.
		Detail string `json:"detail"`

		// Status HTTP statuscode
		Status float32 `json:"status"`

		// Title A short, human-readable summary of the problem type.
		Title string `json:"title"`
	}
}

func ParseRegisterPresentationResponse

func ParseRegisterPresentationResponse(rsp *http.Response) (*RegisterPresentationResponse, error)

ParseRegisterPresentationResponse parses an HTTP response from a RegisterPresentationWithResponse call

func (RegisterPresentationResponse) Status

Status returns HTTPResponse.Status

func (RegisterPresentationResponse) StatusCode

func (r RegisterPresentationResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type RegisterPresentationResponseObject

type RegisterPresentationResponseObject interface {
	VisitRegisterPresentationResponse(w http.ResponseWriter) error
}

type RegisterPresentationdefaultApplicationProblemPlusJSONResponse

type RegisterPresentationdefaultApplicationProblemPlusJSONResponse struct {
	Body struct {
		// Detail A human-readable explanation specific to this occurrence of the problem.
		Detail string `json:"detail"`

		// Status HTTP statuscode
		Status float32 `json:"status"`

		// Title A short, human-readable summary of the problem type.
		Title string `json:"title"`
	}
	StatusCode int
}

func (RegisterPresentationdefaultApplicationProblemPlusJSONResponse) VisitRegisterPresentationResponse

func (response RegisterPresentationdefaultApplicationProblemPlusJSONResponse) VisitRegisterPresentationResponse(w http.ResponseWriter) error

type RequestEditorFn

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

RequestEditorFn is the function signature for the RequestEditor callback function

type SearchResult

type SearchResult struct {
	// Fields Input descriptor IDs and their mapped values that from the Verifiable Credential.
	Fields map[string]interface{} `json:"fields"`

	// Id The ID of the Verifiable Presentation.
	Id string `json:"id"`

	// SubjectId The ID of the Verifiable Credential subject (holder), typically a DID.
	SubjectId string                 `json:"subject_id"`
	Vp        VerifiablePresentation `json:"vp"`
}

SearchResult defines model for SearchResult.

type ServerInterface

type ServerInterface interface {
	// Retrieves the presentations of a Discovery Service.
	// (GET /discovery/{serviceID})
	GetPresentations(ctx echo.Context, serviceID string, params GetPresentationsParams) error
	// Register a presentation on the Discovery Service.
	// (POST /discovery/{serviceID})
	RegisterPresentation(ctx echo.Context, serviceID string) error
}

ServerInterface represents all server handlers.

func NewStrictHandler

func NewStrictHandler(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc) ServerInterface

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler ServerInterface
}

ServerInterfaceWrapper converts echo contexts to parameters.

func (*ServerInterfaceWrapper) GetPresentations

func (w *ServerInterfaceWrapper) GetPresentations(ctx echo.Context) error

GetPresentations converts echo context to params.

func (*ServerInterfaceWrapper) RegisterPresentation

func (w *ServerInterfaceWrapper) RegisterPresentation(ctx echo.Context) error

RegisterPresentation converts echo context to params.

type StrictHandlerFunc

type StrictHandlerFunc = strictecho.StrictEchoHandlerFunc

type StrictMiddlewareFunc

type StrictMiddlewareFunc = strictecho.StrictEchoMiddlewareFunc

type StrictServerInterface

type StrictServerInterface interface {
	// Retrieves the presentations of a Discovery Service.
	// (GET /discovery/{serviceID})
	GetPresentations(ctx context.Context, request GetPresentationsRequestObject) (GetPresentationsResponseObject, error)
	// Register a presentation on the Discovery Service.
	// (POST /discovery/{serviceID})
	RegisterPresentation(ctx context.Context, request RegisterPresentationRequestObject) (RegisterPresentationResponseObject, error)
}

StrictServerInterface represents all server handlers.

type VerifiablePresentation

type VerifiablePresentation = vc.VerifiablePresentation

type Wrapper

type Wrapper struct {
	Server discovery.Server
}

func (*Wrapper) GetPresentations

func (*Wrapper) ResolveStatusCode

func (w *Wrapper) ResolveStatusCode(err error) int

func (*Wrapper) Routes

func (w *Wrapper) Routes(router core.EchoRouter)

Directories

Path Synopsis
Package client is a generated GoMock package.
Package client is a generated GoMock package.

Jump to

Keyboard shortcuts

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