Documentation
¶
Index ¶
- Constants
- func BuildUrl(a *snykApiClient, endpoint string, queryParams ...string) (*url.URL, error)
- func DeriveAppUrl(canonicalUrl string) (string, error)
- func DeriveSubdomainUrl(canonicalUrl string, subdomain string) (string, error)
- func GetCanonicalApiAsUrl(url url.URL) (url.URL, error)
- func GetCanonicalApiUrl(url url.URL) (string, error)
- func GetCanonicalApiUrlFromString(userDefinedUrl string) (string, error)
- func IsFedramp(canonicalUrl string) bool
- type ApiClient
Constants ¶
View Source
const (
API_PREFIX string = "api"
)
Variables ¶
This section is empty.
Functions ¶
func BuildUrl ¶
BuildUrl constructs a URL for the Snyk API, appending query parameters from a provided slice.
Parameters:
- a (snykApiClient): A reference to the Snyk API client object.
- endpoint (string): The endpoint path to be appended to the API base URL.
- queryParams (...string): A variable number of string arguments representing key-value pairs for the query parameters. Parameters are expected in the format "key1", "value1", "key2", "value2", etc.
Returns:
- A constructed url.URL object.
- An error object (if an error occurred during URL construction or parsing).
Example:
url, err := BuildUrl(myApiClient, "/users", "filter", "active", "limit", "10")
if err != nil {
// Handle error
}
// Use the constructed url object (e.g., to make an API call)
func DeriveAppUrl ¶
func DeriveSubdomainUrl ¶
Types ¶
type ApiClient ¶
type ApiClient interface {
GetDefaultOrgId(ctx context.Context) (orgID string, err error)
GetOrgIdFromSlug(ctx context.Context, slugName string) (string, error)
GetSlugFromOrgId(ctx context.Context, orgID string) (string, error)
GetOrganizations(ctx context.Context, limit int) (*contract.OrganizationsResponse, error)
Init(url string, client *http.Client)
GetFeatureFlag(ctx context.Context, flagname string, origId string) (bool, error)
GetUserMe(ctx context.Context) (string, error)
GetSelf(ctx context.Context) (contract.SelfResponse, error)
GetOrgSettings(ctx context.Context, orgId string) (*contract.OrgSettingsResponse, error)
}
func NewApiInstance ¶
func NewApiInstance() ApiClient
Directories
¶
| Path | Synopsis |
|---|---|
|
analytics
|
|
|
2024-03-07
Package v20240307 provides primitives to interact with the openapi HTTP API.
|
Package v20240307 provides primitives to interact with the openapi HTTP API. |
|
fileupload
|
|
|
policy
|
|
|
2024-10-15
Package v20241015 provides primitives to interact with the openapi HTTP API.
|
Package v20241015 provides primitives to interact with the openapi HTTP API. |
Click to show internal directories.
Click to hide internal directories.