http

package
v0.0.0-...-ccb11bd Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package http GENERATED BY gengo:runtimedoc DON'T EDIT THIS FILE

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Do

type Do struct {
	task.Task

	// http method
	Method string `json:"method"`
	// http request url
	Url string `json:"url"`
	// http headers
	Header map[string]client.StringOrSlice `json:"header,omitempty"`
	// http query
	Query map[string]client.StringOrSlice `json:"query,omitempty"`
	// http request body
	RequestBody file.StringOrFile `json:"body,omitempty"`

	// options
	With DoOption `json:"with,omitempty"`

	// Response
	Response Response `json:"-" output:"response"`
}

Do http request

func (*Do) Do

func (r *Do) Do(ctx context.Context) error

func (Do) RuntimeDoc

func (v Do) RuntimeDoc(names ...string) ([]string, bool)

type DoOption

type DoOption struct {
	// header keys for result
	ExposeHeaders []string `json:"exposeHeaders"`
}

func (DoOption) RuntimeDoc

func (v DoOption) RuntimeDoc(names ...string) ([]string, bool)

type Fetch

type Fetch struct {
	task.Task

	// http request url
	Url string `json:"url"`
	// hit by response header
	HitBy string `json:"hitBy,omitempty" default:"etag"`

	// fetched file
	File file.File `json:"-" output:"file"`
}

Fetch http resource to local cache

func (*Fetch) Do

func (r *Fetch) Do(ctx context.Context) (e error)

func (Fetch) RuntimeDoc

func (v Fetch) RuntimeDoc(names ...string) ([]string, bool)

type Response

type Response struct {
	// status code
	Status int `json:"status,omitempty"`
	// response header, only pick headers requests by `with.header`
	Header map[string]client.StringOrSlice `json:"header,omitempty"`
	// auto unmarshal based on content-type
	Data any `json:"data,omitempty"`
}

func (Response) RuntimeDoc

func (v Response) RuntimeDoc(names ...string) ([]string, bool)

Jump to

Keyboard shortcuts

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