oas

package
v0.117.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithServerURL

func WithServerURL(ctx context.Context, u *url.URL) context.Context

WithServerURL sets context key to override server URL.

Types

type AcquireTelegramAccountOK

type AcquireTelegramAccountOK struct {
	AccountID TelegramAccountID `json:"account_id"`
	// Access token.
	Token uuid.UUID `json:"token"`
}

func (*AcquireTelegramAccountOK) Decode

func (s *AcquireTelegramAccountOK) Decode(d *jx.Decoder) error

Decode decodes AcquireTelegramAccountOK from json.

func (*AcquireTelegramAccountOK) Encode

func (s *AcquireTelegramAccountOK) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*AcquireTelegramAccountOK) GetAccountID

func (s *AcquireTelegramAccountOK) GetAccountID() TelegramAccountID

GetAccountID returns the value of AccountID.

func (*AcquireTelegramAccountOK) GetToken

func (s *AcquireTelegramAccountOK) GetToken() uuid.UUID

GetToken returns the value of Token.

func (*AcquireTelegramAccountOK) MarshalJSON

func (s *AcquireTelegramAccountOK) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*AcquireTelegramAccountOK) SetAccountID

func (s *AcquireTelegramAccountOK) SetAccountID(val TelegramAccountID)

SetAccountID sets the value of AccountID.

func (*AcquireTelegramAccountOK) SetToken

func (s *AcquireTelegramAccountOK) SetToken(val uuid.UUID)

SetToken sets the value of Token.

func (*AcquireTelegramAccountOK) UnmarshalJSON

func (s *AcquireTelegramAccountOK) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*AcquireTelegramAccountOK) Validate

func (s *AcquireTelegramAccountOK) Validate() error

type AcquireTelegramAccountReq

type AcquireTelegramAccountReq struct {
	// Repository owner.
	RepoOwner string `json:"repo_owner"`
	// Repository name.
	RepoName string `json:"repo_name"`
	// Job ID.
	Job        string `json:"job"`
	RunID      int64  `json:"run_id"`
	RunAttempt int    `json:"run_attempt"`
}

func (*AcquireTelegramAccountReq) Decode

func (s *AcquireTelegramAccountReq) Decode(d *jx.Decoder) error

Decode decodes AcquireTelegramAccountReq from json.

func (*AcquireTelegramAccountReq) Encode

func (s *AcquireTelegramAccountReq) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*AcquireTelegramAccountReq) GetJob

func (s *AcquireTelegramAccountReq) GetJob() string

GetJob returns the value of Job.

func (*AcquireTelegramAccountReq) GetRepoName

func (s *AcquireTelegramAccountReq) GetRepoName() string

GetRepoName returns the value of RepoName.

func (*AcquireTelegramAccountReq) GetRepoOwner

func (s *AcquireTelegramAccountReq) GetRepoOwner() string

GetRepoOwner returns the value of RepoOwner.

func (*AcquireTelegramAccountReq) GetRunAttempt

func (s *AcquireTelegramAccountReq) GetRunAttempt() int

GetRunAttempt returns the value of RunAttempt.

func (*AcquireTelegramAccountReq) GetRunID

func (s *AcquireTelegramAccountReq) GetRunID() int64

GetRunID returns the value of RunID.

func (*AcquireTelegramAccountReq) MarshalJSON

func (s *AcquireTelegramAccountReq) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*AcquireTelegramAccountReq) SetJob

func (s *AcquireTelegramAccountReq) SetJob(val string)

SetJob sets the value of Job.

func (*AcquireTelegramAccountReq) SetRepoName

func (s *AcquireTelegramAccountReq) SetRepoName(val string)

SetRepoName sets the value of RepoName.

func (*AcquireTelegramAccountReq) SetRepoOwner

func (s *AcquireTelegramAccountReq) SetRepoOwner(val string)

SetRepoOwner sets the value of RepoOwner.

func (*AcquireTelegramAccountReq) SetRunAttempt

func (s *AcquireTelegramAccountReq) SetRunAttempt(val int)

SetRunAttempt sets the value of RunAttempt.

func (*AcquireTelegramAccountReq) SetRunID

func (s *AcquireTelegramAccountReq) SetRunID(val int64)

SetRunID sets the value of RunID.

func (*AcquireTelegramAccountReq) UnmarshalJSON

func (s *AcquireTelegramAccountReq) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type Client

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

Client implements OAS client.

func NewClient

func NewClient(serverURL string, sec SecuritySource, opts ...ClientOption) (*Client, error)

NewClient initializes new Client defined by OAS.

func (*Client) AcquireTelegramAccount

func (c *Client) AcquireTelegramAccount(ctx context.Context, request *AcquireTelegramAccountReq) (*AcquireTelegramAccountOK, error)

AcquireTelegramAccount invokes acquireTelegramAccount operation.

Acquire telegram account.

POST /api/telegram/account/acquire

func (*Client) GetHealth

func (c *Client) GetHealth(ctx context.Context) (*Health, error)

GetHealth invokes getHealth operation.

Get health.

GET /api/health

func (*Client) HeartbeatTelegramAccount

func (c *Client) HeartbeatTelegramAccount(ctx context.Context, params HeartbeatTelegramAccountParams) error

HeartbeatTelegramAccount invokes heartbeatTelegramAccount operation.

Heartbeat telegram account.

GET /api/telegram/account/heartbeat/{token}

func (*Client) ReceiveTelegramCode

func (c *Client) ReceiveTelegramCode(ctx context.Context, params ReceiveTelegramCodeParams) (*ReceiveTelegramCodeOK, error)

ReceiveTelegramCode invokes receiveTelegramCode operation.

Receive telegram code.

GET /api/telegram/code/receive/{token}

type ClientOption

type ClientOption interface {
	// contains filtered or unexported methods
}

ClientOption is client config option.

func WithClient

func WithClient(client ht.Client) ClientOption

WithClient specifies http client to use.

type Error

type Error struct {
	// Human-readable error message.
	ErrorMessage string     `json:"error_message"`
	TraceID      OptTraceID `json:"trace_id"`
	SpanID       OptSpanID  `json:"span_id"`
}

Error occurred while processing request. Ref: #/components/schemas/Error

func (*Error) Decode

func (s *Error) Decode(d *jx.Decoder) error

Decode decodes Error from json.

func (*Error) Encode

func (s *Error) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*Error) GetErrorMessage

func (s *Error) GetErrorMessage() string

GetErrorMessage returns the value of ErrorMessage.

func (*Error) GetSpanID

func (s *Error) GetSpanID() OptSpanID

GetSpanID returns the value of SpanID.

func (*Error) GetTraceID

func (s *Error) GetTraceID() OptTraceID

GetTraceID returns the value of TraceID.

func (*Error) MarshalJSON

func (s *Error) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*Error) SetErrorMessage

func (s *Error) SetErrorMessage(val string)

SetErrorMessage sets the value of ErrorMessage.

func (*Error) SetSpanID

func (s *Error) SetSpanID(val OptSpanID)

SetSpanID sets the value of SpanID.

func (*Error) SetTraceID

func (s *Error) SetTraceID(val OptTraceID)

SetTraceID sets the value of TraceID.

func (*Error) UnmarshalJSON

func (s *Error) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*Error) Validate

func (s *Error) Validate() error

type ErrorStatusCode

type ErrorStatusCode struct {
	StatusCode int
	Response   Error
}

ErrorStatusCode wraps Error with StatusCode.

func (*ErrorStatusCode) Error

func (s *ErrorStatusCode) Error() string

func (*ErrorStatusCode) GetResponse

func (s *ErrorStatusCode) GetResponse() Error

GetResponse returns the value of Response.

func (*ErrorStatusCode) GetStatusCode

func (s *ErrorStatusCode) GetStatusCode() int

GetStatusCode returns the value of StatusCode.

func (*ErrorStatusCode) SetResponse

func (s *ErrorStatusCode) SetResponse(val Error)

SetResponse sets the value of Response.

func (*ErrorStatusCode) SetStatusCode

func (s *ErrorStatusCode) SetStatusCode(val int)

SetStatusCode sets the value of StatusCode.

func (*ErrorStatusCode) Validate

func (s *ErrorStatusCode) Validate() error

type Health

type Health struct {
	// Health status.
	Status string `json:"status"`
	// Service version.
	Version string `json:"version"`
	// Service commit.
	Commit string `json:"commit"`
	// Service build date.
	BuildDate time.Time `json:"build_date"`
}

Ref: #/components/schemas/Health

func (*Health) Decode

func (s *Health) Decode(d *jx.Decoder) error

Decode decodes Health from json.

func (*Health) Encode

func (s *Health) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*Health) GetBuildDate

func (s *Health) GetBuildDate() time.Time

GetBuildDate returns the value of BuildDate.

func (*Health) GetCommit

func (s *Health) GetCommit() string

GetCommit returns the value of Commit.

func (*Health) GetStatus

func (s *Health) GetStatus() string

GetStatus returns the value of Status.

func (*Health) GetVersion

func (s *Health) GetVersion() string

GetVersion returns the value of Version.

func (*Health) MarshalJSON

func (s *Health) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*Health) SetBuildDate

func (s *Health) SetBuildDate(val time.Time)

SetBuildDate sets the value of BuildDate.

func (*Health) SetCommit

func (s *Health) SetCommit(val string)

SetCommit sets the value of Commit.

func (*Health) SetStatus

func (s *Health) SetStatus(val string)

SetStatus sets the value of Status.

func (*Health) SetVersion

func (s *Health) SetVersion(val string)

SetVersion sets the value of Version.

func (*Health) UnmarshalJSON

func (s *Health) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type HeartbeatTelegramAccountOK

type HeartbeatTelegramAccountOK struct{}

HeartbeatTelegramAccountOK is response for HeartbeatTelegramAccount operation.

type HeartbeatTelegramAccountParams

type HeartbeatTelegramAccountParams struct {
	Token  uuid.UUID
	Forget OptBool
}

HeartbeatTelegramAccountParams is parameters of heartbeatTelegramAccount operation.

type Invoker

type Invoker interface {
	// AcquireTelegramAccount invokes acquireTelegramAccount operation.
	//
	// Acquire telegram account.
	//
	// POST /api/telegram/account/acquire
	AcquireTelegramAccount(ctx context.Context, request *AcquireTelegramAccountReq) (*AcquireTelegramAccountOK, error)
	// GetHealth invokes getHealth operation.
	//
	// Get health.
	//
	// GET /api/health
	GetHealth(ctx context.Context) (*Health, error)
	// HeartbeatTelegramAccount invokes heartbeatTelegramAccount operation.
	//
	// Heartbeat telegram account.
	//
	// GET /api/telegram/account/heartbeat/{token}
	HeartbeatTelegramAccount(ctx context.Context, params HeartbeatTelegramAccountParams) error
	// ReceiveTelegramCode invokes receiveTelegramCode operation.
	//
	// Receive telegram code.
	//
	// GET /api/telegram/code/receive/{token}
	ReceiveTelegramCode(ctx context.Context, params ReceiveTelegramCodeParams) (*ReceiveTelegramCodeOK, error)
}

Invoker invokes operations described by OpenAPI v3 specification.

type OperationName

type OperationName = string

OperationName is the ogen operation name

const (
	AcquireTelegramAccountOperation   OperationName = "AcquireTelegramAccount"
	GetHealthOperation                OperationName = "GetHealth"
	HeartbeatTelegramAccountOperation OperationName = "HeartbeatTelegramAccount"
	ReceiveTelegramCodeOperation      OperationName = "ReceiveTelegramCode"
)

type OptBool

type OptBool struct {
	Value bool
	Set   bool
}

OptBool is optional bool.

func NewOptBool

func NewOptBool(v bool) OptBool

NewOptBool returns new OptBool with value set to v.

func (OptBool) Get

func (o OptBool) Get() (v bool, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptBool) IsSet

func (o OptBool) IsSet() bool

IsSet returns true if OptBool was set.

func (OptBool) Or

func (o OptBool) Or(d bool) bool

Or returns value if set, or given parameter if does not.

func (*OptBool) Reset

func (o *OptBool) Reset()

Reset unsets value.

func (*OptBool) SetTo

func (o *OptBool) SetTo(v bool)

SetTo sets value to v.

type OptSpanID

type OptSpanID struct {
	Value SpanID
	Set   bool
}

OptSpanID is optional SpanID.

func NewOptSpanID

func NewOptSpanID(v SpanID) OptSpanID

NewOptSpanID returns new OptSpanID with value set to v.

func (*OptSpanID) Decode

func (o *OptSpanID) Decode(d *jx.Decoder) error

Decode decodes SpanID from json.

func (OptSpanID) Encode

func (o OptSpanID) Encode(e *jx.Encoder)

Encode encodes SpanID as json.

func (OptSpanID) Get

func (o OptSpanID) Get() (v SpanID, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptSpanID) IsSet

func (o OptSpanID) IsSet() bool

IsSet returns true if OptSpanID was set.

func (OptSpanID) MarshalJSON

func (s OptSpanID) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptSpanID) Or

func (o OptSpanID) Or(d SpanID) SpanID

Or returns value if set, or given parameter if does not.

func (*OptSpanID) Reset

func (o *OptSpanID) Reset()

Reset unsets value.

func (*OptSpanID) SetTo

func (o *OptSpanID) SetTo(v SpanID)

SetTo sets value to v.

func (*OptSpanID) UnmarshalJSON

func (s *OptSpanID) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type OptString

type OptString struct {
	Value string
	Set   bool
}

OptString is optional string.

func NewOptString

func NewOptString(v string) OptString

NewOptString returns new OptString with value set to v.

func (*OptString) Decode

func (o *OptString) Decode(d *jx.Decoder) error

Decode decodes string from json.

func (OptString) Encode

func (o OptString) Encode(e *jx.Encoder)

Encode encodes string as json.

func (OptString) Get

func (o OptString) Get() (v string, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptString) IsSet

func (o OptString) IsSet() bool

IsSet returns true if OptString was set.

func (OptString) MarshalJSON

func (s OptString) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptString) Or

func (o OptString) Or(d string) string

Or returns value if set, or given parameter if does not.

func (*OptString) Reset

func (o *OptString) Reset()

Reset unsets value.

func (*OptString) SetTo

func (o *OptString) SetTo(v string)

SetTo sets value to v.

func (*OptString) UnmarshalJSON

func (s *OptString) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type OptTraceID

type OptTraceID struct {
	Value TraceID
	Set   bool
}

OptTraceID is optional TraceID.

func NewOptTraceID

func NewOptTraceID(v TraceID) OptTraceID

NewOptTraceID returns new OptTraceID with value set to v.

func (*OptTraceID) Decode

func (o *OptTraceID) Decode(d *jx.Decoder) error

Decode decodes TraceID from json.

func (OptTraceID) Encode

func (o OptTraceID) Encode(e *jx.Encoder)

Encode encodes TraceID as json.

func (OptTraceID) Get

func (o OptTraceID) Get() (v TraceID, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptTraceID) IsSet

func (o OptTraceID) IsSet() bool

IsSet returns true if OptTraceID was set.

func (OptTraceID) MarshalJSON

func (s OptTraceID) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptTraceID) Or

func (o OptTraceID) Or(d TraceID) TraceID

Or returns value if set, or given parameter if does not.

func (*OptTraceID) Reset

func (o *OptTraceID) Reset()

Reset unsets value.

func (*OptTraceID) SetTo

func (o *OptTraceID) SetTo(v TraceID)

SetTo sets value to v.

func (*OptTraceID) UnmarshalJSON

func (s *OptTraceID) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type Option

type Option interface {
	ClientOption
}

Option is config option.

func WithMeterProvider

func WithMeterProvider(provider metric.MeterProvider) Option

WithMeterProvider specifies a meter provider to use for creating a meter.

If none is specified, the otel.GetMeterProvider() is used.

func WithTracerProvider

func WithTracerProvider(provider trace.TracerProvider) Option

WithTracerProvider specifies a tracer provider to use for creating a tracer.

If none is specified, the global provider is used.

type ReceiveTelegramCodeOK

type ReceiveTelegramCodeOK struct {
	// Code.
	Code OptString `json:"code"`
}

func (*ReceiveTelegramCodeOK) Decode

func (s *ReceiveTelegramCodeOK) Decode(d *jx.Decoder) error

Decode decodes ReceiveTelegramCodeOK from json.

func (*ReceiveTelegramCodeOK) Encode

func (s *ReceiveTelegramCodeOK) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*ReceiveTelegramCodeOK) GetCode

func (s *ReceiveTelegramCodeOK) GetCode() OptString

GetCode returns the value of Code.

func (*ReceiveTelegramCodeOK) MarshalJSON

func (s *ReceiveTelegramCodeOK) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*ReceiveTelegramCodeOK) SetCode

func (s *ReceiveTelegramCodeOK) SetCode(val OptString)

SetCode sets the value of Code.

func (*ReceiveTelegramCodeOK) UnmarshalJSON

func (s *ReceiveTelegramCodeOK) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*ReceiveTelegramCodeOK) Validate

func (s *ReceiveTelegramCodeOK) Validate() error

type ReceiveTelegramCodeParams

type ReceiveTelegramCodeParams struct {
	Token uuid.UUID
}

ReceiveTelegramCodeParams is parameters of receiveTelegramCode operation.

type SecuritySource

type SecuritySource interface {
	// TokenAuth provides tokenAuth security value.
	TokenAuth(ctx context.Context, operationName OperationName) (TokenAuth, error)
}

SecuritySource is provider of security values (tokens, passwords, etc.).

type SpanID

type SpanID string

func (*SpanID) Decode

func (s *SpanID) Decode(d *jx.Decoder) error

Decode decodes SpanID from json.

func (SpanID) Encode

func (s SpanID) Encode(e *jx.Encoder)

Encode encodes SpanID as json.

func (SpanID) MarshalJSON

func (s SpanID) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*SpanID) UnmarshalJSON

func (s *SpanID) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (SpanID) Validate

func (s SpanID) Validate() error

type TelegramAccountID

type TelegramAccountID string

func (*TelegramAccountID) Decode

func (s *TelegramAccountID) Decode(d *jx.Decoder) error

Decode decodes TelegramAccountID from json.

func (TelegramAccountID) Encode

func (s TelegramAccountID) Encode(e *jx.Encoder)

Encode encodes TelegramAccountID as json.

func (TelegramAccountID) MarshalJSON

func (s TelegramAccountID) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*TelegramAccountID) UnmarshalJSON

func (s *TelegramAccountID) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (TelegramAccountID) Validate

func (s TelegramAccountID) Validate() error

type TokenAuth

type TokenAuth struct {
	APIKey string
}

func (*TokenAuth) GetAPIKey

func (s *TokenAuth) GetAPIKey() string

GetAPIKey returns the value of APIKey.

func (*TokenAuth) SetAPIKey

func (s *TokenAuth) SetAPIKey(val string)

SetAPIKey sets the value of APIKey.

type TraceID

type TraceID string

func (*TraceID) Decode

func (s *TraceID) Decode(d *jx.Decoder) error

Decode decodes TraceID from json.

func (TraceID) Encode

func (s TraceID) Encode(e *jx.Encoder)

Encode encodes TraceID as json.

func (TraceID) MarshalJSON

func (s TraceID) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*TraceID) UnmarshalJSON

func (s *TraceID) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (TraceID) Validate

func (s TraceID) Validate() error

Jump to

Keyboard shortcuts

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