gitlab

package
v0.1.3-0...-188399e Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2025 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_pkg_gitlab_gitlab_proto protoreflect.FileDescriptor

Functions

func IsForbidden

func IsForbidden(err error) bool

func IsNotFound

func IsNotFound(err error) bool

func IsUnauthorized

func IsUnauthorized(err error) bool

Types

type ClientError

type ClientError struct {
	StatusCode int32  `protobuf:"varint,1,opt,name=status_code,json=statusCode,proto3" json:"status_code,omitempty"`
	Path       string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
	Reason     string `protobuf:"bytes,3,opt,name=reason,proto3" json:"reason,omitempty"`
	// contains filtered or unexported fields
}

func (*ClientError) Descriptor deprecated

func (*ClientError) Descriptor() ([]byte, []int)

Deprecated: Use ClientError.ProtoReflect.Descriptor instead.

func (*ClientError) Error

func (x *ClientError) Error() string

func (*ClientError) GetPath

func (x *ClientError) GetPath() string

func (*ClientError) GetReason

func (x *ClientError) GetReason() string

func (*ClientError) GetStatusCode

func (x *ClientError) GetStatusCode() int32

func (*ClientError) ProtoMessage

func (*ClientError) ProtoMessage()

func (*ClientError) ProtoReflect

func (x *ClientError) ProtoReflect() protoreflect.Message

func (*ClientError) Reset

func (x *ClientError) Reset()

func (*ClientError) String

func (x *ClientError) String() string

func (*ClientError) Validate

func (m *ClientError) Validate() error

Validate checks the field values on ClientError with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*ClientError) ValidateAll

func (m *ClientError) ValidateAll() error

ValidateAll checks the field values on ClientError with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in ClientErrorMultiError, or nil if none found.

type ClientErrorMultiError

type ClientErrorMultiError []error

ClientErrorMultiError is an error wrapping multiple validation errors returned by ClientError.ValidateAll() if the designated constraints aren't met.

func (ClientErrorMultiError) AllErrors

func (m ClientErrorMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (ClientErrorMultiError) Error

func (m ClientErrorMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type ClientErrorValidationError

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

ClientErrorValidationError is the validation error returned by ClientError.Validate if the designated constraints aren't met.

func (ClientErrorValidationError) Cause

Cause function returns cause value.

func (ClientErrorValidationError) Error

Error satisfies the builtin error interface

func (ClientErrorValidationError) ErrorName

func (e ClientErrorValidationError) ErrorName() string

ErrorName returns error name.

func (ClientErrorValidationError) Field

Field function returns field value.

func (ClientErrorValidationError) Key

Key function returns key value.

func (ClientErrorValidationError) Reason

Reason function returns reason value.

type ClientInterface

type ClientInterface interface {
	Do(ctx context.Context, opts ...DoOption) error
}

type DefaultApiError

type DefaultApiError struct {
	Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

see https://gitlab.com/gitlab-org/gitlab/blob/2864126a72835bd0b29f670ffc36828014850f5f/lib/api/helpers.rb#L534-534

func (*DefaultApiError) Descriptor deprecated

func (*DefaultApiError) Descriptor() ([]byte, []int)

Deprecated: Use DefaultApiError.ProtoReflect.Descriptor instead.

func (*DefaultApiError) GetMessage

func (x *DefaultApiError) GetMessage() string

func (*DefaultApiError) ProtoMessage

func (*DefaultApiError) ProtoMessage()

func (*DefaultApiError) ProtoReflect

func (x *DefaultApiError) ProtoReflect() protoreflect.Message

func (*DefaultApiError) Reset

func (x *DefaultApiError) Reset()

func (*DefaultApiError) String

func (x *DefaultApiError) String() string

func (*DefaultApiError) Validate

func (m *DefaultApiError) Validate() error

Validate checks the field values on DefaultApiError with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*DefaultApiError) ValidateAll

func (m *DefaultApiError) ValidateAll() error

ValidateAll checks the field values on DefaultApiError with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in DefaultApiErrorMultiError, or nil if none found.

type DefaultApiErrorMultiError

type DefaultApiErrorMultiError []error

DefaultApiErrorMultiError is an error wrapping multiple validation errors returned by DefaultApiError.ValidateAll() if the designated constraints aren't met.

func (DefaultApiErrorMultiError) AllErrors

func (m DefaultApiErrorMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (DefaultApiErrorMultiError) Error

Error returns a concatenation of all the error messages it wraps.

type DefaultApiErrorValidationError

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

DefaultApiErrorValidationError is the validation error returned by DefaultApiError.Validate if the designated constraints aren't met.

func (DefaultApiErrorValidationError) Cause

Cause function returns cause value.

func (DefaultApiErrorValidationError) Error

Error satisfies the builtin error interface

func (DefaultApiErrorValidationError) ErrorName

func (e DefaultApiErrorValidationError) ErrorName() string

ErrorName returns error name.

func (DefaultApiErrorValidationError) Field

Field function returns field value.

func (DefaultApiErrorValidationError) Key

Key function returns key value.

func (DefaultApiErrorValidationError) Reason

Reason function returns reason value.

type DoOption

type DoOption func(*doConfig) error

DoOption to configure the Do call of the client.

func WithJWT

func WithJWT(withJWT bool) DoOption

func WithJobToken

func WithJobToken(jobToken string) DoOption

func WithJsonRequestBody

func WithJsonRequestBody(body interface{}) DoOption

WithJsonRequestBody specifies the object to marshal to JSON and use as request body. Do NOT use this method with proto messages, use WithProtoJsonRequestBody instead.

func WithMethod

func WithMethod(method string) DoOption

func WithPath

func WithPath(path string) DoOption

func WithProtoJsonRequestBody

func WithProtoJsonRequestBody(body ValidatableMessage) DoOption

WithProtoJsonRequestBody specifies the object to marshal to JSON and use as request body. Use this method with proto messages.

func WithRequestBody

func WithRequestBody(body io.Reader, contentType string) DoOption

WithRequestBody sets the request body and HTTP Content-Type header if contentType is not empty.

func WithResponseHandler

func WithResponseHandler(handler ResponseHandler) DoOption

func WithoutRetries

func WithoutRetries() DoOption

type ErrHandler

type ErrHandler func(resp *http.Response) error

type ResponseHandler

type ResponseHandler interface {
	// Handle is invoked with HTTP client's response and error values.
	Handle(*http.Response, error) error
	// Accept returns the value to send in the Accept HTTP header.
	// Empty string means no value should be sent.
	Accept() string
}

func JsonResponseHandler

func JsonResponseHandler(response interface{}) ResponseHandler

func NakedResponseHandler

func NakedResponseHandler(response **http.Response) ResponseHandler

func NoContentResponseHandler

func NoContentResponseHandler() ResponseHandler

NoContentResponseHandler can be used when no response is expected or response must be discarded.

func ProtoJsonResponseHandler

func ProtoJsonResponseHandler(response ValidatableMessage) ResponseHandler

func ProtoJsonResponseHandlerWithErr

func ProtoJsonResponseHandlerWithErr(response ValidatableMessage, errHandler ErrHandler) ResponseHandler

func ProtoJsonResponseHandlerWithStructuredErrReason

func ProtoJsonResponseHandlerWithStructuredErrReason(response ValidatableMessage) ResponseHandler

type ResponseHandlerStruct

type ResponseHandlerStruct struct {
	AcceptHeader string
	HandleFunc   func(*http.Response, error) error
}

func (ResponseHandlerStruct) Accept

func (r ResponseHandlerStruct) Accept() string

func (ResponseHandlerStruct) Handle

func (r ResponseHandlerStruct) Handle(resp *http.Response, err error) error

type ValidatableMessage

type ValidatableMessage interface {
	proto.Message
	ValidateAll() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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