schmorrison / Zoho

Golang API for Zoho services
MIT License
35 stars 34 forks source link

InvoiceAPIEndpoint does not respect SetZohoTLD(s string) #30

Closed Jammizzle closed 3 years ago

Jammizzle commented 3 years ago

With InvoiceApiEndpoint being a const, any use outside of .com will not succeed

schmorrison commented 3 years ago

Ok thank you. I think I can issue a simple fix.

Jammizzle commented 3 years ago

Possibly moving the InvoiceAPIEndpoint const into a

var (
    InvoiceAPIEndpoint string = "https://invoice.zoho.com/api/v3/"
)

// SetZohoTLD can be used to set the TLD extension for API calls for example for Zoho in EU and China.
// by default this is set to "com", other options are "eu" and "ch"
func (z *API) SetZohoTLD(s string) {
    InvoiceAPIEndpoint = fmt.Sprintf("https://invoice.zoho.%s/api/v3/", s)
}

To match the main package?

Jammizzle commented 3 years ago

Can then optionally add the

InvoiceAPIEndpoint = fmt.Sprintf("https://invoice.zoho.%s/api/v3/", z.ZohoTLD)

Into the New function in invoice.go:38

schmorrison commented 3 years ago

Ok, that woulda worked.

I just did a search and replace regex across that folder. I pushed the change to issue-30, just wanted to merge the last PR before I pulled this in. I think I can place a few updates under a tag single revision.