users

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

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

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

Index

Constants

View Source
const (
	APITokenScopes   = "APIToken.Scopes"
	BearerAuthScopes = "BearerAuth.Scopes"
)

Variables

This section is empty.

Functions

func NewGetSelfRequest

func NewGetSelfRequest(server string, params *GetSelfParams) (*http.Request, error)

NewGetSelfRequest generates requests for GetSelf

func NewGetUserRequest

func NewGetUserRequest(server string, orgId openapi_types.UUID, id openapi_types.UUID, params *GetUserParams) (*http.Request, error)

NewGetUserRequest generates requests for GetUser

func NewGetUserSettingsRequest

func NewGetUserSettingsRequest(server string, params *GetUserSettingsParams) (*http.Request, error)

NewGetUserSettingsRequest generates requests for GetUserSettings

func NewUpdateUserRequest

func NewUpdateUserRequest(server string, groupId openapi_types.UUID, id openapi_types.UUID, params *UpdateUserParams, body UpdateUserJSONRequestBody) (*http.Request, error)

NewUpdateUserRequest calls the generic UpdateUser builder with application/vnd.api+json body

func NewUpdateUserRequestWithBody

func NewUpdateUserRequestWithBody(server string, groupId openapi_types.UUID, id openapi_types.UUID, params *UpdateUserParams, contentType string, body io.Reader) (*http.Request, error)

NewUpdateUserRequestWithBody generates requests for UpdateUser with any type of body

Types

type ActualVersion

type ActualVersion = string

ActualVersion Resolved API version

type AppInstance

type AppInstance struct {
	// DefaultOrgContext ID of the default org for the service account.
	DefaultOrgContext *openapi_types.UUID `json:"default_org_context,omitempty"`

	// Name The name of the service account.
	Name string `json:"name"`
}

AppInstance defines model for AppInstance.

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

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

func (*Client) GetUser

func (c *Client) GetUser(ctx context.Context, orgId openapi_types.UUID, id openapi_types.UUID, params *GetUserParams, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetUserSettings

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

func (*Client) UpdateUser

func (c *Client) UpdateUser(ctx context.Context, groupId openapi_types.UUID, id openapi_types.UUID, params *UpdateUserParams, body UpdateUserJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) UpdateUserWithBody

func (c *Client) UpdateUserWithBody(ctx context.Context, groupId openapi_types.UUID, id openapi_types.UUID, params *UpdateUserParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

type ClientInterface

type ClientInterface interface {
	// UpdateUser request with any body
	UpdateUserWithBody(ctx context.Context, groupId openapi_types.UUID, id openapi_types.UUID, params *UpdateUserParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	UpdateUser(ctx context.Context, groupId openapi_types.UUID, id openapi_types.UUID, params *UpdateUserParams, body UpdateUserJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetUser request
	GetUser(ctx context.Context, orgId openapi_types.UUID, id openapi_types.UUID, params *GetUserParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetSelf request
	GetSelf(ctx context.Context, params *GetSelfParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetUserSettings request
	GetUserSettings(ctx context.Context, params *GetUserSettingsParams, 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) GetSelfWithResponse

func (c *ClientWithResponses) GetSelfWithResponse(ctx context.Context, params *GetSelfParams, reqEditors ...RequestEditorFn) (*GetSelfResponse, error)

GetSelfWithResponse request returning *GetSelfResponse

func (*ClientWithResponses) GetUserSettingsWithResponse

func (c *ClientWithResponses) GetUserSettingsWithResponse(ctx context.Context, params *GetUserSettingsParams, reqEditors ...RequestEditorFn) (*GetUserSettingsResponse, error)

GetUserSettingsWithResponse request returning *GetUserSettingsResponse

func (*ClientWithResponses) GetUserWithResponse

func (c *ClientWithResponses) GetUserWithResponse(ctx context.Context, orgId openapi_types.UUID, id openapi_types.UUID, params *GetUserParams, reqEditors ...RequestEditorFn) (*GetUserResponse, error)

GetUserWithResponse request returning *GetUserResponse

func (*ClientWithResponses) UpdateUserWithBodyWithResponse

func (c *ClientWithResponses) UpdateUserWithBodyWithResponse(ctx context.Context, groupId openapi_types.UUID, id openapi_types.UUID, params *UpdateUserParams, 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, groupId openapi_types.UUID, id openapi_types.UUID, params *UpdateUserParams, body UpdateUserJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateUserResponse, error)

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// UpdateUser request with any body
	UpdateUserWithBodyWithResponse(ctx context.Context, groupId openapi_types.UUID, id openapi_types.UUID, params *UpdateUserParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateUserResponse, error)

	UpdateUserWithResponse(ctx context.Context, groupId openapi_types.UUID, id openapi_types.UUID, params *UpdateUserParams, body UpdateUserJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateUserResponse, error)

	// GetUser request
	GetUserWithResponse(ctx context.Context, orgId openapi_types.UUID, id openapi_types.UUID, params *GetUserParams, reqEditors ...RequestEditorFn) (*GetUserResponse, error)

	// GetSelf request
	GetSelfWithResponse(ctx context.Context, params *GetSelfParams, reqEditors ...RequestEditorFn) (*GetSelfResponse, error)

	// GetUserSettings request
	GetUserSettingsWithResponse(ctx context.Context, params *GetUserSettingsParams, reqEditors ...RequestEditorFn) (*GetUserSettingsResponse, error)
}

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

type Error

type Error struct {
	// Code An application-specific error code, expressed as a string value.
	Code *string `json:"code,omitempty"`

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

	// Id A unique identifier for this particular occurrence of the problem.
	Id *openapi_types.UUID `json:"id,omitempty"`

	// Links A link that leads to further details about this particular occurrance of the problem.
	Links  *ErrorLink              `json:"links,omitempty"`
	Meta   *map[string]interface{} `json:"meta,omitempty"`
	Source *struct {
		// Parameter A string indicating which URI query parameter caused the error.
		Parameter *string `json:"parameter,omitempty"`

		// Pointer A JSON Pointer [RFC6901] to the associated entity in the request document.
		Pointer *string `json:"pointer,omitempty"`
	} `json:"source,omitempty"`

	// Status The HTTP status code applicable to this problem, expressed as a string value.
	Status string `json:"status"`

	// Title A short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization.
	Title *string `json:"title,omitempty"`
}

Error defines model for Error.

type ErrorDocument

type ErrorDocument struct {
	Errors  []Error `json:"errors"`
	Jsonapi JsonApi `json:"jsonapi"`
}

ErrorDocument defines model for ErrorDocument.

type ErrorLink struct {
	About *LinkProperty `json:"about,omitempty"`
}

ErrorLink A link that leads to further details about this particular occurrance of the problem.

type GetSelfParams

type GetSelfParams struct {
	// Version The requested version of the endpoint to process the request
	Version Version `form:"version" json:"version"`
}

GetSelfParams defines parameters for GetSelf.

type GetSelfResponse

type GetSelfResponse struct {
	Body         []byte
	HTTPResponse *http.Response
}

func ParseGetSelfResponse

func ParseGetSelfResponse(rsp *http.Response) (*GetSelfResponse, error)

ParseGetSelfResponse parses an HTTP response from a GetSelfWithResponse call

func (GetSelfResponse) Status

func (r GetSelfResponse) Status() string

Status returns HTTPResponse.Status

func (GetSelfResponse) StatusCode

func (r GetSelfResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetUserParams

type GetUserParams struct {
	// Version The requested version of the endpoint to process the request
	Version Version `form:"version" json:"version"`
}

GetUserParams defines parameters for GetUser.

type GetUserResponse

type GetUserResponse struct {
	Body         []byte
	HTTPResponse *http.Response
}

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 GetUserSettingsParams

type GetUserSettingsParams struct {
	// Version The requested version of the endpoint to process the request
	Version Version `form:"version" json:"version"`
}

GetUserSettingsParams defines parameters for GetUserSettings.

type GetUserSettingsResponse

type GetUserSettingsResponse struct {
	Body         []byte
	HTTPResponse *http.Response
}

func ParseGetUserSettingsResponse

func ParseGetUserSettingsResponse(rsp *http.Response) (*GetUserSettingsResponse, error)

ParseGetUserSettingsResponse parses an HTTP response from a GetUserSettingsWithResponse call

func (GetUserSettingsResponse) Status

func (r GetUserSettingsResponse) Status() string

Status returns HTTPResponse.Status

func (GetUserSettingsResponse) StatusCode

func (r GetUserSettingsResponse) 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 JsonApi

type JsonApi struct {
	// Version Version of the JSON API specification this server supports.
	Version string `json:"version"`
}

JsonApi defines model for JsonApi.

type LinkProperty

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

LinkProperty defines model for LinkProperty.

func (LinkProperty) AsLinkProperty0

func (t LinkProperty) AsLinkProperty0() (LinkProperty0, error)

AsLinkProperty0 returns the union data inside the LinkProperty as a LinkProperty0

func (LinkProperty) AsLinkProperty1

func (t LinkProperty) AsLinkProperty1() (LinkProperty1, error)

AsLinkProperty1 returns the union data inside the LinkProperty as a LinkProperty1

func (*LinkProperty) FromLinkProperty0

func (t *LinkProperty) FromLinkProperty0(v LinkProperty0) error

FromLinkProperty0 overwrites any union data inside the LinkProperty as the provided LinkProperty0

func (*LinkProperty) FromLinkProperty1

func (t *LinkProperty) FromLinkProperty1(v LinkProperty1) error

FromLinkProperty1 overwrites any union data inside the LinkProperty as the provided LinkProperty1

func (LinkProperty) MarshalJSON

func (t LinkProperty) MarshalJSON() ([]byte, error)

func (*LinkProperty) MergeLinkProperty0

func (t *LinkProperty) MergeLinkProperty0(v LinkProperty0) error

MergeLinkProperty0 performs a merge with any union data inside the LinkProperty, using the provided LinkProperty0

func (*LinkProperty) MergeLinkProperty1

func (t *LinkProperty) MergeLinkProperty1(v LinkProperty1) error

MergeLinkProperty1 performs a merge with any union data inside the LinkProperty, using the provided LinkProperty1

func (*LinkProperty) UnmarshalJSON

func (t *LinkProperty) UnmarshalJSON(b []byte) error

type LinkProperty0

type LinkProperty0 = string

LinkProperty0 A string containing the link’s URL.

type LinkProperty1

type LinkProperty1 struct {
	// Href A string containing the link’s URL.
	Href string `json:"href"`

	// Meta Free-form object that may contain non-standard information.
	Meta *Meta `json:"meta,omitempty"`
}

LinkProperty1 defines model for .

type Links struct {
	First   *LinkProperty `json:"first,omitempty"`
	Last    *LinkProperty `json:"last,omitempty"`
	Next    *LinkProperty `json:"next,omitempty"`
	Prev    *LinkProperty `json:"prev,omitempty"`
	Related *LinkProperty `json:"related,omitempty"`
	Self    *LinkProperty `json:"self,omitempty"`
}

Links defines model for Links.

type Meta

type Meta map[string]interface{}

Meta Free-form object that may contain non-standard information.

type Principal

type Principal struct {
	Attributes Principal_Attributes `json:"attributes"`

	// Id The Snyk ID corresponding to this user, service account or app
	Id openapi_types.UUID `json:"id"`

	// Type Content type.
	Type PrincipalType `json:"type"`
}

Principal defines model for Principal.

type PrincipalAttributes0

type PrincipalAttributes0 struct {
	// AvatarUrl The avatar url of the user.
	AvatarUrl string `json:"avatar_url"`

	// DefaultOrgContext ID of the default org for the user.
	DefaultOrgContext *openapi_types.UUID `json:"default_org_context,omitempty"`

	// Email The email of the user.
	Email string `json:"email"`

	// Name The name of the user.
	Name string `json:"name"`

	// Username The username of the user.
	Username *string `json:"username,omitempty"`
}

PrincipalAttributes0 defines model for .

type PrincipalType

type PrincipalType string

PrincipalType Content type.

const (
	PrincipalTypeAppInstance    PrincipalType = "app_instance"
	PrincipalTypeServiceAccount PrincipalType = "service_account"
	PrincipalTypeUser           PrincipalType = "user"
)

Defines values for PrincipalType.

type Principal_Attributes

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

Principal_Attributes defines model for Principal.Attributes.

func (Principal_Attributes) AsAppInstance

func (t Principal_Attributes) AsAppInstance() (AppInstance, error)

AsAppInstance returns the union data inside the Principal_Attributes as a AppInstance

func (Principal_Attributes) AsPrincipalAttributes0

func (t Principal_Attributes) AsPrincipalAttributes0() (PrincipalAttributes0, error)

AsPrincipalAttributes0 returns the union data inside the Principal_Attributes as a PrincipalAttributes0

func (Principal_Attributes) AsServiceAccount

func (t Principal_Attributes) AsServiceAccount() (ServiceAccount, error)

AsServiceAccount returns the union data inside the Principal_Attributes as a ServiceAccount

func (*Principal_Attributes) FromAppInstance

func (t *Principal_Attributes) FromAppInstance(v AppInstance) error

FromAppInstance overwrites any union data inside the Principal_Attributes as the provided AppInstance

func (*Principal_Attributes) FromPrincipalAttributes0

func (t *Principal_Attributes) FromPrincipalAttributes0(v PrincipalAttributes0) error

FromPrincipalAttributes0 overwrites any union data inside the Principal_Attributes as the provided PrincipalAttributes0

func (*Principal_Attributes) FromServiceAccount

func (t *Principal_Attributes) FromServiceAccount(v ServiceAccount) error

FromServiceAccount overwrites any union data inside the Principal_Attributes as the provided ServiceAccount

func (Principal_Attributes) MarshalJSON

func (t Principal_Attributes) MarshalJSON() ([]byte, error)

func (*Principal_Attributes) MergeAppInstance

func (t *Principal_Attributes) MergeAppInstance(v AppInstance) error

MergeAppInstance performs a merge with any union data inside the Principal_Attributes, using the provided AppInstance

func (*Principal_Attributes) MergePrincipalAttributes0

func (t *Principal_Attributes) MergePrincipalAttributes0(v PrincipalAttributes0) error

MergePrincipalAttributes0 performs a merge with any union data inside the Principal_Attributes, using the provided PrincipalAttributes0

func (*Principal_Attributes) MergeServiceAccount

func (t *Principal_Attributes) MergeServiceAccount(v ServiceAccount) error

MergeServiceAccount performs a merge with any union data inside the Principal_Attributes, using the provided ServiceAccount

func (*Principal_Attributes) UnmarshalJSON

func (t *Principal_Attributes) UnmarshalJSON(b []byte) error

type QueryVersion

type QueryVersion = string

QueryVersion Requested API version

type RequestEditorFn

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

RequestEditorFn is the function signature for the RequestEditor callback function

type ServiceAccount

type ServiceAccount struct {
	// DefaultOrgContext ID of the default org for the service account.
	DefaultOrgContext *openapi_types.UUID `json:"default_org_context,omitempty"`

	// Name The name of the service account.
	Name string `json:"name"`
}

ServiceAccount defines model for ServiceAccount.

type UpdateUserJSONBody

type UpdateUserJSONBody struct {
	Data *struct {
		Attributes struct {
			Membership *struct {
				// Role Role name
				Role *string `json:"role,omitempty"`
			} `json:"membership"`
		} `json:"attributes"`

		// Id The Snyk ID corresponding to this user
		Id openapi_types.UUID `json:"id"`

		// Type Content type
		Type string `json:"type"`
	} `json:"data,omitempty"`
}

UpdateUserJSONBody defines parameters for UpdateUser.

type UpdateUserJSONRequestBody

type UpdateUserJSONRequestBody UpdateUserJSONBody

UpdateUserJSONRequestBody defines body for UpdateUser for application/vnd.api+json ContentType.

type UpdateUserParams

type UpdateUserParams struct {
	// Version The requested version of the endpoint to process the request
	Version Version `form:"version" json:"version"`
}

UpdateUserParams defines parameters for UpdateUser.

type UpdateUserResponse

type UpdateUserResponse struct {
	Body         []byte
	HTTPResponse *http.Response
}

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 {
	// AvatarUrl The avatar url of the user.
	AvatarUrl string `json:"avatar_url"`

	// DefaultOrgContext ID of the default org for the user.
	DefaultOrgContext *openapi_types.UUID `json:"default_org_context,omitempty"`

	// Email The email of the user.
	Email string `json:"email"`

	// Name The name of the user.
	Name string `json:"name"`

	// Username The username of the user.
	Username *string `json:"username,omitempty"`
}

User defines model for User.

type UserPreferredOrgSettings

type UserPreferredOrgSettings struct {
	// PreferredOrg The org to use for operations when there is no explicit org in context
	PreferredOrg *struct {
		// Id The id of the preferred org
		Id openapi_types.UUID `json:"id"`
	} `json:"preferred_org,omitempty"`
}

UserPreferredOrgSettings defines model for UserPreferredOrgSettings.

type UserSettings

type UserSettings struct {
	Attributes *UserSettings_Attributes `json:"attributes,omitempty"`

	// Id The id of the user
	Id openapi_types.UUID `json:"id"`

	// Type The resource type
	Type UserSettingsType `json:"type"`
}

UserSettings user settings

type UserSettingsType

type UserSettingsType string

UserSettingsType The resource type

const (
	UserSettingsTypeUserSettings UserSettingsType = "user_settings"
)

Defines values for UserSettingsType.

type UserSettings_Attributes

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

UserSettings_Attributes defines model for UserSettings.Attributes.

func (UserSettings_Attributes) AsUserPreferredOrgSettings

func (t UserSettings_Attributes) AsUserPreferredOrgSettings() (UserPreferredOrgSettings, error)

AsUserPreferredOrgSettings returns the union data inside the UserSettings_Attributes as a UserPreferredOrgSettings

func (*UserSettings_Attributes) FromUserPreferredOrgSettings

func (t *UserSettings_Attributes) FromUserPreferredOrgSettings(v UserPreferredOrgSettings) error

FromUserPreferredOrgSettings overwrites any union data inside the UserSettings_Attributes as the provided UserPreferredOrgSettings

func (UserSettings_Attributes) MarshalJSON

func (t UserSettings_Attributes) MarshalJSON() ([]byte, error)

func (*UserSettings_Attributes) MergeUserPreferredOrgSettings

func (t *UserSettings_Attributes) MergeUserPreferredOrgSettings(v UserPreferredOrgSettings) error

MergeUserPreferredOrgSettings performs a merge with any union data inside the UserSettings_Attributes, using the provided UserPreferredOrgSettings

func (*UserSettings_Attributes) UnmarshalJSON

func (t *UserSettings_Attributes) UnmarshalJSON(b []byte) error

type Version

type Version = QueryVersion

Version Requested API version

Jump to

Keyboard shortcuts

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