Go-http-client: An enhanced http client for Golang

Overview

go-http-client

go-http-client

An enhanced http client for Golang

Documentation on go.dev 🔗

Coverage awesome

This package provides you a http client package for your http requests. You can send requests quicly with this package. If you want to contribute this package, please fork and create a pull request.

Installation

$ go get -u github.com/bozd4g/go-http-client/

Usage

import (
	"encoding/json"
	"fmt"
	client "github.com/bozd4g/go-http-client"
)

type Todo struct {
    Id        int
    UserId    int
    Title     string
    Completed bool
}

func main() {
    httpClient := client.New("https://jsonplaceholder.typicode.com/")
    request, err := httpClient.Get("posts/10")
    
    if err != nil {
        panic(err)
    }
    
    response, err := httpClient.Do(request)
    if err != nil {
        panic(err)
    }
    
    var todo Todo
    err = json.Unmarshal(response.Get().Body, &todo)
    if err != nil {
        panic(err)
    }
    fmt.Println(todo.Title) // Lorem ipsum dolor sit amet

    // or  
    var todo2 Todo     
    response, err = httpClient.Do(request)
    if err == nil {
        response.To(&todo2)
        fmt.Println(todo2.Title) // Lorem ipsum dolor sit amet
    } else {
        fmt.Println(err.Error())
    }
}

Functions

You can call these functions from your application.

Function Has Params
Get(endpoint string) -
GetWith(endpoint string, params interface {}) Yes
Post(endpoint string) -
PostWith(endpoint string, params interface {}) Yes
Patch(endpoint string) -
PatchWith(endpoint string, params interface{}) Yes
Put(endpoint string) -
PutWith(endpoint string, params interface{}) Yes
Delete(endpoint string) -
DeleteWith(endpoint string, params interface{}) Yes
Do() (Response, error) -
To(value interface{}) -

License

Copyright (c) 2020 Furkan Bozdag

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Releases(v0.1.4)
Owner
Furkan Bozdag
no pointers to point to anything.
Furkan Bozdag
Clusterpedia-client - clusterpedia-client supports the use of native client-go mode to call the clusterpedia API

clusterpedia-client supports the use of native client-go mode to call the cluste

Calvin Chen 4 Jan 7, 2022
Client-go - Clusterpedia-client supports the use of native client-go mode to call the clusterpedia API

clusterpedia-client supports the use of native client-go mode to call the cluste

clusterpedia.io 7 Jun 17, 2022
Client-server-golang-sqs - Client Server with SQS and golang

Client Server with SQS and golang Multi-threaded client-server demo with Go What

null 0 Feb 14, 2022
⚡️ SharePoint authentication, HTTP client & fluent API wrapper for Go (Golang)

Gosip - SharePoint authentication, HTTP client & fluent API wrapper for Go (Golang) Main features Unattended authentication using different strategies

Andrew Koltyakov 79 Jun 18, 2022
Go client for wit.ai HTTP API

This repository is community-maintained. We gladly accept pull requests. Please see the Wit HTTP Reference for all supported endpoints. Go client for

Wit.ai 120 Jun 15, 2022
Client for the cloud-iso-client

cloud-iso-client Client for the cloud-iso-client. Register an API token Before using this client library, you need to register an API token under your

Virtomize 0 Dec 6, 2021
Nutanix-client-go - Go client for the Nutanix Prism V3 API

nutanix-client-go This repository contains portions of the Nutanix API client code in nutanix/terraform-provider-nutanix. It has been extracted to red

Marvin Beckers 0 Jan 6, 2022
Aoe4-client - Client library for aoe4 leaderboards etc

AOE4 Client Overview This is a go client used to query AOE4 data from either the

Mark Smith 0 Jan 18, 2022
Balabola-go-client - GO client for Yandex balabola service

Balabola GO Client GO client for Yandex balabola service Yandex warning The neur

Konovalov Maxim 0 Jan 29, 2022
Golang client for ethereum json rpc api

Ethrpc Golang client for ethereum JSON RPC API. web3_clientVersion web3_sha3 net_version net_peerCount net_listening eth_protocolVersion eth_syncing e

Andrey 234 Jun 18, 2022
A golang client for the Twitch v3 API - public APIs only (for now)

go-twitch Test CLIENT_ID="<my client ID>" go test -v -cover Usage Example File: package main import ( "log" "os" "github.com/knspriggs/go-twi

Kristian Spriggs 21 May 10, 2021
a Go (Golang) MusicBrainz WS2 client library - work in progress

gomusicbrainz a Go (Golang) MusicBrainz WS2 client library - a work in progress. Current state Currently GoMusicBrainz provides methods to perform sea

Michael Wendland 45 May 3, 2022
Golang client for LastPass

Go client for LastPass Features login via user name and master password two-factor authentication with out-of-band mechanism such as push notification

David Ansari 28 Jun 29, 2022
Golang Mixpanel Client

mixpanel Mixpanel Go Client Donate to 1P8ccYhVt4ByLahuVXiCY6U185gmYA8Rqf Usage import "github.com/dukex/mixpanel" -- documentation on godoc Examples T

Duke 46 Jun 23, 2022
Golang client for PayPal REST API

Go client for PayPal REST API Coverage POST /v1/oauth2/token POST /v1/identity/openidconnect/tokenservice GET /v1/identity/openidconnect/userinfo/?sch

Alex Pliutau 500 Jun 16, 2022
An API client for the Notion API implemented in Golang

An API client for the Notion API implemented in Golang

Anatoly Nosov 304 Jun 22, 2022
The client of NodeStatus / Golang Version

NodeStatus-client-go The client of NodeStatus written in Golang 使用说明 请直接下载release下的对应平台的二进制文件。 运行时需传入客户端对应参数。 假设你的服务端地址是https://tz.mydomain.com,客户端用户名

神楽坂みずき 19 Jun 1, 2022
This is the GoLang ApiDQ API client

ApiDQ API GoLang Client This is the GoLang ApiDQ API client. This library allows using of the actual API version. You can find more info in the docume

Nikita Krasnikov 1 Oct 19, 2021
golang client for illumina's basespace

a REST API client communicate with Illumina's BaseSpace The easist way to get a corresponding token https://developer.basespace.illumina.com/docs/cont

Jingtao 0 Jan 10, 2022