https://github.com/bcc-code/bcc-core-api-go
The Go SDK for the BCC Core API
https://github.com/bcc-code/bcc-core-api-go
Last synced: 12 months ago
JSON representation
The Go SDK for the BCC Core API
- Host: GitHub
- URL: https://github.com/bcc-code/bcc-core-api-go
- Owner: bcc-code
- License: apache-2.0
- Created: 2023-09-11T13:48:07.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-03-13T23:02:30.000Z (over 2 years ago)
- Last Synced: 2024-04-14T02:53:05.259Z (about 2 years ago)
- Language: Go
- Size: 133 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bcc-core-api-go
The Go SDK for the BCC Core API
-------------------------------------
## Documentation
- [Godoc](https://pkg.go.dev/github.com/bcc-code/bcc-core-api-go/bcccoreapi).
## Getting started
### Installation
```sh
go get github.com/bcc-code/bcc-core-api-go
```
### Usage
Create an Core API client by providing the details of your client.
```go
import (
"context"
"fmt"
"log"
"github.com/bcc-code/bcc-core-api-go/bcccoreapi"
)
func main() {
clientID := "EXAMPLE_CLIENT_ID"
clientSecret := "EXAMPLE_CLIENT_SECRET"
// Initialize a new client using a domain, client ID and client secret.
client, err := bcccoreapi.NewClient(
bcccoreapi.WithClientCredentials(
context.Background(),
clientID,
clientSecret,
),
)
if err != nil {
log.Fatalf("failed to initialize the core API client: %+v", err)
}
// Now we can interact with the BCC Core API.
// Fetch a person by Uid
p, err := client.Person.Get(context.Background(), "657a66ca-9cd0-4b61-9476-697016e26fbc")
if err != nil {
log.Fatalf("failed to get a person by Uid: %+v", err)
}
fmt.Println(p.DisplayName)
}
```