You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This package provides a generic `go` client template for an HTTP API
12
+
This is an unofficial client library for interacting with the [Plunk API](https://next-wiki.useplunk.com/) using Go.
13
+
14
+

15
+
13
16
14
17
## Installation
15
18
16
-
`go-http-client` is compatible with modern Go releases in module mode, with Go installed:
19
+
Make sure your project is using Go Modules (it will have a `go.mod` file in its root if it already is):
17
20
18
-
```bash
19
-
go get github.com/NdoleStudio/go-http-client
21
+
```sh
22
+
go mod init
20
23
```
21
24
22
-
Alternatively the same can be achieved if you use `import` in a package:
25
+
Then, reference plunk-go in a Go program with `import`:
23
26
24
27
```go
25
-
import"github.com/NdoleStudio/go-http-client"
28
+
import (
29
+
"github.com/NdoleStudio/plunk-go"
30
+
)
31
+
```
32
+
33
+
Run any of the normal `go` commands (`build`/`install`). The Go toolchain will resolve and fetch the plunk-go module automatically. Alternatively, you can also explicitly `go get` the package into a project:
34
+
35
+
```bash
36
+
go get github.com/NdoleStudio/plunk-go
26
37
```
27
38
28
39
29
40
## Implemented
30
41
31
-
-[Status Codes](#status-codes)
32
-
-`GET /200`: OK
42
+
- Contacts
43
+
-`POST /contacts`: Create a new contact or update existing (upsert by email)
44
+
-`DELETE /contacts/{id}`: Permanently delete a contact
45
+
-`GET /contacts`: Get a paginated list of contacts with cursor-based pagination
33
46
34
47
## Usage
35
48
36
49
### Initializing the Client
37
50
38
-
An instance of the client can be created using `New()`.
51
+
An instance of the client can be created using `plunk.New()`.
39
52
40
53
```go
41
54
package main
42
55
43
56
import (
44
-
"github.com/NdoleStudio/go-http-client"
57
+
"github.com/NdoleStudio/plunk-go"
45
58
)
46
59
47
60
funcmain() {
48
-
statusClient:=client.New(client.WithDelay(200))
61
+
plunkClient:=plunk.New(plunk.WithSecretKey(/* Secret Key from https://next-app.useplunk.com/settings?tab=general*/))
49
62
}
50
63
```
51
64
@@ -54,24 +67,20 @@ func main() {
54
67
All API calls return an `error` as the last return object. All successful calls will return a `nil` error.
0 commit comments