api

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	API_PREFIX string = "api"
)

Variables

This section is empty.

Functions

func BuildUrl

func BuildUrl(a *snykApiClient, endpoint string, queryParams ...string) (*url.URL, error)

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 DeriveAppUrl(canonicalUrl string) (string, error)

func DeriveSubdomainUrl

func DeriveSubdomainUrl(canonicalUrl string, subdomain string) (string, error)

func GetCanonicalApiAsUrl

func GetCanonicalApiAsUrl(url url.URL) (url.URL, error)

func GetCanonicalApiUrl

func GetCanonicalApiUrl(url url.URL) (string, error)

func GetCanonicalApiUrlFromString

func GetCanonicalApiUrlFromString(userDefinedUrl string) (string, error)

func IsFedramp

func IsFedramp(canonicalUrl string) bool

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 NewApi

func NewApi(url string, httpClient *http.Client) ApiClient

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.

Jump to

Keyboard shortcuts

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