Documentation ¶
Index ¶
- Constants
- type Auth
- type Body
- type BodyFile
- type BodyGraphQL
- type Client
- func (c *Client) EnumerateWorkspaces() ([]Workspace, error)
- func (c *Client) GetCollection(collection_uuid string) (Collection, error)
- func (c *Client) GetEnvironmentVariables(environment_uuid string) (VariableData, error)
- func (c *Client) GetGlobalVariables(workspace_uuid string) (VariableData, error)
- func (c *Client) GetWorkspace(workspaceUUID string) (Workspace, error)
- func (c *Client) NewRequest(urlStr string, headers map[string]string) (*http.Request, error)
- type Collection
- type Environment
- type Event
- type GlobalVars
- type IDNameUUID
- type Info
- type Item
- type KeyValue
- type Metadata
- type Request
- type Response
- type Script
- type Source
- func (s *Source) Chunks(ctx context.Context, chunksChan chan *sources.Chunk, ...) error
- func (s *Source) Init(ctx context.Context, name string, jobId sources.JobID, ...) error
- func (s *Source) JobID() sources.JobID
- func (s *Source) SourceID() sources.SourceID
- func (s *Source) Type() sourcespb.SourceType
- type Substitution
- type URL
- type VariableData
- type VariableInfo
- type Workspace
Constants ¶
const ( SourceType = sourcespb.SourceType_SOURCE_TYPE_POSTMAN LINK_BASE_URL = "https://go.postman.co/" GLOBAL_TYPE = "globals" ENVIRONMENT_TYPE = "environment" AUTH_TYPE = "authorization" REQUEST_TYPE = "request" FOLDER_TYPE = "folder" COLLECTION_TYPE = "collection" EVENT_TYPE = "script" )
const ( GLOBAL_VARS_URL = "https://www.postman.com/_api/workspace/%s/globals" //Note: This is an undocumented API endpoint. The office API endpoint keeps returning 502. //We'll shift this once that behavior is resolved and stable. //Official API Endpoint: "https://api.getpostman.com/workspaces/%s/global-variables" //GLOBAL_VARS_URL = "https://api.getpostman.com/workspaces/%s/global-variables" WORKSPACE_URL = "https://api.getpostman.com/workspaces/%s" ENVIRONMENTS_URL = "https://api.getpostman.com/environments/%s" COLLECTIONS_URL = "https://api.getpostman.com/collections/%s" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BodyGraphQL ¶
type Client ¶
type Client struct { // HTTP client used to communicate with the API HTTPClient *http.Client // Headers to attach to every requests made with the client. Headers map[string]string }
A Client manages communication with the Postman API.
func (*Client) EnumerateWorkspaces ¶
EnumerateWorkspaces returns the workspaces for a given user (both private, public, team and personal). Consider adding additional flags to support filtering.
func (*Client) GetCollection ¶
func (c *Client) GetCollection(collection_uuid string) (Collection, error)
GetCollection returns the collection for a given collection
func (*Client) GetEnvironmentVariables ¶
func (c *Client) GetEnvironmentVariables(environment_uuid string) (VariableData, error)
GetEnvironmentVariables returns the environment variables for a given environment
func (*Client) GetGlobalVariables ¶
func (c *Client) GetGlobalVariables(workspace_uuid string) (VariableData, error)
GetGlobalVariables returns the global variables for a given workspace
func (*Client) GetWorkspace ¶
GetWorkspace returns the workspace for a given workspace
type Collection ¶
type Environment ¶
type Environment struct {
VariableData `json:"environment"`
}
type GlobalVars ¶
type GlobalVars struct {
VariableData `json:"data"`
}
type IDNameUUID ¶
type Info ¶
type Info struct { PostmanID string `json:"_postman_id"` // This is a UUID. Needs createdBy ID prefix to be used with API. Name string `json:"name"` Description string `json:"description"` Schema string `json:"schema"` UpdatedAt time.Time `json:"updatedAt"` UID string `json:"uid"` //Need to use this to get the collection via API }
type Item ¶
type Item struct { Name string `json:"name"` Items []Item `json:"item,omitempty"` ID string `json:"id,omitempty"` Auth Auth `json:"auth,omitempty"` Events []Event `json:"event,omitempty"` Variable []KeyValue `json:"variable,omitempty"` Request Request `json:"request,omitempty"` Response []Response `json:"response,omitempty"` Description string `json:"description,omitempty"` UID string `json:"uid,omitempty"` //Need to use this to get the collection via API }
type Metadata ¶
type Metadata struct { WorkspaceUUID string WorkspaceName string CreatedBy string EnvironmentID string CollectionInfo Info FolderID string // UUID of the folder (but not full ID) FolderName string RequestID string // UUID of the request (but not full ID) RequestName string FullID string //full ID of the reference item (created_by + ID) OR just the UUID Link string //direct link to the folder (could be .json file path) Type string //folder, request, etc. EnvironmentName string GlobalID string // might just be FullID, not sure VarType string FieldName string FieldType string // contains filtered or unexported fields }
type Source ¶
type Source struct { DetectorKeywords map[string]struct{} sources.Progress sources.CommonSourceUnitUnmarshaller // contains filtered or unexported fields }
func (*Source) Chunks ¶
func (s *Source) Chunks(ctx context.Context, chunksChan chan *sources.Chunk, _ ...sources.ChunkingTarget) error
Chunks scans the Postman source and sends the data to the chunks chan. It scans the local environment, collection, and workspace files, and then scans the Postman API if a token is provided. The Postman source is different to our other sources in that we are not relying on the data we read from the source to contain all the information we need to scan, i.e, a git chunk contains all the information needed to check if a secret is present in that chunk. Postman on the other hand requires us to build context (the keywords and variables) as we scan the data. Check out the postman UI to see what I mean. Metadata is used to track information that informs the source of the chunk (e.g. the workspace -> collection -> request -> variable hierarchy).
func (*Source) Init ¶
func (s *Source) Init(ctx context.Context, name string, jobId sources.JobID, sourceId sources.SourceID, verify bool, connection *anypb.Any, concurrency int) error
Init returns an initialized Postman source.
func (*Source) Type ¶
func (s *Source) Type() sourcespb.SourceType
Type returns the type of source. It is used for matching source types in configuration and job input.
type Substitution ¶
type Substitution struct {
// contains filtered or unexported fields
}
func NewSubstitution ¶
func NewSubstitution() *Substitution
type VariableData ¶
type VariableData struct { ID string `json:"id"` // For globals and envs, this is just the UUID, not the full ID. Name string `json:"name"` KeyValues []KeyValue `json:"values"` Owner string `json:"owner"` IsPublic bool `json:"isPublic"` CreatedAt string `json:"createdAt"` UpdatedAt string `json:"updatedAt"` }
type VariableInfo ¶
type VariableInfo struct { Metadata Metadata // contains filtered or unexported fields }
type Workspace ¶
type Workspace struct { ID string `json:"id"` Name string `json:"name"` Type string `json:"type"` Description string `json:"description"` Visibility string `json:"visibility"` CreatedBy string `json:"createdBy"` UpdatedBy string `json:"updatedBy"` CreatedAt string `json:"createdAt"` UpdatedAt string `json:"updatedAt"` Collections []IDNameUUID `json:"collections"` Environments []IDNameUUID `json:"environments"` CollectionsRaw []Collection EnvironmentsRaw []VariableData }