discovery

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

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

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

Index

Constants

View Source
const (
	JwtBearerAuthScopes = "jwtBearerAuth.Scopes"
)

Variables

This section is empty.

Functions

func NewActivateServiceForSubjectRequest

func NewActivateServiceForSubjectRequest(server string, serviceID string, subjectID string) (*http.Request, error)

NewActivateServiceForSubjectRequest generates requests for ActivateServiceForSubject

func NewDeactivateServiceForSubjectRequest

func NewDeactivateServiceForSubjectRequest(server string, serviceID string, subjectID string) (*http.Request, error)

NewDeactivateServiceForSubjectRequest generates requests for DeactivateServiceForSubject

func NewGetServiceActivationRequest

func NewGetServiceActivationRequest(server string, serviceID string, subjectID string) (*http.Request, error)

NewGetServiceActivationRequest generates requests for GetServiceActivation

func NewGetServicesRequest

func NewGetServicesRequest(server string) (*http.Request, error)

NewGetServicesRequest generates requests for GetServices

func NewSearchPresentationsRequest

func NewSearchPresentationsRequest(server string, serviceID string, params *SearchPresentationsParams) (*http.Request, error)

NewSearchPresentationsRequest generates requests for SearchPresentations

Types

type ActivateServiceForSubjectResponse

type ActivateServiceForSubjectResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON202      *struct {
		// Reason Description of why registration failed.
		Reason string `json:"reason"`
	}
	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 ParseActivateServiceForSubjectResponse

func ParseActivateServiceForSubjectResponse(rsp *http.Response) (*ActivateServiceForSubjectResponse, error)

ParseActivateServiceForSubjectResponse parses an HTTP response from a ActivateServiceForSubjectWithResponse call

func (ActivateServiceForSubjectResponse) Status

Status returns HTTPResponse.Status

func (ActivateServiceForSubjectResponse) StatusCode

func (r ActivateServiceForSubjectResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

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

func (c *Client) ActivateServiceForSubject(ctx context.Context, serviceID string, subjectID string, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) DeactivateServiceForSubject

func (c *Client) DeactivateServiceForSubject(ctx context.Context, serviceID string, subjectID string, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetServiceActivation

func (c *Client) GetServiceActivation(ctx context.Context, serviceID string, subjectID string, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetServices

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

func (*Client) SearchPresentations

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

type ClientInterface

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

	// SearchPresentations request
	SearchPresentations(ctx context.Context, serviceID string, params *SearchPresentationsParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// DeactivateServiceForSubject request
	DeactivateServiceForSubject(ctx context.Context, serviceID string, subjectID string, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetServiceActivation request
	GetServiceActivation(ctx context.Context, serviceID string, subjectID string, reqEditors ...RequestEditorFn) (*http.Response, error)

	// ActivateServiceForSubject request
	ActivateServiceForSubject(ctx context.Context, serviceID string, subjectID string, 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) ActivateServiceForSubjectWithResponse

func (c *ClientWithResponses) ActivateServiceForSubjectWithResponse(ctx context.Context, serviceID string, subjectID string, reqEditors ...RequestEditorFn) (*ActivateServiceForSubjectResponse, error)

ActivateServiceForSubjectWithResponse request returning *ActivateServiceForSubjectResponse

func (*ClientWithResponses) DeactivateServiceForSubjectWithResponse

func (c *ClientWithResponses) DeactivateServiceForSubjectWithResponse(ctx context.Context, serviceID string, subjectID string, reqEditors ...RequestEditorFn) (*DeactivateServiceForSubjectResponse, error)

DeactivateServiceForSubjectWithResponse request returning *DeactivateServiceForSubjectResponse

func (*ClientWithResponses) GetServiceActivationWithResponse

func (c *ClientWithResponses) GetServiceActivationWithResponse(ctx context.Context, serviceID string, subjectID string, reqEditors ...RequestEditorFn) (*GetServiceActivationResponse, error)

GetServiceActivationWithResponse request returning *GetServiceActivationResponse

func (*ClientWithResponses) GetServicesWithResponse

func (c *ClientWithResponses) GetServicesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetServicesResponse, error)

GetServicesWithResponse request returning *GetServicesResponse

func (*ClientWithResponses) SearchPresentationsWithResponse

func (c *ClientWithResponses) SearchPresentationsWithResponse(ctx context.Context, serviceID string, params *SearchPresentationsParams, reqEditors ...RequestEditorFn) (*SearchPresentationsResponse, error)

SearchPresentationsWithResponse request returning *SearchPresentationsResponse

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// GetServicesWithResponse request
	GetServicesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetServicesResponse, error)

	// SearchPresentationsWithResponse request
	SearchPresentationsWithResponse(ctx context.Context, serviceID string, params *SearchPresentationsParams, reqEditors ...RequestEditorFn) (*SearchPresentationsResponse, error)

	// DeactivateServiceForSubjectWithResponse request
	DeactivateServiceForSubjectWithResponse(ctx context.Context, serviceID string, subjectID string, reqEditors ...RequestEditorFn) (*DeactivateServiceForSubjectResponse, error)

	// GetServiceActivationWithResponse request
	GetServiceActivationWithResponse(ctx context.Context, serviceID string, subjectID string, reqEditors ...RequestEditorFn) (*GetServiceActivationResponse, error)

	// ActivateServiceForSubjectWithResponse request
	ActivateServiceForSubjectWithResponse(ctx context.Context, serviceID string, subjectID string, reqEditors ...RequestEditorFn) (*ActivateServiceForSubjectResponse, error)
}

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

type DIDStatus

type DIDStatus struct {
	ServiceID     string                      `json:"id"`
	Active        bool                        `json:"active"`
	Presentations []vc.VerifiablePresentation `json:"vps"`
}

DIDStatus represents the status of a DID in the discovery service

type DeactivateServiceForSubjectResponse

type DeactivateServiceForSubjectResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON202      *struct {
		// Reason Description of why removal of the registration failed.
		Reason string `json:"reason"`
	}
	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 ParseDeactivateServiceForSubjectResponse

func ParseDeactivateServiceForSubjectResponse(rsp *http.Response) (*DeactivateServiceForSubjectResponse, error)

ParseDeactivateServiceForSubjectResponse parses an HTTP response from a DeactivateServiceForSubjectWithResponse call

func (DeactivateServiceForSubjectResponse) Status

Status returns HTTPResponse.Status

func (DeactivateServiceForSubjectResponse) StatusCode

StatusCode returns HTTPResponse.StatusCode

type GetServiceActivationResponse

type GetServiceActivationResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *struct {
		// Activated Whether the Discovery Service is activated for the given subject
		Activated bool `json:"activated"`

		// Vp List of VPs on the Discovery Service for the subject. One per DID method registered on the Service.
		// The list can be empty even if activated==true if none of the DIDs of a subject is actually registered on the Discovery Service.
		Vp *[]VerifiablePresentation `json:"vp,omitempty"`
	}
	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 ParseGetServiceActivationResponse

func ParseGetServiceActivationResponse(rsp *http.Response) (*GetServiceActivationResponse, error)

ParseGetServiceActivationResponse parses an HTTP response from a GetServiceActivationWithResponse call

func (GetServiceActivationResponse) Status

Status returns HTTPResponse.Status

func (GetServiceActivationResponse) StatusCode

func (r GetServiceActivationResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetServicesResponse

type GetServicesResponse struct {
	Body                          []byte
	HTTPResponse                  *http.Response
	JSON200                       *[]ServiceDefinition
	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 ParseGetServicesResponse

func ParseGetServicesResponse(rsp *http.Response) (*GetServicesResponse, error)

ParseGetServicesResponse parses an HTTP response from a GetServicesWithResponse call

func (GetServicesResponse) Status

func (r GetServicesResponse) Status() string

Status returns HTTPResponse.Status

func (GetServicesResponse) StatusCode

func (r GetServicesResponse) 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 RequestEditorFn

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

RequestEditorFn is the function signature for the RequestEditor callback function

type SearchPresentationsParams

type SearchPresentationsParams struct {
	Query *map[string]string `form:"query,omitempty" json:"query,omitempty"`
}

SearchPresentationsParams defines parameters for SearchPresentations.

type SearchPresentationsResponse

type SearchPresentationsResponse struct {
	Body                          []byte
	HTTPResponse                  *http.Response
	JSON200                       *[]SearchResult
	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 ParseSearchPresentationsResponse

func ParseSearchPresentationsResponse(rsp *http.Response) (*SearchPresentationsResponse, error)

ParseSearchPresentationsResponse parses an HTTP response from a SearchPresentationsWithResponse call

func (SearchPresentationsResponse) Status

Status returns HTTPResponse.Status

func (SearchPresentationsResponse) StatusCode

func (r SearchPresentationsResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type SearchResult

type SearchResult struct {
	// CredentialSubjectId The ID of the Verifiable Credential subject (holder), typically a DID.
	CredentialSubjectId string `json:"credential_subject_id"`

	// 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"`
	Vp VerifiablePresentation `json:"vp"`
}

SearchResult defines model for SearchResult.

type Service

type Service struct {
	Client *Client
}

func (Service) ActivationStatus

func (i Service) ActivationStatus(ctx context.Context, serviceID string, subjectID string) (*DIDStatus, error)

func (Service) GetDiscoveryServices

func (i Service) GetDiscoveryServices(ctx context.Context) ([]ServiceDefinition, error)

type ServiceDefinition

type ServiceDefinition struct {
	// Endpoint The endpoint of the Discovery Service.
	Endpoint string `json:"endpoint"`

	// Id The ID of the Discovery Service.
	Id string `json:"id"`

	// PresentationDefinition The Presentation Definition of the Discovery Service.
	PresentationDefinition map[string]interface{} `json:"presentation_definition"`

	// PresentationMaxValidity The maximum validity (in seconds) of a Verifiable Presentation of the Discovery Service.
	PresentationMaxValidity int `json:"presentation_max_validity"`
}

ServiceDefinition defines model for ServiceDefinition.

type VerifiablePresentation

type VerifiablePresentation = externalRef0.VerifiablePresentation

VerifiablePresentation defines model for VerifiablePresentation.

Jump to

Keyboard shortcuts

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