flags

package
v1.3.43 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

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

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

Index

Constants

View Source
const (
	HTTPBearerScopes = "HTTPBearer.Scopes"
)

Variables

This section is empty.

Functions

func NewCreateFlagRequestWithApplicationVndAPIPlusJSONBody added in v1.3.42

func NewCreateFlagRequestWithApplicationVndAPIPlusJSONBody(server string, body CreateFlagApplicationVndAPIPlusJSONRequestBody) (*http.Request, error)

NewCreateFlagRequestWithApplicationVndAPIPlusJSONBody calls the generic CreateFlag builder with application/vnd.api+json body

func NewCreateFlagRequestWithBody

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

NewCreateFlagRequestWithBody generates requests for CreateFlag with any type of body

func NewDeleteFlagRequest

func NewDeleteFlagRequest(server string, id string) (*http.Request, error)

NewDeleteFlagRequest generates requests for DeleteFlag

func NewGetFlagRequest

func NewGetFlagRequest(server string, id string) (*http.Request, error)

NewGetFlagRequest generates requests for GetFlag

func NewListFlagsRequest

func NewListFlagsRequest(server string, params *ListFlagsParams) (*http.Request, error)

NewListFlagsRequest generates requests for ListFlags

func NewListFlagsUsageRequest added in v1.3.36

func NewListFlagsUsageRequest(server string, params *ListFlagsUsageParams) (*http.Request, error)

NewListFlagsUsageRequest generates requests for ListFlagsUsage

func NewUpdateFlagRequestWithApplicationVndAPIPlusJSONBody added in v1.3.42

func NewUpdateFlagRequestWithApplicationVndAPIPlusJSONBody(server string, id string, body UpdateFlagApplicationVndAPIPlusJSONRequestBody) (*http.Request, error)

NewUpdateFlagRequestWithApplicationVndAPIPlusJSONBody calls the generic UpdateFlag builder with application/vnd.api+json body

func NewUpdateFlagRequestWithBody

func NewUpdateFlagRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error)

NewUpdateFlagRequestWithBody generates requests for UpdateFlag with any type of body

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) CreateFlagWithApplicationVndAPIPlusJSONBody added in v1.3.42

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

func (*Client) CreateFlagWithBody

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

func (*Client) DeleteFlag

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

func (*Client) GetFlag

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

func (*Client) ListFlags

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

func (*Client) ListFlagsUsage added in v1.3.36

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

func (*Client) UpdateFlagWithApplicationVndAPIPlusJSONBody added in v1.3.42

func (c *Client) UpdateFlagWithApplicationVndAPIPlusJSONBody(ctx context.Context, id string, body UpdateFlagApplicationVndAPIPlusJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) UpdateFlagWithBody

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

type ClientInterface

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

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

	CreateFlagWithApplicationVndAPIPlusJSONBody(ctx context.Context, body CreateFlagApplicationVndAPIPlusJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// DeleteFlag request
	DeleteFlag(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetFlag request
	GetFlag(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error)

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

	UpdateFlagWithApplicationVndAPIPlusJSONBody(ctx context.Context, id string, body UpdateFlagApplicationVndAPIPlusJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// ListFlagsUsage request
	ListFlagsUsage(ctx context.Context, params *ListFlagsUsageParams, 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) CreateFlagWithApplicationVndAPIPlusJSONBodyWithResponse added in v1.3.42

func (c *ClientWithResponses) CreateFlagWithApplicationVndAPIPlusJSONBodyWithResponse(ctx context.Context, body CreateFlagApplicationVndAPIPlusJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateFlagResponse, error)

func (*ClientWithResponses) CreateFlagWithBodyWithResponse

func (c *ClientWithResponses) CreateFlagWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateFlagResponse, error)

CreateFlagWithBodyWithResponse request with arbitrary body returning *CreateFlagResponse

func (*ClientWithResponses) DeleteFlagWithResponse

func (c *ClientWithResponses) DeleteFlagWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteFlagResponse, error)

DeleteFlagWithResponse request returning *DeleteFlagResponse

func (*ClientWithResponses) GetFlagWithResponse

func (c *ClientWithResponses) GetFlagWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetFlagResponse, error)

GetFlagWithResponse request returning *GetFlagResponse

func (*ClientWithResponses) ListFlagsUsageWithResponse added in v1.3.36

func (c *ClientWithResponses) ListFlagsUsageWithResponse(ctx context.Context, params *ListFlagsUsageParams, reqEditors ...RequestEditorFn) (*ListFlagsUsageResponse, error)

ListFlagsUsageWithResponse request returning *ListFlagsUsageResponse

func (*ClientWithResponses) ListFlagsWithResponse

func (c *ClientWithResponses) ListFlagsWithResponse(ctx context.Context, params *ListFlagsParams, reqEditors ...RequestEditorFn) (*ListFlagsResponse, error)

ListFlagsWithResponse request returning *ListFlagsResponse

func (*ClientWithResponses) UpdateFlagWithApplicationVndAPIPlusJSONBodyWithResponse added in v1.3.42

func (c *ClientWithResponses) UpdateFlagWithApplicationVndAPIPlusJSONBodyWithResponse(ctx context.Context, id string, body UpdateFlagApplicationVndAPIPlusJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateFlagResponse, error)

func (*ClientWithResponses) UpdateFlagWithBodyWithResponse

func (c *ClientWithResponses) UpdateFlagWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateFlagResponse, error)

UpdateFlagWithBodyWithResponse request with arbitrary body returning *UpdateFlagResponse

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// ListFlagsWithResponse request
	ListFlagsWithResponse(ctx context.Context, params *ListFlagsParams, reqEditors ...RequestEditorFn) (*ListFlagsResponse, error)

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

	CreateFlagWithApplicationVndAPIPlusJSONBodyWithResponse(ctx context.Context, body CreateFlagApplicationVndAPIPlusJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateFlagResponse, error)

	// DeleteFlagWithResponse request
	DeleteFlagWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteFlagResponse, error)

	// GetFlagWithResponse request
	GetFlagWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetFlagResponse, error)

	// UpdateFlagWithBodyWithResponse request with any body
	UpdateFlagWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateFlagResponse, error)

	UpdateFlagWithApplicationVndAPIPlusJSONBodyWithResponse(ctx context.Context, id string, body UpdateFlagApplicationVndAPIPlusJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateFlagResponse, error)

	// ListFlagsUsageWithResponse request
	ListFlagsUsageWithResponse(ctx context.Context, params *ListFlagsUsageParams, reqEditors ...RequestEditorFn) (*ListFlagsUsageResponse, error)
}

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

type CreateFlagApplicationVndAPIPlusJSONRequestBody added in v1.3.42

type CreateFlagApplicationVndAPIPlusJSONRequestBody = FlagResponse

CreateFlagApplicationVndAPIPlusJSONRequestBody defines body for CreateFlag for application/vnd.api+json ContentType.

type CreateFlagResponse

type CreateFlagResponse struct {
	Body                     []byte
	HTTPResponse             *http.Response
	ApplicationvndApiJSON201 *FlagResponse
}

func ParseCreateFlagResponse

func ParseCreateFlagResponse(rsp *http.Response) (*CreateFlagResponse, error)

ParseCreateFlagResponse parses an HTTP response from a CreateFlagWithResponse call

func (CreateFlagResponse) Status

func (r CreateFlagResponse) Status() string

Status returns HTTPResponse.Status

func (CreateFlagResponse) StatusCode

func (r CreateFlagResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type DeleteFlagResponse

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

func ParseDeleteFlagResponse

func ParseDeleteFlagResponse(rsp *http.Response) (*DeleteFlagResponse, error)

ParseDeleteFlagResponse parses an HTTP response from a DeleteFlagWithResponse call

func (DeleteFlagResponse) Status

func (r DeleteFlagResponse) Status() string

Status returns HTTPResponse.Status

func (DeleteFlagResponse) StatusCode

func (r DeleteFlagResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type Flag

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

	// Default Default value; must reference a value in the values array (constrained) or match the flag type (unconstrained)
	Default      interface{}                 `json:"default"`
	Description  *string                     `json:"description,omitempty"`
	Environments *map[string]FlagEnvironment `json:"environments,omitempty"`

	// Name Human-readable display name
	Name string `json:"name"`

	// Type Value type: STRING, BOOLEAN, NUMERIC, or JSON
	Type      string     `json:"type"`
	UpdatedAt *time.Time `json:"updated_at,omitempty"`

	// Values Ordered set of allowed values (constrained), or null (unconstrained)
	Values *[]FlagValue `json:"values,omitempty"`
}

Flag defines model for Flag.

type FlagEnvironment

type FlagEnvironment struct {
	Default interface{} `json:"default,omitempty"`
	Enabled *bool       `json:"enabled,omitempty"`
	Rules   *[]FlagRule `json:"rules,omitempty"`
}

FlagEnvironment defines model for FlagEnvironment.

type FlagListResponse

type FlagListResponse struct {
	Data []FlagResource `json:"data"`
}

FlagListResponse defines model for FlagListResponse.

type FlagResource

type FlagResource struct {
	Attributes Flag             `json:"attributes"`
	Id         *string          `json:"id,omitempty"`
	Type       FlagResourceType `json:"type"`
}

FlagResource defines model for FlagResource.

type FlagResourceType added in v1.3.1

type FlagResourceType string

FlagResourceType defines model for FlagResource.Type.

const (
	FlagResourceTypeFlag FlagResourceType = "flag"
)

Defines values for FlagResourceType.

func (FlagResourceType) Valid added in v1.3.1

func (e FlagResourceType) Valid() bool

Valid indicates whether the value is a known member of the FlagResourceType enum.

type FlagResponse

type FlagResponse struct {
	Data FlagResource `json:"data"`
}

FlagResponse defines model for FlagResponse.

type FlagRule

type FlagRule struct {
	Description *string                `json:"description,omitempty"`
	Logic       map[string]interface{} `json:"logic"`
	Value       interface{}            `json:"value"`
}

FlagRule defines model for FlagRule.

type FlagValue

type FlagValue struct {
	Name  string      `json:"name"`
	Value interface{} `json:"value"`
}

FlagValue defines model for FlagValue.

type GetFlagResponse

type GetFlagResponse struct {
	Body                     []byte
	HTTPResponse             *http.Response
	ApplicationvndApiJSON200 *FlagResponse
}

func ParseGetFlagResponse

func ParseGetFlagResponse(rsp *http.Response) (*GetFlagResponse, error)

ParseGetFlagResponse parses an HTTP response from a GetFlagWithResponse call

func (GetFlagResponse) Status

func (r GetFlagResponse) Status() string

Status returns HTTPResponse.Status

func (GetFlagResponse) StatusCode

func (r GetFlagResponse) 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 ListFlagsParams

type ListFlagsParams struct {
	FilterType *string `form:"filter[type],omitempty" json:"filter[type],omitempty"`
}

ListFlagsParams defines parameters for ListFlags.

type ListFlagsResponse

type ListFlagsResponse struct {
	Body                     []byte
	HTTPResponse             *http.Response
	ApplicationvndApiJSON200 *FlagListResponse
}

func ParseListFlagsResponse

func ParseListFlagsResponse(rsp *http.Response) (*ListFlagsResponse, error)

ParseListFlagsResponse parses an HTTP response from a ListFlagsWithResponse call

func (ListFlagsResponse) Status

func (r ListFlagsResponse) Status() string

Status returns HTTPResponse.Status

func (ListFlagsResponse) StatusCode

func (r ListFlagsResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type ListFlagsUsageParams added in v1.3.36

type ListFlagsUsageParams struct {
	FilterPeriod *string `form:"filter[period],omitempty" json:"filter[period],omitempty"`
}

ListFlagsUsageParams defines parameters for ListFlagsUsage.

type ListFlagsUsageResponse added in v1.3.36

type ListFlagsUsageResponse struct {
	Body                     []byte
	HTTPResponse             *http.Response
	ApplicationvndApiJSON200 *UsageListResponse
}

func ParseListFlagsUsageResponse added in v1.3.36

func ParseListFlagsUsageResponse(rsp *http.Response) (*ListFlagsUsageResponse, error)

ParseListFlagsUsageResponse parses an HTTP response from a ListFlagsUsageWithResponse call

func (ListFlagsUsageResponse) Status added in v1.3.36

func (r ListFlagsUsageResponse) Status() string

Status returns HTTPResponse.Status

func (ListFlagsUsageResponse) StatusCode added in v1.3.36

func (r ListFlagsUsageResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type RequestEditorFn

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

RequestEditorFn is the function signature for the RequestEditor callback function

type UpdateFlagApplicationVndAPIPlusJSONRequestBody added in v1.3.42

type UpdateFlagApplicationVndAPIPlusJSONRequestBody = FlagResponse

UpdateFlagApplicationVndAPIPlusJSONRequestBody defines body for UpdateFlag for application/vnd.api+json ContentType.

type UpdateFlagResponse

type UpdateFlagResponse struct {
	Body                     []byte
	HTTPResponse             *http.Response
	ApplicationvndApiJSON200 *FlagResponse
}

func ParseUpdateFlagResponse

func ParseUpdateFlagResponse(rsp *http.Response) (*UpdateFlagResponse, error)

ParseUpdateFlagResponse parses an HTTP response from a UpdateFlagWithResponse call

func (UpdateFlagResponse) Status

func (r UpdateFlagResponse) Status() string

Status returns HTTPResponse.Status

func (UpdateFlagResponse) StatusCode

func (r UpdateFlagResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type UsageAttributes added in v1.3.42

type UsageAttributes struct {
	LimitKey string `json:"limit_key"`
	Period   string `json:"period"`
	Value    int    `json:"value"`
}

UsageAttributes defines model for UsageAttributes.

type UsageListResponse added in v1.3.42

type UsageListResponse struct {
	Data []UsageResource `json:"data"`
}

UsageListResponse defines model for UsageListResponse.

type UsageResource added in v1.3.42

type UsageResource struct {
	Attributes UsageAttributes   `json:"attributes"`
	Id         string            `json:"id"`
	Type       UsageResourceType `json:"type"`
}

UsageResource defines model for UsageResource.

type UsageResourceType added in v1.3.42

type UsageResourceType string

UsageResourceType defines model for UsageResource.Type.

const (
	Usage UsageResourceType = "usage"
)

Defines values for UsageResourceType.

func (UsageResourceType) Valid added in v1.3.42

func (e UsageResourceType) Valid() bool

Valid indicates whether the value is a known member of the UsageResourceType enum.

Jump to

Keyboard shortcuts

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