Documentation ¶
Index ¶
- func Delete(ctx context.Context, h *RequestHelper, name, id string) error
- func Patch(ctx context.Context, h *RequestHelper, name, id string, record any) (int, error)
- func Post(ctx context.Context, h *RequestHelper, name string, record any) (string, error)
- type Attributes
- type HttpClient
- type PostResponse
- type QueryError
- type QueryResponse
- type RequestHelper
- type TokenCache
- type TokenFetcher
- type TokenGetter
- type TokenParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Delete ¶ added in v1.2.0
func Delete(ctx context.Context, h *RequestHelper, name, id string) error
Delete sends a delete request to salesforce to delete an object - uses the baseUrl, tokenGetter and http client on RequestHelper
Types ¶
type Attributes ¶
Attributes to be added, optionally, to concrete types of E for QueryResponse[E]
type PostResponse ¶ added in v1.2.0
PostResponse is the response from Salesforce for a post/create request
type QueryError ¶
type QueryError struct {
// contains filtered or unexported fields
}
func (QueryError) Error ¶
func (q QueryError) Error() string
type QueryResponse ¶
type QueryResponse[E any] struct { TotalSize int `json:"totalSize"` Done bool `json:"done"` Records []E `json:"records"` }
QueryResponse see https://ellogroup.atlassian.net/wiki/spaces/EP/pages/13402137/Salesforce+Package#QueryResponse%5BE-any%5D for more detail on below NB. if more models added here please update the above page
func Query ¶
func Query[E any](ctx context.Context, h *RequestHelper, q string) (*QueryResponse[E], error)
Query salesforce in a generic way - uses the baseUrl, tokenGetter and http client on RequestHelper to query salesforce - QueryError returned if status code != 200 with status code of response
type RequestHelper ¶
type RequestHelper struct {
// contains filtered or unexported fields
}
RequestHelper a helper struct for sending requests to salesforce for more on this see https://ellogroup.atlassian.net/wiki/spaces/EP/pages/13402137/Salesforce+Package
func NewRequestHelper ¶
func NewRequestHelper(client HttpClient, tg TokenGetter, baseUrl string, apiVersion int) (*RequestHelper, error)
type TokenCache ¶
type TokenCache struct {
// contains filtered or unexported fields
}
func NewTokenCache ¶
func NewTokenCache(p TokenParams) (*TokenCache, error)
NewTokenCache creates a default implementation of a salesforce token cache using async type of cache.KeylessRecordCache and storing in memory with driver.NewMemoryCache with a ~1 hour TTL/refresh rate (slightly less to unsure token doesn't expire before cache becomes stale) for more info see: https://ellogroup.atlassian.net/wiki/spaces/EP/pages/13402137/Salesforce+Package#TokenFetcher-and-TokenCache
func NewTokenCacheWithLogger ¶
func NewTokenCacheWithLogger(p TokenParams, log *zap.Logger) (*TokenCache, error)
type TokenFetcher ¶
type TokenFetcher struct {
// contains filtered or unexported fields
}
func NewTokenFetcher ¶
func NewTokenFetcher(p TokenParams) (*TokenFetcher, error)
type TokenParams ¶
type TokenParams struct { HttpClient HttpClient `validate:"required"` SMClient *secretsmanager.Client `validate:"required"` SMKey string `validate:"required"` Backoff backoff.BackOff }