Coder Social home page Coder Social logo

ezapi's Introduction

ezapi

import "github.com/paijerry/ezapi"

Install

go get -u -v "github.com/paijerry/ezapi"

Package ezapi can help you call api easier

ezapi.go

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

EzAPI is the main struct of this package

func New() *EzAPI

New create an EzAPI object

func (*EzAPI) Do

func (ez *EzAPI) Do(method string) (rspn Rspn, err error)

Do the http request

func (*EzAPI) Form

func (ez *EzAPI) Form(form url.Values) *EzAPI

Form add form("application/x-www-form-urlencoded") by a url.Values object ("Content-Type", "application/x-www-form-urlencoded")

func (*EzAPI) FormData

func (ez *EzAPI) FormData(form url.Values) *EzAPI

FormData add formdata by a url.Values object (no Content-Type)

func (*EzAPI) Header

func (ez *EzAPI) Header(header http.Header) *EzAPI

Header add head by a http.Header object

func (*EzAPI) JSON

func (ez *EzAPI) JSON(body []byte) *EzAPI

JSON add json of []byte

func (*EzAPI) URL

func (ez *EzAPI) URL(url string) *EzAPI

URL set url

func (*EzAPI) URLQuery

func (ez *EzAPI) URLQuery(urlquery url.Values) *EzAPI

URLQuery add urlquery into url

type Rspn struct {
    Header     http.Header
    Body       []byte
    StatusCode int
}

Rspn - contains response data


Generated by godoc2md

ezapi's People

Contributors

paijerry avatar sun-7 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.