v1

package
v0.0.0-...-906d25d Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2025 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Overview

Package v1 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

View Source
const (
	BasicScopes  contextKey = "Basic.Scopes"
	BearerScopes contextKey = "Bearer.Scopes"
	HeaderScopes contextKey = "Header.Scopes"
)

Variables

View Source
var (

	// ErrUnsupportedImageFormat defines the error for unsupported image formats.
	ErrUnsupportedImageFormat = fmt.Errorf("unsupported avatar file format")
)

Functions

func FromPtr

func FromPtr[T any](v *T) T

FromPtr transform input from pointer.

func GetSwagger

func GetSwagger() (swagger *openapi3.T, err error)

GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.

func Handler

func Handler(si ServerInterface) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

func HandlerFromMux

func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler

HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.

func HandlerFromMuxWithBaseURL

func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler

func HandlerWithOptions

func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler

HandlerWithOptions creates http.Handler with additional options

func Notify

func Notify(w http.ResponseWriter, notification Notification)

Notify simply processes a notification.

func PathToRawSpec

func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)

Constructs a synthetic filesystem for resolving external references when loading openapi specifications.

func ToPtr

func ToPtr[T any](v T) *T

ToPtr transform input to a pointer.

Types

type API

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

API provides the http.Handler for the OpenAPI implementation.

func New

func New(
	cfg *config.Config,
	registry *metrics.Metrics,
	identity *authn.Authn,
	uploads upload.Upload,
	storage *store.Store,
) *API

New creates a new API that adds the handler implementations.

func (*API) AllowAdminAccessOnly

func (a *API) AllowAdminAccessOnly(next http.Handler) http.Handler

AllowAdminAccessOnly defines a middleware to check permissions.

func (*API) AttachGroupToUser

func (a *API) AttachGroupToUser(w http.ResponseWriter, r *http.Request, _ GroupID)

AttachGroupToUser implements the v1.ServerInterface.

func (*API) AttachUserToGroup

func (a *API) AttachUserToGroup(w http.ResponseWriter, r *http.Request, _ UserID)

AttachUserToGroup implements the v1.ServerInterface.

func (*API) Authentication

func (a *API) Authentication(ctx context.Context, input *openapi3filter.AuthenticationInput) error

Authentication provides the authentication for the OpenAPI filter.

func (*API) CallbackProvider

func (a *API) CallbackProvider(w http.ResponseWriter, r *http.Request, providerParam AuthProviderParam, params CallbackProviderParams)

CallbackProvider implements the v1.ServerInterface.

func (*API) CreateGroup

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

CreateGroup implements the v1.ServerInterface.

func (*API) CreateUser

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

CreateUser implements the v1.ServerInterface.

func (*API) DeleteGroup

func (a *API) DeleteGroup(w http.ResponseWriter, r *http.Request, _ GroupID)

DeleteGroup implements the v1.ServerInterface.

func (*API) DeleteGroupFromUser

func (a *API) DeleteGroupFromUser(w http.ResponseWriter, r *http.Request, _ GroupID)

DeleteGroupFromUser implements the v1.ServerInterface.

func (*API) DeleteUser

func (a *API) DeleteUser(w http.ResponseWriter, r *http.Request, _ UserID)

DeleteUser implements the v1.ServerInterface.

func (*API) DeleteUserFromGroup

func (a *API) DeleteUserFromGroup(w http.ResponseWriter, r *http.Request, _ UserID)

DeleteUserFromGroup implements the v1.ServerInterface.

func (*API) GroupFromContext

func (a *API) GroupFromContext(ctx context.Context) *model.Group

GroupFromContext is used to get the requested group from the context.

func (*API) GroupToContext

func (a *API) GroupToContext(next http.Handler) http.Handler

GroupToContext is used to put the requested group into the context.

func (*API) ListGroupUsers

func (a *API) ListGroupUsers(w http.ResponseWriter, r *http.Request, _ GroupID, params ListGroupUsersParams)

ListGroupUsers implements the v1.ServerInterface.

func (*API) ListGroups

func (a *API) ListGroups(w http.ResponseWriter, r *http.Request, params ListGroupsParams)

ListGroups implements the v1.ServerInterface.

func (*API) ListProviders

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

ListProviders implements the v1.ServerInterface.

func (*API) ListUserGroups

func (a *API) ListUserGroups(w http.ResponseWriter, r *http.Request, _ UserID, params ListUserGroupsParams)

ListUserGroups implements the v1.ServerInterface.

func (*API) ListUsers

func (a *API) ListUsers(w http.ResponseWriter, r *http.Request, params ListUsersParams)

ListUsers implements the v1.ServerInterface.

func (*API) LoginAuth

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

LoginAuth implements the v1.ServerInterface.

func (*API) PermitGroupUser

func (a *API) PermitGroupUser(w http.ResponseWriter, r *http.Request, _ GroupID)

PermitGroupUser implements the v1.ServerInterface.

func (*API) PermitUserGroup

func (a *API) PermitUserGroup(w http.ResponseWriter, r *http.Request, _ UserID)

PermitUserGroup implements the v1.ServerInterface.

func (*API) RedirectAuth

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

RedirectAuth implements the v1.ServerInterface.

func (*API) RefreshAuth

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

RefreshAuth implements the v1.ServerInterface.

func (*API) RenderNotify

func (a *API) RenderNotify(w http.ResponseWriter, r *http.Request, notify Notification)

RenderNotify is a helper to set a correct status for notifications.

func (*API) RequestProvider

func (a *API) RequestProvider(w http.ResponseWriter, r *http.Request, providerParam AuthProviderParam)

RequestProvider implements the v1.ServerInterface.

func (*API) ShowGroup

func (a *API) ShowGroup(w http.ResponseWriter, r *http.Request, _ GroupID)

ShowGroup implements the v1.ServerInterface.

func (*API) ShowProfile

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

ShowProfile implements the v1.ServerInterface.

func (*API) ShowUser

func (a *API) ShowUser(w http.ResponseWriter, r *http.Request, _ UserID)

ShowUser implements the v1.ServerInterface.

func (*API) TokenProfile

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

TokenProfile implements the v1.ServerInterface.

func (*API) UpdateGroup

func (a *API) UpdateGroup(w http.ResponseWriter, r *http.Request, _ GroupID)

UpdateGroup implements the v1.ServerInterface.

func (*API) UpdateProfile

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

UpdateProfile implements the v1.ServerInterface.

func (*API) UpdateUser

func (a *API) UpdateUser(w http.ResponseWriter, r *http.Request, _ UserID)

UpdateUser implements the v1.ServerInterface.

func (*API) UserFromContext

func (a *API) UserFromContext(ctx context.Context) *model.User

UserFromContext is used to get the requested user from the context.

func (*API) UserToContext

func (a *API) UserToContext(next http.Handler) http.Handler

UserToContext is used to put the requested user into the context.

func (*API) VerifyAuth

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

VerifyAuth implements the v1.ServerInterface.

type ActionFailedError

type ActionFailedError = Notification

ActionFailedError Generic response for errors and validations

type AlreadyAttachedError

type AlreadyAttachedError = Notification

AlreadyAttachedError Generic response for errors and validations

type AttachGroupToUserJSONBody

type AttachGroupToUserJSONBody struct {
	Perm string `json:"perm"`
	User string `json:"user"`
}

AttachGroupToUserJSONBody defines parameters for AttachGroupToUser.

type AttachGroupToUserJSONRequestBody

type AttachGroupToUserJSONRequestBody AttachGroupToUserJSONBody

AttachGroupToUserJSONRequestBody defines body for AttachGroupToUser for application/json ContentType.

type AttachUserToGroupJSONBody

type AttachUserToGroupJSONBody struct {
	Group string `json:"group"`
	Perm  string `json:"perm"`
}

AttachUserToGroupJSONBody defines parameters for AttachUserToGroup.

type AttachUserToGroupJSONRequestBody

type AttachUserToGroupJSONRequestBody AttachUserToGroupJSONBody

AttachUserToGroupJSONRequestBody defines body for AttachUserToGroup for application/json ContentType.

type AuthCodeParam

type AuthCodeParam = string

AuthCodeParam defines model for AuthCodeParam.

type AuthProviderParam

type AuthProviderParam = string

AuthProviderParam defines model for AuthProviderParam.

type AuthStateParam

type AuthStateParam = string

AuthStateParam defines model for AuthStateParam.

type AuthToken

type AuthToken struct {
	ExpiresAt *time.Time `json:"expires_at,omitempty"`
	Token     *string    `json:"token,omitempty"`
}

AuthToken defines model for AuthToken.

type AuthVerify

type AuthVerify struct {
	CreatedAt *time.Time `json:"created_at,omitempty"`
	Username  *string    `json:"username,omitempty"`
}

AuthVerify defines model for AuthVerify.

type BadCredentialsError

type BadCredentialsError = Notification

BadCredentialsError Generic response for errors and validations

type BadRequestError

type BadRequestError = Notification

BadRequestError Generic response for errors and validations

type CallbackProviderParams

type CallbackProviderParams struct {
	// State Auth state
	State *AuthStateParam `form:"state,omitempty" json:"state,omitempty"`

	// Code Auth code
	Code *AuthCodeParam `form:"code,omitempty" json:"code,omitempty"`
}

CallbackProviderParams defines parameters for CallbackProvider.

type ChiServerOptions

type ChiServerOptions struct {
	BaseURL          string
	BaseRouter       chi.Router
	Middlewares      []MiddlewareFunc
	ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type CreateGroupBody

type CreateGroupBody struct {
	Name *string `json:"name,omitempty"`
	Slug *string `json:"slug,omitempty"`
}

CreateGroupBody defines model for CreateGroupBody.

type CreateGroupJSONBody

type CreateGroupJSONBody struct {
	Name *string `json:"name,omitempty"`
	Slug *string `json:"slug,omitempty"`
}

CreateGroupJSONBody defines parameters for CreateGroup.

type CreateGroupJSONRequestBody

type CreateGroupJSONRequestBody CreateGroupJSONBody

CreateGroupJSONRequestBody defines body for CreateGroup for application/json ContentType.

type CreateUserBody

type CreateUserBody struct {
	Active   *bool   `json:"active,omitempty"`
	Admin    *bool   `json:"admin,omitempty"`
	Email    *string `json:"email,omitempty"`
	Fullname *string `json:"fullname,omitempty"`
	Password *string `json:"password,omitempty"`
	Username *string `json:"username,omitempty"`
}

CreateUserBody defines model for CreateUserBody.

type CreateUserJSONBody

type CreateUserJSONBody struct {
	Active   *bool   `json:"active,omitempty"`
	Admin    *bool   `json:"admin,omitempty"`
	Email    *string `json:"email,omitempty"`
	Fullname *string `json:"fullname,omitempty"`
	Password *string `json:"password,omitempty"`
	Username *string `json:"username,omitempty"`
}

CreateUserJSONBody defines parameters for CreateUser.

type CreateUserJSONRequestBody

type CreateUserJSONRequestBody CreateUserJSONBody

CreateUserJSONRequestBody defines body for CreateUser for application/json ContentType.

type DeleteGroupFromUserJSONBody

type DeleteGroupFromUserJSONBody struct {
	User string `json:"user"`
}

DeleteGroupFromUserJSONBody defines parameters for DeleteGroupFromUser.

type DeleteGroupFromUserJSONRequestBody

type DeleteGroupFromUserJSONRequestBody DeleteGroupFromUserJSONBody

DeleteGroupFromUserJSONRequestBody defines body for DeleteGroupFromUser for application/json ContentType.

type DeleteUserFromGroupJSONBody

type DeleteUserFromGroupJSONBody struct {
	Group string `json:"group"`
}

DeleteUserFromGroupJSONBody defines parameters for DeleteUserFromGroup.

type DeleteUserFromGroupJSONRequestBody

type DeleteUserFromGroupJSONRequestBody DeleteUserFromGroupJSONBody

DeleteUserFromGroupJSONRequestBody defines body for DeleteUserFromGroup for application/json ContentType.

type Group

type Group struct {
	CreatedAt *time.Time `json:"created_at,omitempty"`
	ID        *string    `json:"id,omitempty"`
	Name      *string    `json:"name,omitempty"`
	Slug      *string    `json:"slug,omitempty"`
	UpdatedAt *time.Time `json:"updated_at,omitempty"`
}

Group Model to represent group

type GroupID

type GroupID = string

GroupID defines model for GroupParam.

type GroupResponse

type GroupResponse = Group

GroupResponse Model to represent group

type GroupUserDropBody

type GroupUserDropBody struct {
	User string `json:"user"`
}

GroupUserDropBody defines model for GroupUserDropBody.

type GroupUserPermBody

type GroupUserPermBody struct {
	Perm string `json:"perm"`
	User string `json:"user"`
}

GroupUserPermBody defines model for GroupUserPermBody.

type GroupUsersResponse

type GroupUsersResponse struct {
	// Group Model to represent group
	Group  *Group      `json:"group,omitempty"`
	Limit  int64       `json:"limit"`
	Offset int64       `json:"offset"`
	Total  int64       `json:"total"`
	Users  []UserGroup `json:"users"`
}

GroupUsersResponse defines model for GroupUsersResponse.

type GroupsResponse

type GroupsResponse struct {
	Groups []Group `json:"groups"`
	Limit  int64   `json:"limit"`
	Offset int64   `json:"offset"`
	Total  int64   `json:"total"`
}

GroupsResponse defines model for GroupsResponse.

type InternalServerError

type InternalServerError = Notification

InternalServerError Generic response for errors and validations

type InvalidParamFormatError

type InvalidParamFormatError struct {
	ParamName string
	Err       error
}

func (*InvalidParamFormatError) Error

func (e *InvalidParamFormatError) Error() string

func (*InvalidParamFormatError) Unwrap

func (e *InvalidParamFormatError) Unwrap() error

type InvalidTokenError

type InvalidTokenError = Notification

InvalidTokenError Generic response for errors and validations

type ListGroupUsersParams

type ListGroupUsersParams struct {
	// Search Search query
	Search *SearchQueryParam `form:"search,omitempty" json:"search,omitempty"`

	// Sort Sorting column
	Sort *SortColumnParam `form:"sort,omitempty" json:"sort,omitempty"`

	// Order Sorting order
	Order *ListGroupUsersParamsOrder `form:"order,omitempty" json:"order,omitempty"`

	// Limit Paging limit
	Limit *PagingLimitParam `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Paging offset
	Offset *PagingOffsetParam `form:"offset,omitempty" json:"offset,omitempty"`
}

ListGroupUsersParams defines parameters for ListGroupUsers.

type ListGroupUsersParamsOrder

type ListGroupUsersParamsOrder string

ListGroupUsersParamsOrder defines parameters for ListGroupUsers.

const (
	ListGroupUsersParamsOrderAsc  ListGroupUsersParamsOrder = "asc"
	ListGroupUsersParamsOrderDesc ListGroupUsersParamsOrder = "desc"
)

Defines values for ListGroupUsersParamsOrder.

type ListGroupsParams

type ListGroupsParams struct {
	// Search Search query
	Search *SearchQueryParam `form:"search,omitempty" json:"search,omitempty"`

	// Sort Sorting column
	Sort *SortColumnParam `form:"sort,omitempty" json:"sort,omitempty"`

	// Order Sorting order
	Order *ListGroupsParamsOrder `form:"order,omitempty" json:"order,omitempty"`

	// Limit Paging limit
	Limit *PagingLimitParam `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Paging offset
	Offset *PagingOffsetParam `form:"offset,omitempty" json:"offset,omitempty"`
}

ListGroupsParams defines parameters for ListGroups.

type ListGroupsParamsOrder

type ListGroupsParamsOrder string

ListGroupsParamsOrder defines parameters for ListGroups.

const (
	ListGroupsParamsOrderAsc  ListGroupsParamsOrder = "asc"
	ListGroupsParamsOrderDesc ListGroupsParamsOrder = "desc"
)

Defines values for ListGroupsParamsOrder.

type ListUserGroupsParams

type ListUserGroupsParams struct {
	// Search Search query
	Search *SearchQueryParam `form:"search,omitempty" json:"search,omitempty"`

	// Sort Sorting column
	Sort *SortColumnParam `form:"sort,omitempty" json:"sort,omitempty"`

	// Order Sorting order
	Order *ListUserGroupsParamsOrder `form:"order,omitempty" json:"order,omitempty"`

	// Limit Paging limit
	Limit *PagingLimitParam `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Paging offset
	Offset *PagingOffsetParam `form:"offset,omitempty" json:"offset,omitempty"`
}

ListUserGroupsParams defines parameters for ListUserGroups.

type ListUserGroupsParamsOrder

type ListUserGroupsParamsOrder string

ListUserGroupsParamsOrder defines parameters for ListUserGroups.

const (
	Asc  ListUserGroupsParamsOrder = "asc"
	Desc ListUserGroupsParamsOrder = "desc"
)

Defines values for ListUserGroupsParamsOrder.

type ListUsersParams

type ListUsersParams struct {
	// Search Search query
	Search *SearchQueryParam `form:"search,omitempty" json:"search,omitempty"`

	// Sort Sorting column
	Sort *SortColumnParam `form:"sort,omitempty" json:"sort,omitempty"`

	// Order Sorting order
	Order *ListUsersParamsOrder `form:"order,omitempty" json:"order,omitempty"`

	// Limit Paging limit
	Limit *PagingLimitParam `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Paging offset
	Offset *PagingOffsetParam `form:"offset,omitempty" json:"offset,omitempty"`
}

ListUsersParams defines parameters for ListUsers.

type ListUsersParamsOrder

type ListUsersParamsOrder string

ListUsersParamsOrder defines parameters for ListUsers.

const (
	ListUsersParamsOrderAsc  ListUsersParamsOrder = "asc"
	ListUsersParamsOrderDesc ListUsersParamsOrder = "desc"
)

Defines values for ListUsersParamsOrder.

type LoginAuthBody

type LoginAuthBody struct {
	Password string `json:"password"`
	Username string `json:"username"`
}

LoginAuthBody defines model for LoginAuthBody.

type LoginAuthJSONBody

type LoginAuthJSONBody struct {
	Password string `json:"password"`
	Username string `json:"username"`
}

LoginAuthJSONBody defines parameters for LoginAuth.

type LoginAuthJSONRequestBody

type LoginAuthJSONRequestBody LoginAuthJSONBody

LoginAuthJSONRequestBody defines body for LoginAuth for application/json ContentType.

type LoginResponse

type LoginResponse = AuthToken

LoginResponse defines model for LoginResponse.

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

type NotAttachedError

type NotAttachedError = Notification

NotAttachedError Generic response for errors and validations

type NotAuthorizedError

type NotAuthorizedError = Notification

NotAuthorizedError Generic response for errors and validations

type NotFoundError

type NotFoundError = Notification

NotFoundError Generic response for errors and validations

type Notification

type Notification struct {
	Errors  *[]Validation `json:"errors,omitempty"`
	Message *string       `json:"message,omitempty"`
	Status  *int          `json:"status,omitempty"`
}

Notification Generic response for errors and validations

type PagingLimitParam

type PagingLimitParam = int

PagingLimitParam defines model for PagingLimitParam.

type PagingOffsetParam

type PagingOffsetParam = int

PagingOffsetParam defines model for PagingOffsetParam.

type PermitGroupUserJSONBody

type PermitGroupUserJSONBody struct {
	Perm string `json:"perm"`
	User string `json:"user"`
}

PermitGroupUserJSONBody defines parameters for PermitGroupUser.

type PermitGroupUserJSONRequestBody

type PermitGroupUserJSONRequestBody PermitGroupUserJSONBody

PermitGroupUserJSONRequestBody defines body for PermitGroupUser for application/json ContentType.

type PermitUserGroupJSONBody

type PermitUserGroupJSONBody struct {
	Group string `json:"group"`
	Perm  string `json:"perm"`
}

PermitUserGroupJSONBody defines parameters for PermitUserGroup.

type PermitUserGroupJSONRequestBody

type PermitUserGroupJSONRequestBody PermitUserGroupJSONBody

PermitUserGroupJSONRequestBody defines body for PermitUserGroup for application/json ContentType.

type Profile

type Profile struct {
	Active    *bool        `json:"active,omitempty"`
	Admin     *bool        `json:"admin,omitempty"`
	Auths     *[]UserAuth  `json:"auths,omitempty"`
	CreatedAt *time.Time   `json:"created_at,omitempty"`
	Email     *string      `json:"email,omitempty"`
	Fullname  *string      `json:"fullname,omitempty"`
	Groups    *[]UserGroup `json:"groups,omitempty"`
	ID        *string      `json:"id,omitempty"`
	Password  *string      `json:"password,omitempty"`
	Profile   *string      `json:"profile,omitempty"`
	UpdatedAt *time.Time   `json:"updated_at,omitempty"`
	Username  *string      `json:"username,omitempty"`
}

Profile Model to represent profile

type ProfileResponse

type ProfileResponse = Profile

ProfileResponse Model to represent profile

type Provider

type Provider struct {
	Display *string `json:"display,omitempty"`
	Driver  *string `json:"driver,omitempty"`
	Icon    *string `json:"icon,omitempty"`
	Name    *string `json:"name,omitempty"`
}

Provider Model to represent auth provider

type ProvidersResponse

type ProvidersResponse struct {
	Providers []Provider `json:"providers"`
	Total     int64      `json:"total"`
}

ProvidersResponse defines model for ProvidersResponse.

type RedirectAuthBody

type RedirectAuthBody struct {
	Token string `json:"token"`
}

RedirectAuthBody defines model for RedirectAuthBody.

type RedirectAuthJSONBody

type RedirectAuthJSONBody struct {
	Token string `json:"token"`
}

RedirectAuthJSONBody defines parameters for RedirectAuth.

type RedirectAuthJSONRequestBody

type RedirectAuthJSONRequestBody RedirectAuthJSONBody

RedirectAuthJSONRequestBody defines body for RedirectAuth for application/json ContentType.

type RefreshResponse

type RefreshResponse = AuthToken

RefreshResponse defines model for RefreshResponse.

type RequiredHeaderError

type RequiredHeaderError struct {
	ParamName string
	Err       error
}

func (*RequiredHeaderError) Error

func (e *RequiredHeaderError) Error() string

func (*RequiredHeaderError) Unwrap

func (e *RequiredHeaderError) Unwrap() error

type RequiredParamError

type RequiredParamError struct {
	ParamName string
}

func (*RequiredParamError) Error

func (e *RequiredParamError) Error() string

type SearchQueryParam

type SearchQueryParam = string

SearchQueryParam defines model for SearchQueryParam.

type ServerInterface

type ServerInterface interface {
	// Authenticate an user by credentials
	// (POST /auth/login)
	LoginAuth(w http.ResponseWriter, r *http.Request)
	// Fetch the available auth providers
	// (GET /auth/providers)
	ListProviders(w http.ResponseWriter, r *http.Request)
	// Retrieve real token after redirect
	// (POST /auth/redirect)
	RedirectAuth(w http.ResponseWriter, r *http.Request)
	// Refresh an auth token before it expires
	// (GET /auth/refresh)
	RefreshAuth(w http.ResponseWriter, r *http.Request)
	// Verify validity for an authentication token
	// (GET /auth/verify)
	VerifyAuth(w http.ResponseWriter, r *http.Request)
	// Callback to parse the defined provider
	// (GET /auth/{provider}/callback)
	CallbackProvider(w http.ResponseWriter, r *http.Request, provider AuthProviderParam, params CallbackProviderParams)
	// Request the redirect to defined provider
	// (GET /auth/{provider}/request)
	RequestProvider(w http.ResponseWriter, r *http.Request, provider AuthProviderParam)
	// Fetch all available groups
	// (GET /groups)
	ListGroups(w http.ResponseWriter, r *http.Request, params ListGroupsParams)
	// Create a new group
	// (POST /groups)
	CreateGroup(w http.ResponseWriter, r *http.Request)
	// Delete a specific group
	// (DELETE /groups/{group_id})
	DeleteGroup(w http.ResponseWriter, r *http.Request, groupID GroupID)
	// Fetch a specific group
	// (GET /groups/{group_id})
	ShowGroup(w http.ResponseWriter, r *http.Request, groupID GroupID)
	// Update a specific group
	// (PUT /groups/{group_id})
	UpdateGroup(w http.ResponseWriter, r *http.Request, groupID GroupID)
	// Unlink a user from group
	// (DELETE /groups/{group_id}/users)
	DeleteGroupFromUser(w http.ResponseWriter, r *http.Request, groupID GroupID)
	// Fetch all users attached to group
	// (GET /groups/{group_id}/users)
	ListGroupUsers(w http.ResponseWriter, r *http.Request, groupID GroupID, params ListGroupUsersParams)
	// Attach a user to group
	// (POST /groups/{group_id}/users)
	AttachGroupToUser(w http.ResponseWriter, r *http.Request, groupID GroupID)
	// Update user perms for group
	// (PUT /groups/{group_id}/users)
	PermitGroupUser(w http.ResponseWriter, r *http.Request, groupID GroupID)
	// Fetch profile details of the personal account
	// (GET /profile/self)
	ShowProfile(w http.ResponseWriter, r *http.Request)
	// Update your own profile information
	// (PUT /profile/self)
	UpdateProfile(w http.ResponseWriter, r *http.Request)
	// Retrieve an unlimited auth token
	// (GET /profile/token)
	TokenProfile(w http.ResponseWriter, r *http.Request)
	// Fetch all available users
	// (GET /users)
	ListUsers(w http.ResponseWriter, r *http.Request, params ListUsersParams)
	// Create a new user
	// (POST /users)
	CreateUser(w http.ResponseWriter, r *http.Request)
	// Delete a specific user
	// (DELETE /users/{user_id})
	DeleteUser(w http.ResponseWriter, r *http.Request, userID UserID)
	// Fetch a specific user
	// (GET /users/{user_id})
	ShowUser(w http.ResponseWriter, r *http.Request, userID UserID)
	// Update a specific user
	// (PUT /users/{user_id})
	UpdateUser(w http.ResponseWriter, r *http.Request, userID UserID)
	// Unlink a group from user
	// (DELETE /users/{user_id}/groups)
	DeleteUserFromGroup(w http.ResponseWriter, r *http.Request, userID UserID)
	// Fetch all groups attached to user
	// (GET /users/{user_id}/groups)
	ListUserGroups(w http.ResponseWriter, r *http.Request, userID UserID, params ListUserGroupsParams)
	// Attach a group to user
	// (POST /users/{user_id}/groups)
	AttachUserToGroup(w http.ResponseWriter, r *http.Request, userID UserID)
	// Update group perms for user
	// (PUT /users/{user_id}/groups)
	PermitUserGroup(w http.ResponseWriter, r *http.Request, userID UserID)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandlerFunc   func(w http.ResponseWriter, r *http.Request, err error)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) AttachGroupToUser

func (siw *ServerInterfaceWrapper) AttachGroupToUser(w http.ResponseWriter, r *http.Request)

AttachGroupToUser operation middleware

func (*ServerInterfaceWrapper) AttachUserToGroup

func (siw *ServerInterfaceWrapper) AttachUserToGroup(w http.ResponseWriter, r *http.Request)

AttachUserToGroup operation middleware

func (*ServerInterfaceWrapper) CallbackProvider

func (siw *ServerInterfaceWrapper) CallbackProvider(w http.ResponseWriter, r *http.Request)

CallbackProvider operation middleware

func (*ServerInterfaceWrapper) CreateGroup

func (siw *ServerInterfaceWrapper) CreateGroup(w http.ResponseWriter, r *http.Request)

CreateGroup operation middleware

func (*ServerInterfaceWrapper) CreateUser

func (siw *ServerInterfaceWrapper) CreateUser(w http.ResponseWriter, r *http.Request)

CreateUser operation middleware

func (*ServerInterfaceWrapper) DeleteGroup

func (siw *ServerInterfaceWrapper) DeleteGroup(w http.ResponseWriter, r *http.Request)

DeleteGroup operation middleware

func (*ServerInterfaceWrapper) DeleteGroupFromUser

func (siw *ServerInterfaceWrapper) DeleteGroupFromUser(w http.ResponseWriter, r *http.Request)

DeleteGroupFromUser operation middleware

func (*ServerInterfaceWrapper) DeleteUser

func (siw *ServerInterfaceWrapper) DeleteUser(w http.ResponseWriter, r *http.Request)

DeleteUser operation middleware

func (*ServerInterfaceWrapper) DeleteUserFromGroup

func (siw *ServerInterfaceWrapper) DeleteUserFromGroup(w http.ResponseWriter, r *http.Request)

DeleteUserFromGroup operation middleware

func (*ServerInterfaceWrapper) ListGroupUsers

func (siw *ServerInterfaceWrapper) ListGroupUsers(w http.ResponseWriter, r *http.Request)

ListGroupUsers operation middleware

func (*ServerInterfaceWrapper) ListGroups

func (siw *ServerInterfaceWrapper) ListGroups(w http.ResponseWriter, r *http.Request)

ListGroups operation middleware

func (*ServerInterfaceWrapper) ListProviders

func (siw *ServerInterfaceWrapper) ListProviders(w http.ResponseWriter, r *http.Request)

ListProviders operation middleware

func (*ServerInterfaceWrapper) ListUserGroups

func (siw *ServerInterfaceWrapper) ListUserGroups(w http.ResponseWriter, r *http.Request)

ListUserGroups operation middleware

func (*ServerInterfaceWrapper) ListUsers

func (siw *ServerInterfaceWrapper) ListUsers(w http.ResponseWriter, r *http.Request)

ListUsers operation middleware

func (*ServerInterfaceWrapper) LoginAuth

func (siw *ServerInterfaceWrapper) LoginAuth(w http.ResponseWriter, r *http.Request)

LoginAuth operation middleware

func (*ServerInterfaceWrapper) PermitGroupUser

func (siw *ServerInterfaceWrapper) PermitGroupUser(w http.ResponseWriter, r *http.Request)

PermitGroupUser operation middleware

func (*ServerInterfaceWrapper) PermitUserGroup

func (siw *ServerInterfaceWrapper) PermitUserGroup(w http.ResponseWriter, r *http.Request)

PermitUserGroup operation middleware

func (*ServerInterfaceWrapper) RedirectAuth

func (siw *ServerInterfaceWrapper) RedirectAuth(w http.ResponseWriter, r *http.Request)

RedirectAuth operation middleware

func (*ServerInterfaceWrapper) RefreshAuth

func (siw *ServerInterfaceWrapper) RefreshAuth(w http.ResponseWriter, r *http.Request)

RefreshAuth operation middleware

func (*ServerInterfaceWrapper) RequestProvider

func (siw *ServerInterfaceWrapper) RequestProvider(w http.ResponseWriter, r *http.Request)

RequestProvider operation middleware

func (*ServerInterfaceWrapper) ShowGroup

func (siw *ServerInterfaceWrapper) ShowGroup(w http.ResponseWriter, r *http.Request)

ShowGroup operation middleware

func (*ServerInterfaceWrapper) ShowProfile

func (siw *ServerInterfaceWrapper) ShowProfile(w http.ResponseWriter, r *http.Request)

ShowProfile operation middleware

func (*ServerInterfaceWrapper) ShowUser

func (siw *ServerInterfaceWrapper) ShowUser(w http.ResponseWriter, r *http.Request)

ShowUser operation middleware

func (*ServerInterfaceWrapper) TokenProfile

func (siw *ServerInterfaceWrapper) TokenProfile(w http.ResponseWriter, r *http.Request)

TokenProfile operation middleware

func (*ServerInterfaceWrapper) UpdateGroup

func (siw *ServerInterfaceWrapper) UpdateGroup(w http.ResponseWriter, r *http.Request)

UpdateGroup operation middleware

func (*ServerInterfaceWrapper) UpdateProfile

func (siw *ServerInterfaceWrapper) UpdateProfile(w http.ResponseWriter, r *http.Request)

UpdateProfile operation middleware

func (*ServerInterfaceWrapper) UpdateUser

func (siw *ServerInterfaceWrapper) UpdateUser(w http.ResponseWriter, r *http.Request)

UpdateUser operation middleware

func (*ServerInterfaceWrapper) VerifyAuth

func (siw *ServerInterfaceWrapper) VerifyAuth(w http.ResponseWriter, r *http.Request)

VerifyAuth operation middleware

type SortColumnParam

type SortColumnParam = string

SortColumnParam defines model for SortColumnParam.

type SortOrderParam

type SortOrderParam string

SortOrderParam defines model for SortOrderParam.

const (
	SortOrderParamAsc  SortOrderParam = "asc"
	SortOrderParamDesc SortOrderParam = "desc"
)

Defines values for SortOrderParam.

type SuccessMessage

type SuccessMessage = Notification

SuccessMessage Generic response for errors and validations

type TokenResponse

type TokenResponse = AuthToken

TokenResponse defines model for TokenResponse.

type TooManyValuesForParamError

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (*TooManyValuesForParamError) Error

type UnescapedCookieParamError

type UnescapedCookieParamError struct {
	ParamName string
	Err       error
}

func (*UnescapedCookieParamError) Error

func (e *UnescapedCookieParamError) Error() string

func (*UnescapedCookieParamError) Unwrap

func (e *UnescapedCookieParamError) Unwrap() error

type Unimplemented

type Unimplemented struct{}

func (Unimplemented) AttachGroupToUser

func (_ Unimplemented) AttachGroupToUser(w http.ResponseWriter, r *http.Request, groupID GroupID)

Attach a user to group (POST /groups/{group_id}/users)

func (Unimplemented) AttachUserToGroup

func (_ Unimplemented) AttachUserToGroup(w http.ResponseWriter, r *http.Request, userID UserID)

Attach a group to user (POST /users/{user_id}/groups)

func (Unimplemented) CallbackProvider

func (_ Unimplemented) CallbackProvider(w http.ResponseWriter, r *http.Request, provider AuthProviderParam, params CallbackProviderParams)

Callback to parse the defined provider (GET /auth/{provider}/callback)

func (Unimplemented) CreateGroup

func (_ Unimplemented) CreateGroup(w http.ResponseWriter, r *http.Request)

Create a new group (POST /groups)

func (Unimplemented) CreateUser

func (_ Unimplemented) CreateUser(w http.ResponseWriter, r *http.Request)

Create a new user (POST /users)

func (Unimplemented) DeleteGroup

func (_ Unimplemented) DeleteGroup(w http.ResponseWriter, r *http.Request, groupID GroupID)

Delete a specific group (DELETE /groups/{group_id})

func (Unimplemented) DeleteGroupFromUser

func (_ Unimplemented) DeleteGroupFromUser(w http.ResponseWriter, r *http.Request, groupID GroupID)

Unlink a user from group (DELETE /groups/{group_id}/users)

func (Unimplemented) DeleteUser

func (_ Unimplemented) DeleteUser(w http.ResponseWriter, r *http.Request, userID UserID)

Delete a specific user (DELETE /users/{user_id})

func (Unimplemented) DeleteUserFromGroup

func (_ Unimplemented) DeleteUserFromGroup(w http.ResponseWriter, r *http.Request, userID UserID)

Unlink a group from user (DELETE /users/{user_id}/groups)

func (Unimplemented) ListGroupUsers

func (_ Unimplemented) ListGroupUsers(w http.ResponseWriter, r *http.Request, groupID GroupID, params ListGroupUsersParams)

Fetch all users attached to group (GET /groups/{group_id}/users)

func (Unimplemented) ListGroups

func (_ Unimplemented) ListGroups(w http.ResponseWriter, r *http.Request, params ListGroupsParams)

Fetch all available groups (GET /groups)

func (Unimplemented) ListProviders

func (_ Unimplemented) ListProviders(w http.ResponseWriter, r *http.Request)

Fetch the available auth providers (GET /auth/providers)

func (Unimplemented) ListUserGroups

func (_ Unimplemented) ListUserGroups(w http.ResponseWriter, r *http.Request, userID UserID, params ListUserGroupsParams)

Fetch all groups attached to user (GET /users/{user_id}/groups)

func (Unimplemented) ListUsers

func (_ Unimplemented) ListUsers(w http.ResponseWriter, r *http.Request, params ListUsersParams)

Fetch all available users (GET /users)

func (Unimplemented) LoginAuth

func (_ Unimplemented) LoginAuth(w http.ResponseWriter, r *http.Request)

Authenticate an user by credentials (POST /auth/login)

func (Unimplemented) PermitGroupUser

func (_ Unimplemented) PermitGroupUser(w http.ResponseWriter, r *http.Request, groupID GroupID)

Update user perms for group (PUT /groups/{group_id}/users)

func (Unimplemented) PermitUserGroup

func (_ Unimplemented) PermitUserGroup(w http.ResponseWriter, r *http.Request, userID UserID)

Update group perms for user (PUT /users/{user_id}/groups)

func (Unimplemented) RedirectAuth

func (_ Unimplemented) RedirectAuth(w http.ResponseWriter, r *http.Request)

Retrieve real token after redirect (POST /auth/redirect)

func (Unimplemented) RefreshAuth

func (_ Unimplemented) RefreshAuth(w http.ResponseWriter, r *http.Request)

Refresh an auth token before it expires (GET /auth/refresh)

func (Unimplemented) RequestProvider

func (_ Unimplemented) RequestProvider(w http.ResponseWriter, r *http.Request, provider AuthProviderParam)

Request the redirect to defined provider (GET /auth/{provider}/request)

func (Unimplemented) ShowGroup

func (_ Unimplemented) ShowGroup(w http.ResponseWriter, r *http.Request, groupID GroupID)

Fetch a specific group (GET /groups/{group_id})

func (Unimplemented) ShowProfile

func (_ Unimplemented) ShowProfile(w http.ResponseWriter, r *http.Request)

Fetch profile details of the personal account (GET /profile/self)

func (Unimplemented) ShowUser

func (_ Unimplemented) ShowUser(w http.ResponseWriter, r *http.Request, userID UserID)

Fetch a specific user (GET /users/{user_id})

func (Unimplemented) TokenProfile

func (_ Unimplemented) TokenProfile(w http.ResponseWriter, r *http.Request)

Retrieve an unlimited auth token (GET /profile/token)

func (Unimplemented) UpdateGroup

func (_ Unimplemented) UpdateGroup(w http.ResponseWriter, r *http.Request, groupID GroupID)

Update a specific group (PUT /groups/{group_id})

func (Unimplemented) UpdateProfile

func (_ Unimplemented) UpdateProfile(w http.ResponseWriter, r *http.Request)

Update your own profile information (PUT /profile/self)

func (Unimplemented) UpdateUser

func (_ Unimplemented) UpdateUser(w http.ResponseWriter, r *http.Request, userID UserID)

Update a specific user (PUT /users/{user_id})

func (Unimplemented) VerifyAuth

func (_ Unimplemented) VerifyAuth(w http.ResponseWriter, r *http.Request)

Verify validity for an authentication token (GET /auth/verify)

type UnmarshalingParamError

type UnmarshalingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshalingParamError) Error

func (e *UnmarshalingParamError) Error() string

func (*UnmarshalingParamError) Unwrap

func (e *UnmarshalingParamError) Unwrap() error

type UpdateGroupBody

type UpdateGroupBody struct {
	Name *string `json:"name,omitempty"`
	Slug *string `json:"slug,omitempty"`
}

UpdateGroupBody defines model for UpdateGroupBody.

type UpdateGroupJSONBody

type UpdateGroupJSONBody struct {
	Name *string `json:"name,omitempty"`
	Slug *string `json:"slug,omitempty"`
}

UpdateGroupJSONBody defines parameters for UpdateGroup.

type UpdateGroupJSONRequestBody

type UpdateGroupJSONRequestBody UpdateGroupJSONBody

UpdateGroupJSONRequestBody defines body for UpdateGroup for application/json ContentType.

type UpdateProfileBody

type UpdateProfileBody struct {
	Email    *string `json:"email,omitempty"`
	Fullname *string `json:"fullname,omitempty"`
	Password *string `json:"password,omitempty"`
	Username *string `json:"username,omitempty"`
}

UpdateProfileBody defines model for UpdateProfileBody.

type UpdateProfileJSONBody

type UpdateProfileJSONBody struct {
	Email    *string `json:"email,omitempty"`
	Fullname *string `json:"fullname,omitempty"`
	Password *string `json:"password,omitempty"`
	Username *string `json:"username,omitempty"`
}

UpdateProfileJSONBody defines parameters for UpdateProfile.

type UpdateProfileJSONRequestBody

type UpdateProfileJSONRequestBody UpdateProfileJSONBody

UpdateProfileJSONRequestBody defines body for UpdateProfile for application/json ContentType.

type UpdateUserBody

type UpdateUserBody struct {
	Active   *bool   `json:"active,omitempty"`
	Admin    *bool   `json:"admin,omitempty"`
	Email    *string `json:"email,omitempty"`
	Fullname *string `json:"fullname,omitempty"`
	Password *string `json:"password,omitempty"`
	Username *string `json:"username,omitempty"`
}

UpdateUserBody defines model for UpdateUserBody.

type UpdateUserJSONBody

type UpdateUserJSONBody struct {
	Active   *bool   `json:"active,omitempty"`
	Admin    *bool   `json:"admin,omitempty"`
	Email    *string `json:"email,omitempty"`
	Fullname *string `json:"fullname,omitempty"`
	Password *string `json:"password,omitempty"`
	Username *string `json:"username,omitempty"`
}

UpdateUserJSONBody defines parameters for UpdateUser.

type UpdateUserJSONRequestBody

type UpdateUserJSONRequestBody UpdateUserJSONBody

UpdateUserJSONRequestBody defines body for UpdateUser for application/json ContentType.

type User

type User struct {
	Active    *bool       `json:"active,omitempty"`
	Admin     *bool       `json:"admin,omitempty"`
	Auths     *[]UserAuth `json:"auths,omitempty"`
	CreatedAt *time.Time  `json:"created_at,omitempty"`
	Email     *string     `json:"email,omitempty"`
	Fullname  *string     `json:"fullname,omitempty"`
	ID        *string     `json:"id,omitempty"`
	Password  *string     `json:"password,omitempty"`
	Profile   *string     `json:"profile,omitempty"`
	UpdatedAt *time.Time  `json:"updated_at,omitempty"`
	Username  *string     `json:"username,omitempty"`
}

User Model to represent user

type UserAuth

type UserAuth struct {
	CreatedAt *time.Time `json:"created_at,omitempty"`
	Provider  *string    `json:"provider,omitempty"`
	Ref       *string    `json:"ref,omitempty"`
	UpdatedAt *time.Time `json:"updated_at,omitempty"`
}

UserAuth Model to represent user auth

type UserGroup

type UserGroup struct {
	CreatedAt *time.Time `json:"created_at,omitempty"`

	// Group Model to represent group
	Group     *Group         `json:"group,omitempty"`
	GroupID   string         `json:"group_id"`
	Perm      *UserGroupPerm `json:"perm,omitempty"`
	UpdatedAt *time.Time     `json:"updated_at,omitempty"`

	// User Model to represent user
	User   *User  `json:"user,omitempty"`
	UserID string `json:"user_id"`
}

UserGroup Model to represent user group

type UserGroupDropBody

type UserGroupDropBody struct {
	Group string `json:"group"`
}

UserGroupDropBody defines model for UserGroupDropBody.

type UserGroupPerm

type UserGroupPerm string

UserGroupPerm defines model for UserGroup.Perm.

const (
	UserGroupPermAdmin UserGroupPerm = "admin"
	UserGroupPermOwner UserGroupPerm = "owner"
	UserGroupPermUser  UserGroupPerm = "user"
)

Defines values for UserGroupPerm.

type UserGroupPermBody

type UserGroupPermBody struct {
	Group string `json:"group"`
	Perm  string `json:"perm"`
}

UserGroupPermBody defines model for UserGroupPermBody.

type UserGroupsResponse

type UserGroupsResponse struct {
	Groups []UserGroup `json:"groups"`
	Limit  int64       `json:"limit"`
	Offset int64       `json:"offset"`
	Total  int64       `json:"total"`

	// User Model to represent user
	User *User `json:"user,omitempty"`
}

UserGroupsResponse defines model for UserGroupsResponse.

type UserID

type UserID = string

UserID defines model for UserParam.

type UserResponse

type UserResponse = User

UserResponse Model to represent user

type UsersResponse

type UsersResponse struct {
	Limit  int64  `json:"limit"`
	Offset int64  `json:"offset"`
	Total  int64  `json:"total"`
	Users  []User `json:"users"`
}

UsersResponse defines model for UsersResponse.

type Validation

type Validation struct {
	Field   *string `json:"field,omitempty"`
	Message *string `json:"message,omitempty"`
}

Validation General structure to show validation errors

type ValidationError

type ValidationError = Notification

ValidationError Generic response for errors and validations

type VerifyResponse

type VerifyResponse = AuthVerify

VerifyResponse defines model for VerifyResponse.

Jump to

Keyboard shortcuts

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