Documentation
¶
Overview ¶
Package types provides shared types for the Salesforce SDK.
Index ¶
- Constants
- func IsAuthError(err error) bool
- func IsNotFoundError(err error) bool
- func IsRateLimitError(err error) bool
- func IsRetryableError(err error) bool
- func ParseAPIError(statusCode int, body []byte) error
- type APIError
- type APIErrors
- type AuthError
- type ErrorCode
- type Logger
- type NotFoundError
- type RateLimitError
- type Token
- type ValidationError
Constants ¶
const ( DefaultAPIVersion = "59.0" DefaultTimeout = 30 * time.Second DefaultMaxRetries = 3 )
Version constants
Variables ¶
This section is empty.
Functions ¶
func IsAuthError ¶
IsAuthError checks if the error is an authentication error.
func IsNotFoundError ¶
IsNotFoundError checks if the error is a not found error.
func IsRateLimitError ¶
IsRateLimitError checks if the error is a rate limit error.
func IsRetryableError ¶
IsRetryableError checks if the error can be retried.
func ParseAPIError ¶
ParseAPIError parses a Salesforce API error response.
Types ¶
type APIError ¶
type APIError struct {
Message string `json:"message"`
ErrorCode ErrorCode `json:"errorCode"`
Fields []string `json:"fields,omitempty"`
StatusCode int `json:"-"`
}
APIError represents a Salesforce API error.
func (*APIError) IsRetryable ¶
IsRetryable determines if the error can be retried.
type AuthError ¶
type AuthError struct {
ErrorType string `json:"error"`
Description string `json:"error_description"`
StatusCode int `json:"-"`
}
AuthError represents an authentication error.
type ErrorCode ¶
type ErrorCode string
ErrorCode represents Salesforce error codes.
const ( ErrorCodeInvalidSession ErrorCode = "INVALID_SESSION_ID" ErrorCodeSessionExpired ErrorCode = "SESSION_EXPIRED" ErrorCodeInvalidField ErrorCode = "INVALID_FIELD" ErrorCodeMalformedQuery ErrorCode = "MALFORMED_QUERY" ErrorCodeInvalidType ErrorCode = "INVALID_TYPE" ErrorCodeEntityDeleted ErrorCode = "ENTITY_IS_DELETED" ErrorCodeDuplicateValue ErrorCode = "DUPLICATE_VALUE" ErrorCodeRequiredFieldMissing ErrorCode = "REQUIRED_FIELD_MISSING" ErrorCodeInvalidCrossRef ErrorCode = "INVALID_CROSS_REFERENCE_KEY" ErrorCodeInsufficientAccess ErrorCode = "INSUFFICIENT_ACCESS_OR_READONLY" ErrorCodeRequestLimit ErrorCode = "REQUEST_LIMIT_EXCEEDED" ErrorCodeStorageLimit ErrorCode = "STORAGE_LIMIT_EXCEEDED" ErrorCodeNotFound ErrorCode = "NOT_FOUND" ErrorCodeFieldCustomValidation ErrorCode = "FIELD_CUSTOM_VALIDATION_EXCEPTION" ErrorCodeFieldIntegrity ErrorCode = "FIELD_INTEGRITY_EXCEPTION" ErrorCodeUnableToLockRow ErrorCode = "UNABLE_TO_LOCK_ROW" ErrorCodeProcessingHalt ErrorCode = "PROCESSING_HALTED" )
type Logger ¶
type Logger interface {
Debug(msg string, args ...interface{})
Info(msg string, args ...interface{})
Warn(msg string, args ...interface{})
Error(msg string, args ...interface{})
}
Logger defines the logging interface.
type NotFoundError ¶
NotFoundError indicates a resource was not found.
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
type RateLimitError ¶
RateLimitError indicates API rate limit exceeded.
func (*RateLimitError) Error ¶
func (e *RateLimitError) Error() string
type Token ¶
type Token struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token,omitempty"`
TokenType string `json:"token_type"`
InstanceURL string `json:"instance_url"`
ID string `json:"id,omitempty"`
IssuedAt time.Time `json:"issued_at"`
ExpiresAt time.Time `json:"expires_at,omitempty"`
Scope string `json:"scope,omitempty"`
Signature string `json:"signature,omitempty"`
}
Token represents an OAuth access token.
type ValidationError ¶
ValidationError represents input validation errors.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string