From 6d74ccd2cc720c38cf9328f4ab5ab1d0bb7856b3 Mon Sep 17 00:00:00 2001 From: James Holdren Date: Tue, 8 Aug 2023 10:49:44 -0400 Subject: [PATCH] class: swich parent ref to struct from string (#5) --- class.go | 16 ++++++++++------ client.go | 24 ++++++++++++------------ 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/class.go b/class.go index b961071..3ffbc63 100644 --- a/class.go +++ b/class.go @@ -8,12 +8,16 @@ import ( ) type Class struct { - ID string `json:"Id,omitempty"` - Name string `json:",omitempty"` - SyncToken string `json:",omitempty"` - ParentRef string `json:",omitempty"` - SubClass bool `json:",omitempty"` - FullyQualifiedName string `json:",omitempty"` + ID string `json:"Id,omitempty"` + Name string `json:",omitempty"` + SyncToken string `json:",omitempty"` + ParentRef ParentRef `json:",omitempty"` + SubClass bool `json:",omitempty"` + FullyQualifiedName string `json:",omitempty"` +} + +type ParentRef struct { + Value string `json:"value"` } // GetClasses fetches classes based on a page size diff --git a/client.go b/client.go index bb52027..53c5274 100644 --- a/client.go +++ b/client.go @@ -7,18 +7,18 @@ Package quickbooks provides access to Intuit's QuickBooks Online API. NOTE: This library is very incomplete. I just implemented the minimum for my use case. Pull requests welcome :) - // Do this after you go through the normal OAuth process. - var client = oauth2.NewClient(ctx, tokenSource) - - // Initialize the client handle. - var qb = quickbooks.Client{ - Client: client, - Endpoint: quickbooks.SandboxEndpoint, - RealmID: "some company account ID"' - } - - // Make a request! - var companyInfo, err = qb.FetchCompanyInfo() + // Do this after you go through the normal OAuth process. + var client = oauth2.NewClient(ctx, tokenSource) + + // Initialize the client handle. + var qb = quickbooks.Client{ + Client: client, + Endpoint: quickbooks.SandboxEndpoint, + RealmID: "some company account ID"' + } + + // Make a request! + var companyInfo, err = qb.FetchCompanyInfo() */ package quickbooks