clients

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

func NewAPI

func NewAPI(service ServiceInterface, logger logging.LoggerInterface) *API

func (*API) CreateClient

func (a *API) CreateClient(w http.ResponseWriter, r *http.Request)

func (*API) DeleteClient

func (a *API) DeleteClient(w http.ResponseWriter, r *http.Request)

func (*API) GetClient

func (a *API) GetClient(w http.ResponseWriter, r *http.Request)

func (*API) ListClients

func (a *API) ListClients(w http.ResponseWriter, r *http.Request)

func (*API) RegisterEndpoints

func (a *API) RegisterEndpoints(mux *chi.Mux)

func (*API) UpdateClient

func (a *API) UpdateClient(w http.ResponseWriter, r *http.Request)

func (*API) WriteJSONResponse

func (a *API) WriteJSONResponse(w http.ResponseWriter, data interface{}, msg string, status int, links interface{}, meta interface{})

type ErrorOAuth2

type ErrorOAuth2 struct {
	Error            string `json:"error,omitempty"`
	ErrorDescription string `json:"error_description,omitempty"`
	StatusCode       int    `json:"-"`
}

type HydraClientInterface

type HydraClientInterface interface {
	OAuth2Api() hClient.OAuth2Api
}

type ListClientsRequest

type ListClientsRequest struct {
	PaginationMeta
	Owner      string `json:"owner,omitempty"`
	ClientName string `json:"client_name,omitempty"`
}

func NewListClientsRequest

func NewListClientsRequest(cn, owner, page string, size int) *ListClientsRequest

type OAuth2Client

type OAuth2Client = hClient.OAuth2Client

type PaginationLinksMeta

type PaginationLinksMeta struct {
	First PaginationMeta `json:"first,omitempty"`
	Last  PaginationMeta `json:"last,omitempty"`
	Prev  PaginationMeta `json:"prev,omitempty"`
	Next  PaginationMeta `json:"next,omitempty"`
}

type PaginationLinksResponse

type PaginationLinksResponse struct {
	First string `json:"first,omitempty"`
	Last  string `json:"last,omitempty"`
	Prev  string `json:"prev,omitempty"`
	Next  string `json:"next,omitempty"`
}

type PaginationMeta

type PaginationMeta struct {
	Page string `json:"page,omitempty"`
	Size int    `json:"size,omitempty"`
}

type Service

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

func (*Service) CreateClient

func (s *Service) CreateClient(ctx context.Context, client *hClient.OAuth2Client) (*ServiceResponse, error)

func (*Service) DeleteClient

func (s *Service) DeleteClient(ctx context.Context, clientID string) (*ServiceResponse, error)

func (*Service) GetClient

func (s *Service) GetClient(ctx context.Context, clientID string) (*ServiceResponse, error)

func (*Service) ListClients

func (s *Service) ListClients(ctx context.Context, cs *ListClientsRequest) (*ServiceResponse, error)

func (*Service) UnmarshalClient

func (s *Service) UnmarshalClient(data []byte) (*hClient.OAuth2Client, error)

func (*Service) UpdateClient

func (s *Service) UpdateClient(ctx context.Context, client *hClient.OAuth2Client) (*ServiceResponse, error)

type ServiceInterface

type ServiceInterface interface {
	GetClient(context.Context, string) (*ServiceResponse, error)
	CreateClient(context.Context, *hClient.OAuth2Client) (*ServiceResponse, error)
	UpdateClient(context.Context, *hClient.OAuth2Client) (*ServiceResponse, error)
	ListClients(context.Context, *ListClientsRequest) (*ServiceResponse, error)
	DeleteClient(context.Context, string) (*ServiceResponse, error)
	UnmarshalClient(data []byte) (*hClient.OAuth2Client, error)
}

type ServiceResponse

type ServiceResponse struct {
	Links        *PaginationLinksMeta
	ServiceError *ErrorOAuth2
	Resp         interface{}
	Meta         map[string]string
}

func NewServiceResponse

func NewServiceResponse() *ServiceResponse

Jump to

Keyboard shortcuts

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