Documentation
¶
Overview ¶
Package types contains shared types for the Salesforce SDK to avoid import cycles.
Index ¶
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 404 not found error.
func IsRateLimitError ¶
IsRateLimitError checks if the error is a rate limit error.
func ParseAPIError ¶
ParseAPIError parses an API error from the response body.
Types ¶
type APIError ¶
type APIError struct {
Message string `json:"message"`
ErrorCode ErrorCode `json:"errorCode"`
Fields []string `json:"fields,omitempty"`
StatusCode int `json:"-"`
Raw []byte `json:"-"`
Details map[string]string `json:"extended,omitempty"`
}
APIError represents an error returned by the Salesforce API.
func (*APIError) IsRetryable ¶
IsRetryable checks if the request should be retried.
func (*APIError) IsSessionInvalid ¶
IsSessionInvalid checks if the error is due to an invalid or expired session.
type AuthError ¶
type AuthError struct {
ErrorType string `json:"error"`
Description string `json:"error_description"`
StatusCode int `json:"-"`
}
AuthError represents an authentication error.
func (*AuthError) IsInvalidGrant ¶
IsInvalidGrant checks if the error is due to an invalid grant.
type ErrorCode ¶
type ErrorCode string
ErrorCode represents a Salesforce error code.
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_ON_CROSS_REFERENCE_ENTITY" ErrorCodeRequestLimit ErrorCode = "REQUEST_LIMIT_EXCEEDED" ErrorCodeStorageLimit ErrorCode = "STORAGE_LIMIT_EXCEEDED" )
Common Salesforce error codes
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 interface for logging.
type RateLimitError ¶
RateLimitError represents a rate limit exceeded error.
func (*RateLimitError) Error ¶
func (e *RateLimitError) Error() string
Error implements the error interface.
type Token ¶
type Token struct {
AccessToken string
TokenType string
RefreshToken string
InstanceURL string
IssuedAt time.Time
ExpiresAt time.Time
}
Token represents an authentication token.
type ValidationError ¶
ValidationError represents a client-side validation error.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
Error implements the error interface.