Documentation ¶
Index ¶
- Constants
- Variables
- func Address(interpreter *funny.Funny, args []funny.Value) funny.Value
- func BuildHTML(input []byte) string
- func Capitalize(str string) string
- func CreateHttpRequest(req *ApiRequest, runner *APIRunner) (httpReq *http.Request, err error)
- func Domain(interpreter *funny.Funny, args []funny.Value) funny.Value
- func Email(interpreter *funny.Funny, args []funny.Value) funny.Value
- func Format(filename string, save, print bool) (string, error)
- func FullName(interpreter *funny.Funny, args []funny.Value) funny.Value
- func GenDocument(apiRunner *APIRunner, output string) error
- func HttpHeaders2VmMap(httpHeader http.Header) map[string]funny.Value
- func Init(filename, templateName string) error
- func Phone(interpreter *funny.Funny, args []funny.Value) funny.Value
- func Serve(filename string, port int) error
- func TSafeJson(obj interface{}) string
- func VersionCommit(commitFile, commitMsg string)
- func VersionLog(filename string)
- func VmMap2HttpHeaders(vmMap map[string]funny.Value) http.Header
- func Words(interpreter *funny.Funny, args []funny.Value) funny.Value
- type APIRunner
- type ApiItem
- type ApiRequest
- type ApiResponse
- type ApiVersionController
- type Benchmark
- type InitInfo
- type MarkdownDocGenerator
- type Output
- func (o *Output) CopyRight()
- func (o *Output) Echo(s string)
- func (o *Output) EchoRequstIng(method string, body []byte)
- func (o *Output) EchoStartRequest(request *ApiRequest, runner *APIRunner) error
- func (o *Output) Echoln(s string)
- func (o *Output) ErrorRequest(err error)
- func (o *Output) Finished(count int, names string)
- func (o *Output) Headers(headers http.Header)
- func (o *Output) Json(obj interface{})
- func (o *Output) L(e string) string
- func (o *Output) RepeatLine(e string, count int) string
- func (o *Output) RequestBody(req *http.Request, runner *APIRunner) error
- func (o *Output) ResponseBody(res *http.Response)
- func (o *Output) W(args ...interface{}) *Output
- func (o *Output) Wln(args ...interface{}) *Output
- type PicaContext
- type PostmanScriptsGenerator
- type Project
- type Query
- type ScriptsGenerator
- type Swagger2ScriptsGenerator
- type Task
- type VersionChange
- type VersionNote
Constants ¶
View Source
const (
Version = "0.0.1"
)
Variables ¶
View Source
var DEFAULT_DOC_TEMPLATE = ""
View Source
var DefaultHeaders = map[string]funny.Value{ "Accept": "* /*", "Accept-Language": "en-US,en;q=0.8", "Cache-Control": "max-age=0", "User-Agent": fmt.Sprintf("Pica Api Test Client/%s https://github.com/jerloo/pica", Version), "Connection": "keep-alive", "Referer": "http://www.baidu.com/", "Content-Type": "application/json", }
View Source
var DefaultInitScope = map[string]funny.Value{ "headers": DefaultHeaders, }
View Source
var (
DefaultOutput = NewOutput(true, os.Stdout)
)
View Source
var GenFromPostmanTemplate string
View Source
var PROFILE_HOME = ""
Functions ¶
func CreateHttpRequest ¶
func CreateHttpRequest(req *ApiRequest, runner *APIRunner) (httpReq *http.Request, err error)
func GenDocument ¶
func VersionCommit ¶
func VersionCommit(commitFile, commitMsg string)
func VersionLog ¶
func VersionLog(filename string)
Types ¶
type APIRunner ¶
type APIRunner struct { Filename string APINames []string Delay int APIItems []*ApiItem Block *funny.Block InitLines *funny.Block // contains filtered or unexported fields }
APIRunner the runner
func NewAPIRunnerFromContent ¶
NewAPIRunnerFromContent create a runner from a pica content
func NewAPIRunnerFromFile ¶
NewAPIRunnerFromFile create a runner from a pica file
func (*APIRunner) DoAPIRequest ¶
func (runner *APIRunner) DoAPIRequest(req *ApiRequest) (*http.Response, error)
DoAPIRequest run the api request
func (*APIRunner) ParseAPIItems ¶
ParseAPIItems parse ap items from pica code
func (*APIRunner) RunInitLines ¶
func (runner *APIRunner) RunInitLines()
RunInitLines run the code of initialization
type ApiItem ¶
type ApiItem struct { Request *ApiRequest Response *ApiResponse }
type ApiRequest ¶
type ApiResponse ¶
type ApiVersionController ¶
type ApiVersionController struct { FileName string // contains filtered or unexported fields }
func NewApiVersionController ¶
func NewApiVersionController(filename string) *ApiVersionController
func (*ApiVersionController) Commit ¶
func (v *ApiVersionController) Commit(msg string) (string, error)
func (*ApiVersionController) Diff ¶
func (v *ApiVersionController) Diff(src, dst string) []diffmatchpatch.Diff
func (*ApiVersionController) GetCommits ¶
func (v *ApiVersionController) GetCommits() ([]*object.Commit, error)
func (*ApiVersionController) Notes ¶
func (v *ApiVersionController) Notes() (*VersionNote, error)
type Benchmark ¶
type Benchmark struct { //TotalRequests is the total number of requests to be fired. TotalRequests uint64 //BenchDuration is the duration over which all the requests are fired, in milliseconds. BenchDuration uint64 //WaitPerReq is the duration to wait before firing the consecutive request WaitPerReq time.Duration //ShowProgress is set to true if it should display current stat when the benchmark is running/in progress. ShowProgress bool //StatReqCount is the number of requests processed after which progress statistics is printed StatReqCount uint64 // contains filtered or unexported fields }
Benchmark holds all the parameters required to run the benchmark and respective methods
func (*Benchmark) Done ¶
Done does all the operations & calculation required while ending a function call
func (*Benchmark) Final ¶
func (bA *Benchmark) Final()
Final prints all the statistics of the benchmark The input to Final() is the time when you start the benchmark
func (*Benchmark) Init ¶
func (bA *Benchmark) Init()
Init initializes all the fields with their respective values
type MarkdownDocGenerator ¶
type MarkdownDocGenerator struct {
// contains filtered or unexported fields
}
func NewMarkdownDocGenerator ¶
func NewMarkdownDocGenerator(runner *APIRunner, theme, output string) *MarkdownDocGenerator
func (*MarkdownDocGenerator) Get ¶
func (g *MarkdownDocGenerator) Get() ([]byte, error)
type Output ¶
func (*Output) EchoRequstIng ¶
func (*Output) EchoStartRequest ¶
func (o *Output) EchoStartRequest(request *ApiRequest, runner *APIRunner) error
func (*Output) ErrorRequest ¶
func (*Output) RequestBody ¶
func (*Output) ResponseBody ¶
type PicaContext ¶
type PicaContext struct { Name string Description string Author string Version string PicaVersion string MaxArrayShowRows int ApiItems []*ApiItem Headers map[string]funny.Value VersionNotes *VersionNote }
func PicaContextFromRunner ¶
func PicaContextFromRunner(runner *APIRunner) *PicaContext
type PostmanScriptsGenerator ¶
type PostmanScriptsGenerator struct { }
func (*PostmanScriptsGenerator) Generate ¶
func (generator *PostmanScriptsGenerator) Generate(filename string) string
func (*PostmanScriptsGenerator) Name ¶
func (generator *PostmanScriptsGenerator) Name() string
type Project ¶
type Project struct { Name string Version string Author string CreatedAt string LastRunAt string Tasks map[string][]*Task }
func NewProject ¶
type ScriptsGenerator ¶
func NewScriptsGenerator ¶
func NewScriptsGenerator(name string) ScriptsGenerator
type Swagger2ScriptsGenerator ¶
type Swagger2ScriptsGenerator struct { }
func (*Swagger2ScriptsGenerator) Generate ¶
func (generator *Swagger2ScriptsGenerator) Generate(filename string) string
func (*Swagger2ScriptsGenerator) Name ¶
func (generator *Swagger2ScriptsGenerator) Name() string
type VersionChange ¶
type VersionChange struct { Commit *object.Commit Diffs []diffmatchpatch.Diff }
type VersionNote ¶
type VersionNote struct {
Changes []VersionChange
}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.