Skip to content

Commit fcfb2b5

Browse files
committed
Updated README
1 parent bb8ebdd commit fcfb2b5

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

README.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,18 @@ This repository contains a generic HTTP client which can be adapted to provide:
88
* Ability to send data of type `application/x-www-form-urlencoded`
99
* Debugging capabilities to see the request and response data
1010

11+
Documentation: https://pkg.go.dev/github.com/mutablelogic/go-client/pkg/client
12+
13+
There are also some example API clients:
14+
15+
* [Bitwarden Client](https://github.com/mutablelogic/go-client/tree/main/pkg/bitwarden)
16+
* [Elevenlabs Client](https://github.com/mutablelogic/go-client/tree/main/pkg/elevenlabs)
17+
* [Home Assistant Client](https://github.com/mutablelogic/go-client/tree/main/pkg/homeassistant)
18+
* [IPify Client](https://github.com/mutablelogic/go-client/tree/main/pkg/ipify)
19+
* [Mistral API Client](https://github.com/mutablelogic/go-client/tree/main/pkg/mistral)
20+
* [NewsAPI client](https://github.com/mutablelogic/go-client/tree/main/pkg/newsapi)
21+
* [OpenAI client](https://github.com/mutablelogic/go-client/tree/main/pkg/openai)
22+
1123
## Basic Usage
1224

1325
The following example shows how to decode a response from a GET request
@@ -112,7 +124,7 @@ type Payload interface {
112124
}
113125
```
114126

115-
### Request options
127+
## Request options
116128

117129
The signature of the `Do` method is:
118130

@@ -135,7 +147,7 @@ Various options can be passed to modify each individual request when using the `
135147
* `OptHeader(key, value string)` appends a custom header to the request
136148

137149

138-
### Authentication
150+
## Authentication
139151

140152
The authentication token can be set as follows:
141153

@@ -159,3 +171,14 @@ func main() {
159171
// ...
160172
}
161173
```
174+
175+
You can also set the token on a per-request basis using the `OptToken` option in call to the `Do` method.
176+
177+
## Form submission
178+
179+
You can create a payload with form data:
180+
181+
* `client.NewFormRequest(payload any, accept string)` returns a new request with a Form data payload which defaults to POST.
182+
* `client.NewMultipartRequest(payload any, accept string)` returns a new request with a Multipart Form data payload which defaults to POST. This is useful for file uploads.
183+
184+
The payload should be a `struct` where the fields are converted to form tuples. File uploads require a field of type `multipart.File`.

0 commit comments

Comments
 (0)