Documentation
¶
Overview ¶
Package helpers hosts shared helper functions reused integration packages
Index ¶
- Variables
- func APITokenFromPayload(payload types.CredentialPayload, provider string) (string, error)
- func HTTPGetJSON(ctx context.Context, client *http.Client, url string, bearer string, ...) error
- func OAuthTokenFromPayload(payload types.CredentialPayload, provider string) (string, error)
- func RandomState(bytes int) (string, error)
- func SanitizeClientDescriptors(provider types.ProviderType, descriptors []types.ClientDescriptor) []types.ClientDescriptor
- func SanitizeOperationDescriptors(provider types.ProviderType, descriptors []types.OperationDescriptor) []types.OperationDescriptor
- func StringValue(data map[string]any, key string) string
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrOAuthTokenMissing indicates the OAuth token is not present in the credential payload ErrOAuthTokenMissing = errors.New("helpers: oauth token missing") // ErrAccessTokenEmpty indicates the access token field is empty ErrAccessTokenEmpty = errors.New("helpers: access token empty") // ErrAPITokenMissing indicates the API token is not present in the credential payload ErrAPITokenMissing = errors.New("helpers: api token missing") // ErrHTTPRequestFailed indicates an HTTP request returned a non-2xx status ErrHTTPRequestFailed = errors.New("helpers: http request failed") )
Functions ¶
func APITokenFromPayload ¶
func APITokenFromPayload(payload types.CredentialPayload, provider string) (string, error)
APITokenFromPayload extracts a raw API token from the credential payload.
func HTTPGetJSON ¶
func HTTPGetJSON(ctx context.Context, client *http.Client, url string, bearer string, headers map[string]string, out any) error
HTTPGetJSON issues a GET request with the provided bearer token and decodes JSON responses.
func OAuthTokenFromPayload ¶
func OAuthTokenFromPayload(payload types.CredentialPayload, provider string) (string, error)
OAuthTokenFromPayload extracts a usable access token from the credential payload.
func RandomState ¶
RandomState generates a URL-safe random string using crypto/rand
func SanitizeClientDescriptors ¶
func SanitizeClientDescriptors(provider types.ProviderType, descriptors []types.ClientDescriptor) []types.ClientDescriptor
SanitizeClientDescriptors filters out invalid client descriptors and assigns provider type
func SanitizeOperationDescriptors ¶
func SanitizeOperationDescriptors(provider types.ProviderType, descriptors []types.OperationDescriptor) []types.OperationDescriptor
SanitizeOperationDescriptors filters and cleans a slice of OperationDescriptor
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.