Files
lincodex/backend/internal/adapter/secondary/ml/api/oas_schemas_gen.go
T

872 lines
25 KiB
Go

// Code generated by ogen, DO NOT EDIT.
package api
import (
"fmt"
"github.com/go-faster/errors"
)
func (s *ProblemStatusCode) Error() string {
return fmt.Sprintf("code %d: %+v", s.StatusCode, s.Response)
}
type BearerAuth struct {
Token string
Roles []string
}
// GetToken returns the value of Token.
func (s *BearerAuth) GetToken() string {
return s.Token
}
// GetRoles returns the value of Roles.
func (s *BearerAuth) GetRoles() []string {
return s.Roles
}
// SetToken sets the value of Token.
func (s *BearerAuth) SetToken(val string) {
s.Token = val
}
// SetRoles sets the value of Roles.
func (s *BearerAuth) SetRoles(val []string) {
s.Roles = val
}
type CreateMLEmbeddingsBadRequest ProblemStatusCode
func (*CreateMLEmbeddingsBadRequest) createMLEmbeddingsRes() {}
type CreateMLEmbeddingsRequestEntityTooLarge ProblemStatusCode
func (*CreateMLEmbeddingsRequestEntityTooLarge) createMLEmbeddingsRes() {}
type CreateMLEmbeddingsServiceUnavailable ProblemStatusCode
func (*CreateMLEmbeddingsServiceUnavailable) createMLEmbeddingsRes() {}
type CreateMLEmbeddingsUnauthorized ProblemStatusCode
func (*CreateMLEmbeddingsUnauthorized) createMLEmbeddingsRes() {}
// Side of the retrieval pair that the texts belong to. The service owns the prompt of each side, so
// callers never send model instructions.
//
// - query: the side that searches, such as a hiring need or one requirement of it. The service
// prepends the retrieval instruction of the model.
// - document: the side that is searched, such as a candidate card or one item of it. The service adds
// no prompt.
//
// Ref: #/components/schemas/EmbeddingInputKind
type EmbeddingInputKind string
const (
EmbeddingInputKindQuery EmbeddingInputKind = "query"
EmbeddingInputKindDocument EmbeddingInputKind = "document"
)
// AllValues returns all EmbeddingInputKind values.
func (EmbeddingInputKind) AllValues() []EmbeddingInputKind {
return []EmbeddingInputKind{
EmbeddingInputKindQuery,
EmbeddingInputKindDocument,
}
}
// MarshalText implements encoding.TextMarshaler.
func (s EmbeddingInputKind) MarshalText() ([]byte, error) {
switch s {
case EmbeddingInputKindQuery:
return []byte(s), nil
case EmbeddingInputKindDocument:
return []byte(s), nil
default:
return nil, errors.Errorf("invalid value: %q", s)
}
}
// UnmarshalText implements encoding.TextUnmarshaler.
func (s *EmbeddingInputKind) UnmarshalText(data []byte) error {
switch EmbeddingInputKind(data) {
case EmbeddingInputKindQuery:
*s = EmbeddingInputKindQuery
return nil
case EmbeddingInputKindDocument:
*s = EmbeddingInputKindDocument
return nil
default:
return errors.Errorf("invalid value: %q", data)
}
}
// The model that produced the vectors. A caller stores these values with every vector and never
// compares vectors of different models, revisions, or prompt versions.
// Ref: #/components/schemas/EmbeddingModel
type EmbeddingModel struct {
// Model repository identifier, for example ai-sage/Giga-Embeddings-instruct-480M-0826.
ID string `json:"id"`
// Pinned revision of the weights, a commit hash for a published model.
Revision string `json:"revision"`
// Length of every vector.
Dimension int32 `json:"dimension"`
// Token limit after which a text is truncated.
MaxTokens int32 `json:"max_tokens"`
// Version of the prompt and pooling recipe of the service. A change of the query instruction or the
// pooling changes it.
PromptVersion string `json:"prompt_version"`
}
// GetID returns the value of ID.
func (s *EmbeddingModel) GetID() string {
return s.ID
}
// GetRevision returns the value of Revision.
func (s *EmbeddingModel) GetRevision() string {
return s.Revision
}
// GetDimension returns the value of Dimension.
func (s *EmbeddingModel) GetDimension() int32 {
return s.Dimension
}
// GetMaxTokens returns the value of MaxTokens.
func (s *EmbeddingModel) GetMaxTokens() int32 {
return s.MaxTokens
}
// GetPromptVersion returns the value of PromptVersion.
func (s *EmbeddingModel) GetPromptVersion() string {
return s.PromptVersion
}
// SetID sets the value of ID.
func (s *EmbeddingModel) SetID(val string) {
s.ID = val
}
// SetRevision sets the value of Revision.
func (s *EmbeddingModel) SetRevision(val string) {
s.Revision = val
}
// SetDimension sets the value of Dimension.
func (s *EmbeddingModel) SetDimension(val int32) {
s.Dimension = val
}
// SetMaxTokens sets the value of MaxTokens.
func (s *EmbeddingModel) SetMaxTokens(val int32) {
s.MaxTokens = val
}
// SetPromptVersion sets the value of PromptVersion.
func (s *EmbeddingModel) SetPromptVersion(val string) {
s.PromptVersion = val
}
// Texts to encode in one call. The service encodes them in a fixed, deterministic way: texts are
// ordered by length with the request position as the tie-breaker, encoded in micro-batches of the
// configured size, and returned in request order. The same texts in the same request on the same
// installation, device, precision, and thread count give the same vectors.
// Ref: #/components/schemas/EmbeddingRequest
type EmbeddingRequest struct {
// Identifier of the model to use, as `EmbeddingModel.id` reports it. Absent means the default model of
// the service, the first one it is configured with. A service may load several models, for example the
// members of an ensemble; a model it does not serve answers 400 validation_failed with the pointer
// `/model`.
Model OptString `json:"model"`
Kind EmbeddingInputKind `json:"kind"`
Texts []EmbeddingText `json:"texts"`
}
// GetModel returns the value of Model.
func (s *EmbeddingRequest) GetModel() OptString {
return s.Model
}
// GetKind returns the value of Kind.
func (s *EmbeddingRequest) GetKind() EmbeddingInputKind {
return s.Kind
}
// GetTexts returns the value of Texts.
func (s *EmbeddingRequest) GetTexts() []EmbeddingText {
return s.Texts
}
// SetModel sets the value of Model.
func (s *EmbeddingRequest) SetModel(val OptString) {
s.Model = val
}
// SetKind sets the value of Kind.
func (s *EmbeddingRequest) SetKind(val EmbeddingInputKind) {
s.Kind = val
}
// SetTexts sets the value of Texts.
func (s *EmbeddingRequest) SetTexts(val []EmbeddingText) {
s.Texts = val
}
// Vectors in the order of the request texts.
// Ref: #/components/schemas/EmbeddingResponse
type EmbeddingResponse struct {
Model EmbeddingModel `json:"model"`
Kind EmbeddingInputKind `json:"kind"`
Vectors []EmbeddingVector `json:"vectors"`
}
// GetModel returns the value of Model.
func (s *EmbeddingResponse) GetModel() EmbeddingModel {
return s.Model
}
// GetKind returns the value of Kind.
func (s *EmbeddingResponse) GetKind() EmbeddingInputKind {
return s.Kind
}
// GetVectors returns the value of Vectors.
func (s *EmbeddingResponse) GetVectors() []EmbeddingVector {
return s.Vectors
}
// SetModel sets the value of Model.
func (s *EmbeddingResponse) SetModel(val EmbeddingModel) {
s.Model = val
}
// SetKind sets the value of Kind.
func (s *EmbeddingResponse) SetKind(val EmbeddingInputKind) {
s.Kind = val
}
// SetVectors sets the value of Vectors.
func (s *EmbeddingResponse) SetVectors(val []EmbeddingVector) {
s.Vectors = val
}
func (*EmbeddingResponse) createMLEmbeddingsRes() {}
type EmbeddingText string
type EmbeddingVector []float32
type GetMLReadyzOK MLReadinessResponse
func (*GetMLReadyzOK) getMLReadyzRes() {}
type GetMLReadyzServiceUnavailable MLReadinessResponse
func (*GetMLReadyzServiceUnavailable) getMLReadyzRes() {}
// Ref: #/components/schemas/MLHealthResponse
type MLHealthResponse struct {
Status MLHealthResponseStatus `json:"status"`
}
// GetStatus returns the value of Status.
func (s *MLHealthResponse) GetStatus() MLHealthResponseStatus {
return s.Status
}
// SetStatus sets the value of Status.
func (s *MLHealthResponse) SetStatus(val MLHealthResponseStatus) {
s.Status = val
}
type MLHealthResponseStatus string
const (
MLHealthResponseStatusOk MLHealthResponseStatus = "ok"
)
// AllValues returns all MLHealthResponseStatus values.
func (MLHealthResponseStatus) AllValues() []MLHealthResponseStatus {
return []MLHealthResponseStatus{
MLHealthResponseStatusOk,
}
}
// MarshalText implements encoding.TextMarshaler.
func (s MLHealthResponseStatus) MarshalText() ([]byte, error) {
switch s {
case MLHealthResponseStatusOk:
return []byte(s), nil
default:
return nil, errors.Errorf("invalid value: %q", s)
}
}
// UnmarshalText implements encoding.TextUnmarshaler.
func (s *MLHealthResponseStatus) UnmarshalText(data []byte) error {
switch MLHealthResponseStatus(data) {
case MLHealthResponseStatusOk:
*s = MLHealthResponseStatusOk
return nil
default:
return errors.Errorf("invalid value: %q", data)
}
}
// Ref: #/components/schemas/MLReadinessResponse
type MLReadinessResponse struct {
Status MLReadinessResponseStatus `json:"status"`
}
// GetStatus returns the value of Status.
func (s *MLReadinessResponse) GetStatus() MLReadinessResponseStatus {
return s.Status
}
// SetStatus sets the value of Status.
func (s *MLReadinessResponse) SetStatus(val MLReadinessResponseStatus) {
s.Status = val
}
type MLReadinessResponseStatus string
const (
MLReadinessResponseStatusReady MLReadinessResponseStatus = "ready"
MLReadinessResponseStatusNotReady MLReadinessResponseStatus = "not_ready"
)
// AllValues returns all MLReadinessResponseStatus values.
func (MLReadinessResponseStatus) AllValues() []MLReadinessResponseStatus {
return []MLReadinessResponseStatus{
MLReadinessResponseStatusReady,
MLReadinessResponseStatusNotReady,
}
}
// MarshalText implements encoding.TextMarshaler.
func (s MLReadinessResponseStatus) MarshalText() ([]byte, error) {
switch s {
case MLReadinessResponseStatusReady:
return []byte(s), nil
case MLReadinessResponseStatusNotReady:
return []byte(s), nil
default:
return nil, errors.Errorf("invalid value: %q", s)
}
}
// UnmarshalText implements encoding.TextUnmarshaler.
func (s *MLReadinessResponseStatus) UnmarshalText(data []byte) error {
switch MLReadinessResponseStatus(data) {
case MLReadinessResponseStatusReady:
*s = MLReadinessResponseStatusReady
return nil
case MLReadinessResponseStatusNotReady:
*s = MLReadinessResponseStatusNotReady
return nil
default:
return errors.Errorf("invalid value: %q", data)
}
}
// NewOptString returns new OptString with value set to v.
func NewOptString(v string) OptString {
return OptString{
Value: v,
Set: true,
}
}
// OptString is optional string.
type OptString struct {
Value string
Set bool
}
// IsSet returns true if OptString was set.
func (o OptString) IsSet() bool { return o.Set }
// Reset unsets value.
func (o *OptString) Reset() {
var v string
o.Value = v
o.Set = false
}
// SetTo sets value to v.
func (o *OptString) SetTo(v string) {
o.Set = true
o.Value = v
}
// Get returns value and boolean that denotes whether value was set.
func (o OptString) Get() (v string, ok bool) {
if !o.Set {
return v, false
}
return o.Value, true
}
// Or returns value if set, or given parameter if does not.
func (o OptString) Or(d string) string {
if v, ok := o.Get(); ok {
return v
}
return d
}
// Problem details (RFC 9457) returned with the application/problem+json media type for every error
// response. This is the ML service copy of the public api/core Problem schema; keep both copies
// identical except for descriptions. `code` is the stable, machine-readable reason; clients branch on
// it rather than on `title`, `detail`, or the HTTP status alone. The body never contains internal
// error text, stack traces, SQL, file paths, credentials, contact data, or echoed request values.
// Ref: #/components/schemas/Problem
type Problem struct {
// URI that identifies the problem type. It has the form `urn:lincodex:problem:<code>` and is an
// identifier, not a link to dereference.
Type string `json:"type"`
// Short, fixed English summary of the problem type. It does not change between occurrences.
Title string `json:"title"`
// HTTP status code generated by the origin server.
Status int32 `json:"status"`
Code ProblemCode `json:"code"`
// Safe English explanation of this occurrence. It never contains internal error text or request
// values.
Detail OptString `json:"detail"`
// URI reference that identifies this occurrence, when one exists.
Instance OptString `json:"instance"`
// Request identifier of the call when the caller propagated one; it is not a secret.
TraceID OptString `json:"trace_id"`
// Field-level reasons for validation_failed. Other codes omit it.
Errors []ProblemFieldError `json:"errors"`
}
// GetType returns the value of Type.
func (s *Problem) GetType() string {
return s.Type
}
// GetTitle returns the value of Title.
func (s *Problem) GetTitle() string {
return s.Title
}
// GetStatus returns the value of Status.
func (s *Problem) GetStatus() int32 {
return s.Status
}
// GetCode returns the value of Code.
func (s *Problem) GetCode() ProblemCode {
return s.Code
}
// GetDetail returns the value of Detail.
func (s *Problem) GetDetail() OptString {
return s.Detail
}
// GetInstance returns the value of Instance.
func (s *Problem) GetInstance() OptString {
return s.Instance
}
// GetTraceID returns the value of TraceID.
func (s *Problem) GetTraceID() OptString {
return s.TraceID
}
// GetErrors returns the value of Errors.
func (s *Problem) GetErrors() []ProblemFieldError {
return s.Errors
}
// SetType sets the value of Type.
func (s *Problem) SetType(val string) {
s.Type = val
}
// SetTitle sets the value of Title.
func (s *Problem) SetTitle(val string) {
s.Title = val
}
// SetStatus sets the value of Status.
func (s *Problem) SetStatus(val int32) {
s.Status = val
}
// SetCode sets the value of Code.
func (s *Problem) SetCode(val ProblemCode) {
s.Code = val
}
// SetDetail sets the value of Detail.
func (s *Problem) SetDetail(val OptString) {
s.Detail = val
}
// SetInstance sets the value of Instance.
func (s *Problem) SetInstance(val OptString) {
s.Instance = val
}
// SetTraceID sets the value of TraceID.
func (s *Problem) SetTraceID(val OptString) {
s.TraceID = val
}
// SetErrors sets the value of Errors.
func (s *Problem) SetErrors(val []ProblemFieldError) {
s.Errors = val
}
// Stable public error code. Adding a code is a contract change; renaming or removing one is a breaking
// change. Clients must handle an unknown code by its HTTP status.
//
// - validation_failed (400): parameters or body do not match the contract, or a body violates a
// domain rule such as salary_from <= salary_to; `errors` points at the fields.
// - unauthenticated (401): no valid session or credentials.
// - forbidden (403): the caller is authenticated but not allowed.
// - not_found (404): the route or object does not exist or is not visible.
// - method_not_allowed (405): the route does not support the method.
// - idempotency_in_progress (409): a request with the same Idempotency-Key is still being processed.
// - state_conflict (409): the operation conflicts with the current state of the resource, for example
// an invitation that was already accepted.
// - version_conflict (412): If-Match does not match the current version.
// - payload_too_large (413): the request body exceeds the limit.
// - unsupported_media_type (415): the request Content-Type is not accepted.
// - idempotency_key_reused (422): the Idempotency-Key was already used with a different request.
// - precondition_required (428): the operation requires If-Match.
// - rate_limited (429): too many requests; see Retry-After.
// - internal (500): unexpected server error.
// - not_implemented (501): the operation is in the contract but not implemented yet.
// - service_unavailable (503): the service cannot serve the request now, for example while a model
// loads; retry later.
//
// The enum keeps the public API codes so both contracts share one Problem shape. The identity codes
// verification_token_invalid, verification_token_expired, invalid_credentials, email_not_verified, and
// csrf_check_failed belong to the public API; the ML service never returns them.
// Ref: #/components/schemas/ProblemCode
type ProblemCode string
const (
ProblemCodeValidationFailed ProblemCode = "validation_failed"
ProblemCodeVerificationTokenInvalid ProblemCode = "verification_token_invalid"
ProblemCodeVerificationTokenExpired ProblemCode = "verification_token_expired"
ProblemCodeUnauthenticated ProblemCode = "unauthenticated"
ProblemCodeInvalidCredentials ProblemCode = "invalid_credentials"
ProblemCodeForbidden ProblemCode = "forbidden"
ProblemCodeEmailNotVerified ProblemCode = "email_not_verified"
ProblemCodeCsrfCheckFailed ProblemCode = "csrf_check_failed"
ProblemCodeNotFound ProblemCode = "not_found"
ProblemCodeMethodNotAllowed ProblemCode = "method_not_allowed"
ProblemCodeIdempotencyInProgress ProblemCode = "idempotency_in_progress"
ProblemCodeStateConflict ProblemCode = "state_conflict"
ProblemCodeVersionConflict ProblemCode = "version_conflict"
ProblemCodePayloadTooLarge ProblemCode = "payload_too_large"
ProblemCodeUnsupportedMediaType ProblemCode = "unsupported_media_type"
ProblemCodeIdempotencyKeyReused ProblemCode = "idempotency_key_reused"
ProblemCodePreconditionRequired ProblemCode = "precondition_required"
ProblemCodeRateLimited ProblemCode = "rate_limited"
ProblemCodeInternal ProblemCode = "internal"
ProblemCodeNotImplemented ProblemCode = "not_implemented"
ProblemCodeServiceUnavailable ProblemCode = "service_unavailable"
)
// AllValues returns all ProblemCode values.
func (ProblemCode) AllValues() []ProblemCode {
return []ProblemCode{
ProblemCodeValidationFailed,
ProblemCodeVerificationTokenInvalid,
ProblemCodeVerificationTokenExpired,
ProblemCodeUnauthenticated,
ProblemCodeInvalidCredentials,
ProblemCodeForbidden,
ProblemCodeEmailNotVerified,
ProblemCodeCsrfCheckFailed,
ProblemCodeNotFound,
ProblemCodeMethodNotAllowed,
ProblemCodeIdempotencyInProgress,
ProblemCodeStateConflict,
ProblemCodeVersionConflict,
ProblemCodePayloadTooLarge,
ProblemCodeUnsupportedMediaType,
ProblemCodeIdempotencyKeyReused,
ProblemCodePreconditionRequired,
ProblemCodeRateLimited,
ProblemCodeInternal,
ProblemCodeNotImplemented,
ProblemCodeServiceUnavailable,
}
}
// MarshalText implements encoding.TextMarshaler.
func (s ProblemCode) MarshalText() ([]byte, error) {
switch s {
case ProblemCodeValidationFailed:
return []byte(s), nil
case ProblemCodeVerificationTokenInvalid:
return []byte(s), nil
case ProblemCodeVerificationTokenExpired:
return []byte(s), nil
case ProblemCodeUnauthenticated:
return []byte(s), nil
case ProblemCodeInvalidCredentials:
return []byte(s), nil
case ProblemCodeForbidden:
return []byte(s), nil
case ProblemCodeEmailNotVerified:
return []byte(s), nil
case ProblemCodeCsrfCheckFailed:
return []byte(s), nil
case ProblemCodeNotFound:
return []byte(s), nil
case ProblemCodeMethodNotAllowed:
return []byte(s), nil
case ProblemCodeIdempotencyInProgress:
return []byte(s), nil
case ProblemCodeStateConflict:
return []byte(s), nil
case ProblemCodeVersionConflict:
return []byte(s), nil
case ProblemCodePayloadTooLarge:
return []byte(s), nil
case ProblemCodeUnsupportedMediaType:
return []byte(s), nil
case ProblemCodeIdempotencyKeyReused:
return []byte(s), nil
case ProblemCodePreconditionRequired:
return []byte(s), nil
case ProblemCodeRateLimited:
return []byte(s), nil
case ProblemCodeInternal:
return []byte(s), nil
case ProblemCodeNotImplemented:
return []byte(s), nil
case ProblemCodeServiceUnavailable:
return []byte(s), nil
default:
return nil, errors.Errorf("invalid value: %q", s)
}
}
// UnmarshalText implements encoding.TextUnmarshaler.
func (s *ProblemCode) UnmarshalText(data []byte) error {
switch ProblemCode(data) {
case ProblemCodeValidationFailed:
*s = ProblemCodeValidationFailed
return nil
case ProblemCodeVerificationTokenInvalid:
*s = ProblemCodeVerificationTokenInvalid
return nil
case ProblemCodeVerificationTokenExpired:
*s = ProblemCodeVerificationTokenExpired
return nil
case ProblemCodeUnauthenticated:
*s = ProblemCodeUnauthenticated
return nil
case ProblemCodeInvalidCredentials:
*s = ProblemCodeInvalidCredentials
return nil
case ProblemCodeForbidden:
*s = ProblemCodeForbidden
return nil
case ProblemCodeEmailNotVerified:
*s = ProblemCodeEmailNotVerified
return nil
case ProblemCodeCsrfCheckFailed:
*s = ProblemCodeCsrfCheckFailed
return nil
case ProblemCodeNotFound:
*s = ProblemCodeNotFound
return nil
case ProblemCodeMethodNotAllowed:
*s = ProblemCodeMethodNotAllowed
return nil
case ProblemCodeIdempotencyInProgress:
*s = ProblemCodeIdempotencyInProgress
return nil
case ProblemCodeStateConflict:
*s = ProblemCodeStateConflict
return nil
case ProblemCodeVersionConflict:
*s = ProblemCodeVersionConflict
return nil
case ProblemCodePayloadTooLarge:
*s = ProblemCodePayloadTooLarge
return nil
case ProblemCodeUnsupportedMediaType:
*s = ProblemCodeUnsupportedMediaType
return nil
case ProblemCodeIdempotencyKeyReused:
*s = ProblemCodeIdempotencyKeyReused
return nil
case ProblemCodePreconditionRequired:
*s = ProblemCodePreconditionRequired
return nil
case ProblemCodeRateLimited:
*s = ProblemCodeRateLimited
return nil
case ProblemCodeInternal:
*s = ProblemCodeInternal
return nil
case ProblemCodeNotImplemented:
*s = ProblemCodeNotImplemented
return nil
case ProblemCodeServiceUnavailable:
*s = ProblemCodeServiceUnavailable
return nil
default:
return errors.Errorf("invalid value: %q", data)
}
}
// One reason why a request field or parameter is invalid.
// Ref: #/components/schemas/ProblemFieldError
type ProblemFieldError struct {
In ProblemFieldLocation `json:"in"`
// JSON Pointer (RFC 6901). For `body` it points into the request body document, for example
// `/salary_from`; an empty string means the whole body. For a parameter it is `/` followed by the
// parameter name, for example `/limit` or `/Idempotency-Key`.
Pointer string `json:"pointer"`
// Stable field reason. Current values are `required` (missing value) and `invalid` (malformed value or
// a value outside the schema). Clients must tolerate new values.
Code string `json:"code"`
// Fixed English message that never echoes the submitted value.
Message string `json:"message"`
}
// GetIn returns the value of In.
func (s *ProblemFieldError) GetIn() ProblemFieldLocation {
return s.In
}
// GetPointer returns the value of Pointer.
func (s *ProblemFieldError) GetPointer() string {
return s.Pointer
}
// GetCode returns the value of Code.
func (s *ProblemFieldError) GetCode() string {
return s.Code
}
// GetMessage returns the value of Message.
func (s *ProblemFieldError) GetMessage() string {
return s.Message
}
// SetIn sets the value of In.
func (s *ProblemFieldError) SetIn(val ProblemFieldLocation) {
s.In = val
}
// SetPointer sets the value of Pointer.
func (s *ProblemFieldError) SetPointer(val string) {
s.Pointer = val
}
// SetCode sets the value of Code.
func (s *ProblemFieldError) SetCode(val string) {
s.Code = val
}
// SetMessage sets the value of Message.
func (s *ProblemFieldError) SetMessage(val string) {
s.Message = val
}
// Part of the request that contains the invalid field.
// Ref: #/components/schemas/ProblemFieldLocation
type ProblemFieldLocation string
const (
ProblemFieldLocationBody ProblemFieldLocation = "body"
ProblemFieldLocationQuery ProblemFieldLocation = "query"
ProblemFieldLocationPath ProblemFieldLocation = "path"
ProblemFieldLocationHeader ProblemFieldLocation = "header"
ProblemFieldLocationCookie ProblemFieldLocation = "cookie"
)
// AllValues returns all ProblemFieldLocation values.
func (ProblemFieldLocation) AllValues() []ProblemFieldLocation {
return []ProblemFieldLocation{
ProblemFieldLocationBody,
ProblemFieldLocationQuery,
ProblemFieldLocationPath,
ProblemFieldLocationHeader,
ProblemFieldLocationCookie,
}
}
// MarshalText implements encoding.TextMarshaler.
func (s ProblemFieldLocation) MarshalText() ([]byte, error) {
switch s {
case ProblemFieldLocationBody:
return []byte(s), nil
case ProblemFieldLocationQuery:
return []byte(s), nil
case ProblemFieldLocationPath:
return []byte(s), nil
case ProblemFieldLocationHeader:
return []byte(s), nil
case ProblemFieldLocationCookie:
return []byte(s), nil
default:
return nil, errors.Errorf("invalid value: %q", s)
}
}
// UnmarshalText implements encoding.TextUnmarshaler.
func (s *ProblemFieldLocation) UnmarshalText(data []byte) error {
switch ProblemFieldLocation(data) {
case ProblemFieldLocationBody:
*s = ProblemFieldLocationBody
return nil
case ProblemFieldLocationQuery:
*s = ProblemFieldLocationQuery
return nil
case ProblemFieldLocationPath:
*s = ProblemFieldLocationPath
return nil
case ProblemFieldLocationHeader:
*s = ProblemFieldLocationHeader
return nil
case ProblemFieldLocationCookie:
*s = ProblemFieldLocationCookie
return nil
default:
return errors.Errorf("invalid value: %q", data)
}
}
// ProblemStatusCode wraps Problem with StatusCode.
type ProblemStatusCode struct {
StatusCode int
Response Problem
}
// GetStatusCode returns the value of StatusCode.
func (s *ProblemStatusCode) GetStatusCode() int {
return s.StatusCode
}
// GetResponse returns the value of Response.
func (s *ProblemStatusCode) GetResponse() Problem {
return s.Response
}
// SetStatusCode sets the value of StatusCode.
func (s *ProblemStatusCode) SetStatusCode(val int) {
s.StatusCode = val
}
// SetResponse sets the value of Response.
func (s *ProblemStatusCode) SetResponse(val Problem) {
s.Response = val
}