types

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package types provides shared types for the Salesforce SDK.

Index

Constants

View Source
const (
	DefaultAPIVersion = "59.0"
	DefaultTimeout    = 30 * time.Second
	DefaultMaxRetries = 3
)

Version constants

Variables

This section is empty.

Functions

func IsAuthError

func IsAuthError(err error) bool

IsAuthError checks if the error is an authentication error.

func IsNotFoundError

func IsNotFoundError(err error) bool

IsNotFoundError checks if the error is a not found error.

func IsRateLimitError

func IsRateLimitError(err error) bool

IsRateLimitError checks if the error is a rate limit error.

func IsRetryableError

func IsRetryableError(err error) bool

IsRetryableError checks if the error can be retried.

func ParseAPIError

func ParseAPIError(statusCode int, body []byte) error

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) Error

func (e *APIError) Error() string

func (*APIError) IsRetryable

func (e *APIError) IsRetryable() bool

IsRetryable determines if the error can be retried.

type APIErrors

type APIErrors []APIError

APIErrors represents multiple API errors.

func (APIErrors) Error

func (e APIErrors) Error() string

type AuthError

type AuthError struct {
	ErrorType   string `json:"error"`
	Description string `json:"error_description"`
	StatusCode  int    `json:"-"`
}

AuthError represents an authentication error.

func (*AuthError) Error

func (e *AuthError) Error() string

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

type NotFoundError struct {
	ObjectType string
	ID         string
}

NotFoundError indicates a resource was not found.

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

type RateLimitError

type RateLimitError struct {
	RetryAfter int
	Message    string
}

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.

func (*Token) IsExpired

func (t *Token) IsExpired() bool

IsExpired checks if the token has expired.

type ValidationError

type ValidationError struct {
	Field   string
	Message string
}

ValidationError represents input validation errors.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Jump to

Keyboard shortcuts

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