tpostmanv2

package
v0.0.0-...-36d6306 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildPostmanCollection

func BuildPostmanCollection(resolved *PostmanResolved) ([]byte, error)

BuildPostmanCollection creates Postman collection JSON from resolved HTTP data

func ConvertToFiles

func ConvertToFiles(data []byte, opts ConvertOptions) ([]mfile.File, error)

ConvertToFiles extracts only the file records from a Postman collection conversion

func ConvertToHTTPRequests

func ConvertToHTTPRequests(data []byte, opts ConvertOptions) ([]mhttp.HTTP, error)

ConvertToHTTPRequests extracts only the HTTP requests from a Postman collection conversion

Types

type ConvertOptions

type ConvertOptions struct {
	WorkspaceID    idwrap.IDWrap  // Target workspace for all generated content
	FolderID       *idwrap.IDWrap // Optional parent folder for organization
	ParentHttpID   *idwrap.IDWrap // For delta system parent relationships
	IsDelta        bool           // Whether this represents a delta variation
	DeltaName      *string        // Optional name for delta variation
	CollectionName string         // Name used for file/folder generation
}

ConvertOptions defines configuration for Postman collection conversion

type HTTPAssociatedData

type HTTPAssociatedData struct {
	Headers        []mhttp.HTTPHeader
	SearchParams   []mhttp.HTTPSearchParam
	BodyForms      []mhttp.HTTPBodyForm
	BodyUrlencoded []mhttp.HTTPBodyUrlencoded
	BodyRaw        *mhttp.HTTPBodyRaw
}

HTTPAssociatedData contains all data associated with an HTTP request

type PostmanAuth

type PostmanAuth struct {
	Type   string             `json:"type"`
	APIKey []PostmanAuthParam `json:"apikey,omitempty"`
	Basic  []PostmanAuthParam `json:"basic,omitempty"`
	Bearer []PostmanAuthParam `json:"bearer,omitempty"`
}

PostmanAuth represents authentication configuration for requests

type PostmanAuthParam

type PostmanAuthParam struct {
	Key   string `json:"key,omitempty"`
	Value string `json:"value,omitempty"`
}

PostmanAuthParam represents authentication parameters

type PostmanBody

type PostmanBody struct {
	Mode       string              `json:"mode"`
	Raw        string              `json:"raw,omitempty"`
	FormData   []PostmanFormData   `json:"formdata,omitempty"`
	URLEncoded []PostmanURLEncoded `json:"urlencoded,omitempty"`
}

PostmanBody represents request body in Postman format

type PostmanCollection

type PostmanCollection struct {
	Info struct {
		Name        string `json:"name"`
		Description string `json:"description"`
		Schema      string `json:"schema"`
	} `json:"info"`
	Item     []PostmanItem `json:"item"`
	Variable []struct {
		Key   string `json:"key"`
		Value string `json:"value"`
	} `json:"variable"`
	Auth *PostmanAuth `json:"auth,omitempty"`
}

PostmanCollection represents a simplified Postman collection structure for parsing

func ParsePostmanCollection

func ParsePostmanCollection(data []byte) (*PostmanCollection, error)

ParsePostmanCollection parses Postman collection JSON into a structured collection object

type PostmanFormData

type PostmanFormData struct {
	Key         string `json:"key"`
	Value       string `json:"value"`
	Description string `json:"description"`
	Disabled    bool   `json:"disabled"`
	Type        string `json:"type"`
}

PostmanFormData represents form data in Postman format

type PostmanHeader

type PostmanHeader struct {
	Key         string `json:"key"`
	Value       string `json:"value"`
	Description string `json:"description"`
	Disabled    bool   `json:"disabled"`
}

PostmanHeader represents a header in Postman format

type PostmanItem

type PostmanItem struct {
	Name     string            `json:"name"`
	Item     []PostmanItem     `json:"item,omitempty"`
	Request  *PostmanRequest   `json:"request,omitempty"`
	Response []PostmanResponse `json:"response,omitempty"`
	Auth     *PostmanAuth      `json:"auth,omitempty"`
}

PostmanItem represents an item in a Postman collection (can be folder or request)

type PostmanOriginalReq

type PostmanOriginalReq struct {
	Method string          `json:"method"`
	URL    PostmanURL      `json:"url"`
	Header []PostmanHeader `json:"header"`
	Body   *PostmanBody    `json:"body"`
}

PostmanOriginalReq represents the original request for a response

type PostmanQueryParam

type PostmanQueryParam struct {
	Key         string `json:"key"`
	Value       string `json:"value"`
	Description string `json:"description"`
	Disabled    bool   `json:"disabled"`
}

PostmanQueryParam represents a query parameter in Postman format

type PostmanRequest

type PostmanRequest struct {
	Method      string          `json:"method"`
	Header      []PostmanHeader `json:"header"`
	Body        *PostmanBody    `json:"body,omitempty"`
	URL         PostmanURL      `json:"url"`
	Description string          `json:"description"`
	Auth        *PostmanAuth    `json:"auth,omitempty"`
}

PostmanRequest represents an HTTP request in Postman format

type PostmanResolved

type PostmanResolved struct {
	// Primary HTTP requests extracted from the collection (both Base and Delta)
	HTTPRequests []mhttp.HTTP

	// Associated data structures for each HTTP request
	SearchParams   []mhttp.HTTPSearchParam
	Headers        []mhttp.HTTPHeader
	BodyForms      []mhttp.HTTPBodyForm
	BodyUrlencoded []mhttp.HTTPBodyUrlencoded
	BodyRaw        []mhttp.HTTPBodyRaw
	Asserts        []mhttp.HTTPAssert

	// File system integration for workspace organization
	Files []mfile.File

	// Collection-level variables
	Variables []PostmanVariable

	// Flow integration (aligning with harv2)
	Flow         mflow.Flow
	Nodes        []mflow.Node
	RequestNodes []mflow.NodeRequest
	Edges        []mflow.Edge
}

PostmanResolved contains all resolved HTTP requests and associated data from a Postman collection

func ConvertPostmanCollection

func ConvertPostmanCollection(data []byte, opts ConvertOptions) (*PostmanResolved, error)

ConvertPostmanCollection converts Postman collection JSON data to modern HTTP models

type PostmanResponse

type PostmanResponse struct {
	Name        string             `json:"name"`
	OriginalReq PostmanOriginalReq `json:"originalRequest"`
	Status      string             `json:"status"`
	Code        int                `json:"code"`
	Headers     []PostmanHeader    `json:"header"`
	Body        string             `json:"body"`
	Cookie      []struct {
		Name  string `json:"name"`
		Value string `json:"value"`
	} `json:"cookie"`
}

PostmanResponse represents a response in Postman format

type PostmanURL

type PostmanURL struct {
	Raw      string              `json:"raw"`
	Protocol string              `json:"protocol,omitempty"`
	Host     []string            `json:"host,omitempty"`
	Port     string              `json:"port,omitempty"`
	Path     []string            `json:"path,omitempty"`
	Query    []PostmanQueryParam `json:"query,omitempty"`
	Hash     string              `json:"hash,omitempty"`
}

PostmanURL represents a URL in Postman format

type PostmanURLEncoded

type PostmanURLEncoded struct {
	Key         string `json:"key"`
	Value       string `json:"value"`
	Description string `json:"description"`
	Disabled    bool   `json:"disabled"`
}

PostmanURLEncoded represents URL-encoded data in Postman format

type PostmanVariable

type PostmanVariable struct {
	Key   string
	Value string
}

PostmanVariable represents a variable in a Postman collection

Jump to

Keyboard shortcuts

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