request

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2021 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MethodGet     = Method{Key: http.MethodGet, Description: ""}
	MethodHead    = Method{Key: http.MethodHead, Description: ""}
	MethodPost    = Method{Key: http.MethodPost, Description: ""}
	MethodPut     = Method{Key: http.MethodPut, Description: ""}
	MethodPatch   = Method{Key: http.MethodPatch, Description: ""}
	MethodDelete  = Method{Key: http.MethodDelete, Description: ""}
	MethodConnect = Method{Key: http.MethodConnect, Description: ""}
	MethodOptions = Method{Key: http.MethodOptions, Description: ""}
	MethodTrace   = Method{Key: http.MethodTrace, Description: ""}
)
View Source
var (
	ProtocolHTTP  = Protocol{Key: "http", Description: ""}
	ProtocolHTTPS = Protocol{Key: "https", Description: ""}
	ProtocolWS    = Protocol{Key: "ws", Description: ""}
	ProtocolWSS   = Protocol{Key: "wss", Description: ""}
)

Functions

This section is empty.

Types

type Method

type Method struct {
	Key         string `json:"key"`
	Description string `json:"description,omitempty"`
}

func MethodFromString

func MethodFromString(s string) Method

func (*Method) MarshalJSON

func (t *Method) MarshalJSON() ([]byte, error)

func (*Method) String

func (t *Method) String() string

func (*Method) UnmarshalJSON

func (t *Method) UnmarshalJSON(data []byte) error

type Options

type Options struct {
	Timeout               int      `json:"timeout,omitempty"`
	IgnoreRedirects       bool     `json:"ignoreRedirects,omitempty"`
	IgnoreReferrer        bool     `json:"ignoreReferrer,omitempty"`
	IgnoreCerts           bool     `json:"ignoreCerts,omitempty"`
	IgnoreCookies         bool     `json:"ignoreCookies,omitempty"`
	ExcludeDefaultHeaders []string `json:"excludeDefaultHeaders,omitempty"`
	ReadCookieJars        []string `json:"readCookieJars,omitempty"`
	WriteCookieJar        string   `json:"writeCookieJar,omitempty"`
	SSLCert               string   `json:"sslCert,omitempty"`
	UserAgentOverride     string   `json:"userAgentOverride,omitempty"`
}

func (*Options) Clone

func (o *Options) Clone() *Options

func (*Options) Empty

func (o *Options) Empty() bool

func (*Options) Merge

func (o *Options) Merge(data npncore.Data, logger *logrus.Logger) *Options

type Protocol

type Protocol struct {
	Key         string `json:"key"`
	Description string `json:"description,omitempty"`
}

func ProtocolFromString

func ProtocolFromString(s string) Protocol

func (*Protocol) MarshalJSON

func (t *Protocol) MarshalJSON() ([]byte, error)

func (Protocol) Secure

func (t Protocol) Secure() bool

func (Protocol) String

func (t Protocol) String() string

func (*Protocol) UnmarshalJSON

func (t *Protocol) UnmarshalJSON(data []byte) error

type Prototype

type Prototype struct {
	Method   Method                    `json:"method"`
	Protocol Protocol                  `json:"protocol"`
	Domain   string                    `json:"domain"`
	Port     int                       `json:"port,omitempty"`
	Path     string                    `json:"path,omitempty"`
	Query    npncontroller.QueryParams `json:"query,omitempty"`
	Fragment string                    `json:"fragment,omitempty"`
	Headers  header.Headers            `json:"headers,omitempty"`
	Auth     *auth.Auth                `json:"auth,omitempty"`
	Body     *body.Body                `json:"body,omitempty"`
	Options  *Options                  `json:"options,omitempty"`
}

func NewPrototype

func NewPrototype() *Prototype

func PrototypeFromString

func PrototypeFromString(u string) *Prototype

func PrototypeFromURL

func PrototypeFromURL(u *url.URL) *Prototype

func (*Prototype) Clone

func (p *Prototype) Clone() *Prototype

func (*Prototype) ContentLength

func (p *Prototype) ContentLength() int64

func (*Prototype) ContentType

func (p *Prototype) ContentType() string

func (*Prototype) ExcludesHeader

func (p *Prototype) ExcludesHeader(k string) bool

func (*Prototype) FinalHeaders

func (p *Prototype) FinalHeaders(sess *session.Session) header.Headers

func (*Prototype) FullPathString

func (p *Prototype) FullPathString() string

func (*Prototype) GetCookies

func (p *Prototype) GetCookies() header.Cookies

func (*Prototype) Host

func (p *Prototype) Host() string

func (*Prototype) Merge

func (p *Prototype) Merge(data npncore.Data, logger *logrus.Logger) *Prototype

func (*Prototype) Minify

func (p *Prototype) Minify() *Prototype

func (*Prototype) Normalize

func (p *Prototype) Normalize() *Prototype

func (*Prototype) SetCookies

func (p *Prototype) SetCookies(cookies header.Cookies)

func (*Prototype) ToHTTP

func (p *Prototype) ToHTTP(sess *session.Session) *http.Request

func (*Prototype) Trim

func (p *Prototype) Trim()

func (*Prototype) URL

func (p *Prototype) URL() *url.URL

func (*Prototype) URLParts

func (p *Prototype) URLParts() []*URLPart

func (*Prototype) URLString

func (p *Prototype) URLString() string

type Request

type Request struct {
	Key         string     `json:"key,omitempty"`
	Title       string     `json:"title,omitempty"`
	Description string     `json:"description,omitempty"`
	Prototype   *Prototype `json:"prototype"`
}

func FromString

func FromString(key string, content string) (*Request, error)

func (*Request) Merge

func (r *Request) Merge(data npncore.Data, logger *logrus.Logger) *Request

func (*Request) Minify

func (r *Request) Minify() *Request

func (*Request) Normalize

func (r *Request) Normalize(key string) *Request

func (*Request) Options

func (r *Request) Options() *Options

func (*Request) TitleWithFallback

func (r *Request) TitleWithFallback() string

type Requests

type Requests []*Request

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(multiuser bool, f npncore.FileLoader, logger *logrus.Logger) *Service

func (*Service) Delete

func (s *Service) Delete(userID *uuid.UUID, coll string, key string) error

func (*Service) List

func (s *Service) List(userID *uuid.UUID, c string) (Summaries, error)

func (*Service) Load

func (s *Service) Load(userID *uuid.UUID, c string, f string) (*Request, error)

func (*Service) LoadAll

func (s *Service) LoadAll(userID *uuid.UUID, c string) (Requests, error)

func (*Service) Save

func (s *Service) Save(userID *uuid.UUID, coll string, originalKey string, req *Request) error

type Summaries

type Summaries []*Summary

type Summary

type Summary struct {
	Key         string `json:"key,omitempty"`
	Title       string `json:"title,omitempty"`
	Description string `json:"description,omitempty"`
	URL         string `json:"url,omitempty"`
	Order       int    `json:"order,omitempty"`
}

func (*Summary) Matches

func (r *Summary) Matches(q string) (bool, string, string, string)

func (*Summary) TitleWithFallback

func (r *Summary) TitleWithFallback() string

type URLPart

type URLPart struct {
	Key   string `json:"k,omitempty"`
	Value string `json:"v,omitempty"`
}

Jump to

Keyboard shortcuts

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