Documentation
¶
Index ¶
- Variables
- func IsForbidden(err error) bool
- func IsNotFound(err error) bool
- func IsUnauthorized(err error) bool
- type ClientError
- func (*ClientError) Descriptor() ([]byte, []int)deprecated
- func (x *ClientError) Error() string
- func (x *ClientError) GetPath() string
- func (x *ClientError) GetReason() string
- func (x *ClientError) GetStatusCode() int32
- func (*ClientError) ProtoMessage()
- func (x *ClientError) ProtoReflect() protoreflect.Message
- func (x *ClientError) Reset()
- func (x *ClientError) String() string
- func (m *ClientError) Validate() error
- func (m *ClientError) ValidateAll() error
- type ClientErrorMultiError
- type ClientErrorValidationError
- func (e ClientErrorValidationError) Cause() error
- func (e ClientErrorValidationError) Error() string
- func (e ClientErrorValidationError) ErrorName() string
- func (e ClientErrorValidationError) Field() string
- func (e ClientErrorValidationError) Key() bool
- func (e ClientErrorValidationError) Reason() string
- type ClientInterface
- type DefaultApiError
- func (*DefaultApiError) Descriptor() ([]byte, []int)deprecated
- func (x *DefaultApiError) GetMessage() string
- func (*DefaultApiError) ProtoMessage()
- func (x *DefaultApiError) ProtoReflect() protoreflect.Message
- func (x *DefaultApiError) Reset()
- func (x *DefaultApiError) String() string
- func (m *DefaultApiError) Validate() error
- func (m *DefaultApiError) ValidateAll() error
- type DefaultApiErrorMultiError
- type DefaultApiErrorValidationError
- func (e DefaultApiErrorValidationError) Cause() error
- func (e DefaultApiErrorValidationError) Error() string
- func (e DefaultApiErrorValidationError) ErrorName() string
- func (e DefaultApiErrorValidationError) Field() string
- func (e DefaultApiErrorValidationError) Key() bool
- func (e DefaultApiErrorValidationError) Reason() string
- type DoOption
- func WithJWT(withJWT bool) DoOption
- func WithJobToken(jobToken string) DoOption
- func WithJsonRequestBody(body interface{}) DoOption
- func WithMethod(method string) DoOption
- func WithPath(path string) DoOption
- func WithProtoJsonRequestBody(body ValidatableMessage) DoOption
- func WithRequestBody(body io.Reader, contentType string) DoOption
- func WithResponseHandler(handler ResponseHandler) DoOption
- func WithoutRetries() DoOption
- type ErrHandler
- type ResponseHandler
- func JsonResponseHandler(response interface{}) ResponseHandler
- func NakedResponseHandler(response **http.Response) ResponseHandler
- func NoContentResponseHandler() ResponseHandler
- func ProtoJsonResponseHandler(response ValidatableMessage) ResponseHandler
- func ProtoJsonResponseHandlerWithErr(response ValidatableMessage, errHandler ErrHandler) ResponseHandler
- func ProtoJsonResponseHandlerWithStructuredErrReason(response ValidatableMessage) ResponseHandler
- type ResponseHandlerStruct
- type ValidatableMessage
Constants ¶
This section is empty.
Variables ¶
var File_pkg_gitlab_gitlab_proto protoreflect.FileDescriptor
Functions ¶
func IsForbidden ¶
func IsNotFound ¶
func IsUnauthorized ¶
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 ¶
func (e ClientErrorValidationError) Cause() error
Cause function returns cause value.
func (ClientErrorValidationError) Error ¶
func (e ClientErrorValidationError) Error() string
Error satisfies the builtin error interface
func (ClientErrorValidationError) ErrorName ¶
func (e ClientErrorValidationError) ErrorName() string
ErrorName returns error name.
func (ClientErrorValidationError) Field ¶
func (e ClientErrorValidationError) Field() string
Field function returns field value.
func (ClientErrorValidationError) Key ¶
func (e ClientErrorValidationError) Key() bool
Key function returns key value.
func (ClientErrorValidationError) Reason ¶
func (e ClientErrorValidationError) Reason() string
Reason function returns reason value.
type ClientInterface ¶
type DefaultApiError ¶
type DefaultApiError struct {
Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
// contains filtered or unexported fields
}
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 ¶
func (m DefaultApiErrorMultiError) Error() string
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 ¶
func (e DefaultApiErrorValidationError) Cause() error
Cause function returns cause value.
func (DefaultApiErrorValidationError) Error ¶
func (e DefaultApiErrorValidationError) Error() string
Error satisfies the builtin error interface
func (DefaultApiErrorValidationError) ErrorName ¶
func (e DefaultApiErrorValidationError) ErrorName() string
ErrorName returns error name.
func (DefaultApiErrorValidationError) Field ¶
func (e DefaultApiErrorValidationError) Field() string
Field function returns field value.
func (DefaultApiErrorValidationError) Key ¶
func (e DefaultApiErrorValidationError) Key() bool
Key function returns key value.
func (DefaultApiErrorValidationError) Reason ¶
func (e DefaultApiErrorValidationError) Reason() string
Reason function returns reason value.
type DoOption ¶
type DoOption func(*doConfig) error
DoOption to configure the Do call of the client.
func WithJobToken ¶
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 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 ¶
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 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