Categorygithub.com/propeldata/go-client
repositorypackage
0.0.0-20241126215327-d36b2c976a60
Repository: https://github.com/propeldata/go-client.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

Propel Go client

Installing

Use go get to add it to your project's Go module dependencies.

go get github.com/propeldata/go-client

Usage

  1. Import the Propel go client package
import (
	"github.com/propeldata/go-client"
)
  1. Generate an OAuth token. This step requires having a Propel account and an application. Learn more about the API authentication here.
oauthClient := client.NewOauthClient()

oauthToken, err := oauthClient.OAuthToken(ctx, "APPLICATION_ID", "APPLICATION_SECRET")
if err != nil {
    return errors.New("Invalid Propel credentials")
}
  1. Initialize the Propel client with the retrieved token.
apiClient := client.NewApiClient(oauthToken.AccessToken)
  1. Perform any API request.
dataSource, err := apiClient.FetchDataSource(ctx, "dataSourceUniqueName")
if err != nil {
	return err
}