postman

package
v0.0.0-...-57850c5 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	Type  string
	Basic []AuthBasicValue
}

func (Auth) GetAuthBasicCredential

func (a Auth) GetAuthBasicCredential(env *Env, params []Param) (string, string)

GetAuthBasicCredential returns the couple {username}/{password} for basic authentication type.

type AuthBasicValue

type AuthBasicValue struct {
	Key   string
	Value string
}

type Body

type Body struct {
	Raw string
}

func (Body) Get

func (u Body) Get(env *Env, params []Param) string

Get builds the API {body} using the provided context (env and params).

type Collection

type Collection struct {
	Info     Info
	Items    Items    `json:"item"`
	Metadata Metadata // compute date
}

func (Collection) FindByMethod

func (c Collection) FindByMethod(method string) Items

FindByMethod finds the items that match with the {method}.

func (Collection) FindItemByLabel

func (c Collection) FindItemByLabel(label string) *Item

FindItemByLabel finds the item that matches with the {label}.

func (Collection) GetMethods

func (c Collection) GetMethods() []string

GetMethods finds the items methods.

func (Collection) SortByName

func (c Collection) SortByName() Collection

SortByName sorts collection items by the {name} field.

type CollectionHistoryItem

type CollectionHistoryItem struct {
	Number int
	Item   Item

	Status       string
	TimeInMillis int64

	Body  string
	Trunc bool

	Data          []byte `json:"-"` // whole body but not serialized
	ContentLength int64

	Env    *Env
	Params []Param

	ExecutedAt time.Time
}

func NewCollectionHistoryItem

func NewCollectionHistoryItem(number int, item Item, status string, timeInMillis int64, body string, data []byte, contentLength int64, env *Env, params []Param) CollectionHistoryItem

func (CollectionHistoryItem) GetBody

func (i CollectionHistoryItem) GetBody(max int) []byte

GetBody returns the {i.Data} bytes if exists else {i.Body} string.

func (CollectionHistoryItem) GetSuggestDescription

func (i CollectionHistoryItem) GetSuggestDescription() string

GetSuggestDescription builds the item description for the prompt suggestions.

func (CollectionHistoryItem) GetSuggestText

func (i CollectionHistoryItem) GetSuggestText() string

GetSuggestText builds the item text for the prompt suggestions.

type CollectionHistoryItems

type CollectionHistoryItems []CollectionHistoryItem

func (CollectionHistoryItems) FindByLabel

func (r CollectionHistoryItems) FindByLabel(label string) *CollectionHistoryItem

FindByLabel finds collection history item that matches with {label}.

func (CollectionHistoryItems) SortByExecutedAt

func (r CollectionHistoryItems) SortByExecutedAt() CollectionHistoryItems

SortByExecutedAt sorts collection history items by {executedAt} field.

type Env

type Env struct {
	Name   string
	Params []EnvParam `json:"values"`
}

func NewEnv

func NewEnv() Env

func (Env) GetName

func (e Env) GetName() string

type EnvParam

type EnvParam struct {
	Key   string
	Value string
}
type Header struct {
	Key   string
	Value string
}

type Headers

type Headers []Header

func (Headers) Get

func (h Headers) Get(env *Env, params []Param) map[string]string

Get builds the header params using the provided context (env and params).

type Info

type Info struct {
	Name string
}

type Item

type Item struct {
	Name    string
	Request Request `json:"request,omitempty"`
	Items   Items   `json:"item,omitempty"`
}

func (Item) Contains

func (i Item) Contains(pattern string) ItemContainsPattern

func (Item) GetLabel

func (i Item) GetLabel() string

GetLabel builds the item label "{METHOD}.../{path[len(path)-3:]}" computed field.

func (Item) GetParams

func (i Item) GetParams() []string

GetParams finds all params from {url} annd {body} fields.

func (Item) IsRequest

func (i Item) IsRequest() bool

IsRequest returns {true} if the item is an API request.

type ItemContainsPattern

type ItemContainsPattern struct {
	Parent bool
	Child  bool
}

func (ItemContainsPattern) Contains

func (i ItemContainsPattern) Contains() bool

type Items

type Items []Item

func (Items) SortByLabel

func (items Items) SortByLabel() Items

SortByLabel sorts items by the {label} computed field.

func (Items) SortByName

func (items Items) SortByName() Items

SortByName sorts items by the {name} field.

type Metadata

type Metadata struct {
	Methods []string
}

type PSTCollection

type PSTCollection struct {
	Id   string
	Name string
}

type PSTCollections

type PSTCollections struct {
	Collections []PSTCollection
}

type PSTEnvironment

type PSTEnvironment struct {
	Id   string
	Name string
}

type PSTEnvironments

type PSTEnvironments struct {
	Environments []PSTEnvironment
}

type PSTWorkspace

type PSTWorkspace struct {
	Id   string
	Name string
}

type PSTWorkspaces

type PSTWorkspaces struct {
	Workspaces []PSTWorkspace
}

func (PSTWorkspaces) Find

func (w PSTWorkspaces) Find(workspaceIdOrName string) *PSTWorkspace

type Param

type Param struct {
	Key   string
	Value string
}

type PostmanCollection

type PostmanCollection struct {
	Collection Collection
}

type PostmanEnvironment

type PostmanEnvironment struct {
	Environment Env
}

type Request

type Request struct {
	Method string
	Header Headers `json:"header,omitempty"`
	Url    Url
	Auth   Auth
	Body   Body
}

type Url

type Url struct {
	Raw  string
	Path []string
}

func (Url) Get

func (u Url) Get(env *Env, params []Param) string

Get builds the API {url} using the provided context (env and params).

func (Url) GetLongPath

func (u Url) GetLongPath() string

GetLongPath builds the API path.

func (Url) GetShortPath

func (u Url) GetShortPath() string

GetShortPath builds the short (3 max) API path.

Jump to

Keyboard shortcuts

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