##Summary Square API for Golang. See the api documentation for further details. See the go docs for details on this lib.
##Notes
Every method in the the Connect V1 API is accounted for in the lib.
Additionally every method has a corresponding *BatchRequest
method,
that returns a *BatchRequest
object that can be added to an array
and sent as a BatchRequest using the SubmitBatch
method.
There are two exceptions, SubmitBatch
itself, which is prohibited by Square
explicitly, and UploadItemImage
, which doesn't work for obvious reasons.
There are several utilities and functions you should be aware of for your benefit:
-
Square will sometimes paginate results on large get request. On any method for which this is possible, the method will return a
NextRequest
object, which will benil
if there is no "next" result but will be present when there is. TheNextRequest
object has two convenient methodsGetNextRequest
, which takes an expected result object as an argument, and will, itself, return anotherNextRequest
object if there is an additional one, andGetNextRequestAsBatchRequest
, which will return the request as aBatchRequest
object which can be sent along with otherBatchRequest
s inSubmitBatch
. Finally if anyBatchRequest
object has pagination theBatchResponse
object will be populated with aNextRequest
member, which can be used the same as discussed above. -
GeneratePermissionURL
is a method you can use to generate a url, based on your square client id, that will give redirect anyone who clicks it to a square signin screen asking if they would like to give your application permission to access their data (along with the specific permissions you ask for in thescope
argument). Should the user grant your application permission you can also add a redirect url in the method (thelocale
argument) along with any state you'd like to transfer between requests (thestate
argument). See Square's Oauth docs for details. -
The
GetToken
method gets a first time token based on the authorization code you get when someone grants your application permission to access their square account. TheRenewToken
method, obviously, allows you to renew the token based on the expired token (the grace period for an old, expired token being able to get your application a renewed token, is 30 days). -
ValidateWebhook
validates a Square-initiated webhook request to your application is.