https://github.com/toggl/go-teamweek
Teamweek API in Go
https://github.com/toggl/go-teamweek
backend teamweek
Last synced: about 2 months ago
JSON representation
Teamweek API in Go
- Host: GitHub
- URL: https://github.com/toggl/go-teamweek
- Owner: toggl
- License: mit
- Created: 2019-06-17T18:42:30.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2021-04-27T11:02:02.000Z (about 5 years ago)
- Last Synced: 2025-08-15T15:48:40.232Z (10 months ago)
- Topics: backend, teamweek
- Language: Go
- Homepage:
- Size: 26.4 KB
- Stars: 0
- Watchers: 20
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
go-teamweek
===========
[Go](http://golang.org) library for accessing the [Toggl.Plan API](https://developers.plan.toggl.com/api-v4.html)
[](https://github.com/toggl/go-teamweek/actions?query=workflow%3ACI)
### Usage ###
```go
import "github.com/toggl/go-teamweek"
```
Create a new Teamweek client instance, then use provided methods on the client to
access the API. For example, to list all accounts:
```go
client := teamweek.NewClient(nil)
accounts, err := client.ListAccounts()
```
### Authentication ###
The go-teamweek library does not directly handle authentication. Instead, when
creating a new client, pass an `http.Client` that can handle authentication for
you. The easiest way to do this is using the [goauth2][] library, but you can
always use any other library that provides an `http.Client`. If you have an OAuth2
access token, you can use it with the goauth2 using:
```go
t := &oauth.Transport{
Token: &oauth.Token{AccessToken: "... your access token ..."},
}
client := teamweek.NewClient(t.Client())
// Get authenticated user's profile information
profile, err := client.GetUserProfile()
```
See the [goauth2 docs][] for complete instructions on using that library.
[goauth2]: https://code.google.com/p/goauth2/
[goauth2 docs]: http://godoc.org/code.google.com/p/goauth2/oauth