modulepackage
0.0.0-20230321094523-270b7e045150
Repository: https://github.com/jerome-cui/quickbooks-go.git
Documentation: pkg.go.dev
# README
quickbooks-go
quickbooks-go is a Go library that provides access to Intuit's QuickBooks Online API.
NOTE: This library is incomplete. I implemented the minimum for my use case. Pull requests welcome :)
Example
Authorization flow
Before you can initialize the client, you'll need to obtain an authorization code. You can see an example of this from QuickBooks' OAuth Playground.
clientId := "<your-client-id>"
clientSecret := "<your-client-secret>"
realmId := "<realm-id>"
qbClient, err := quickbooks.NewClient(clientId, clientSecret, realmId, false, "", nil)
if err != nil {
log.Fatalln(err)
}
// To do first when you receive the authorization code from quickbooks callback
authorizationCode := "<received-from-callback>"
redirectURI := "https://developer.intuit.com/v2/OAuth2Playground/RedirectUrl"
bearerToken, err := qbClient.RetrieveBearerToken(authorizationCode, redirectURI)
if err != nil {
log.Fatalln(err)
}
// Save the bearer token inside a db
// When the token expire, you can use the following function
bearerToken, err = qbClient.RefreshToken(bearerToken.RefreshToken)
if err != nil {
log.Fatalln(err)
}
// Make a request!
info, err := qbClient.FindCompanyInfo()
if err != nil {
log.Fatalln(err)
}
fmt.Println(info)
// Revoke the token, this should be done only if a user unsubscribe from your app
qbClient.RevokeToken(bearerToken.RefreshToken)
Re-using tokens
clientId := "<your-client-id>"
clientSecret := "<your-client-secret>"
realmId := "<realm-id>"
token := quickbooks.BearerToken{
RefreshToken: "<saved-refresh-token>",
AccessToken: "<saved-access-token>",
}
qbClient, err := quickbooks.NewClient(clientId, clientSecret, realmId, false, "", &token)
if err != nil {
log.Fatalln(err)
}
// Make a request!
info, err := qbClient.FindCompanyInfo()
if err != nil {
log.Fatalln(err)
}
fmt.Println(info)
License
BSD-2-Clause
# Packages
No description provided by the author
# Functions
CallDiscoveryAPI See https://developer.intuit.com/app/developer/qbo/docs/develop/authentication-and-authorization/openid-connect#discovery-document.
NewClient initializes a new QuickBooks client for interacting with their Online API.
NewClient initializes a new QuickBooks client for interacting with their Online API.
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
DiscoveryProductionEndpoint is for live apps.
DiscoverySandboxEndpoint is for testing.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ProductionEndpoint is for live apps.
No description provided by the author
SandboxEndpoint is for testing.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Structs
No description provided by the author
AccountBasedExpenseLineDetail.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Client is your handle to the QuickBooks API.
CompanyInfo describes a company account.
No description provided by the author
Customer represents a QuickBooks Customer object.
No description provided by the author
No description provided by the author
Date represents a Quickbooks date.
No description provided by the author
No description provided by the author
DiscountLineDetail ...
No description provided by the author
EmailAddress represents a QuickBooks email address.
No description provided by the author
No description provided by the author
Failure is the outermost struct that holds an error response.
Invoice represents a QuickBooks Invoice object.
Item represents a QuickBooks Item object (a product type).
Line ...
No description provided by the author
MemoRef represents a QuickBooks MemoRef object.
MetaData is a timestamp of genesis and last change of a Quickbooks object.
No description provided by the author
No description provided by the author
PhysicalAddress represents a QuickBooks address.
No description provided by the author
No description provided by the author
ReferenceType represents a QuickBooks reference to another object.
SalesItemLineDetail ...
TaxLineDetail ...
TelephoneNumber represents a QuickBooks phone number.
TxnTaxDetail ...
No description provided by the author
Vendor describes a vendor.
No description provided by the author
WebSiteAddress represents a Quickbooks Website.
# Type aliases
No description provided by the author
No description provided by the author
No description provided by the author
EndpointUrl specifies the endpoint to connect to.