Package squareupw implements a wrapper for SquareUp API for Go (Golang).
Current version support following API endpoints:
- Retrieve Business
- List Locations
- Create Employee
- Update Employee
- List Employees
- Retrieve Employee
- Create Role
- Update Role
- List Roles
- Retrieve Role
// Notice: error handling skipped for simplicity
token := "123456789"
api := squareupw.NewAPI(token)
p := squareupw.UpdateEmployeeParams{
FirstName: "Andrey",
LastName: "Andreev",
CommonOptionalEmployeeParams: &squareupw.CommonOptionalEmployeeParams{
RoleIds: []string{"ZCZ0AzjPpVDUTMdMpdF3"}},
}
resp, err := api.UpdateEmployee("G7cAQQKTMk05R78mIQvZ", p)
// resp, _ := api.RetrieveEmployee("G7cAQQKTMk05R78mIQvZ")
p := squareupw.RoleParams{
Name: "Test",
Permissions: []string{squareupw.RegisterAccessSalesHistory},
IsOwner: false,
}
resp, err := api.CreateRole(p)
}
List endpoints might paginate the results they return. This means that instead of returning all results in a single response, these endpoints might return some of the results, along with a response header that links to the next set of results.
p := squareupw.ListRolesParams{Order: "desc", Limit: "5"}
resp, link, err := api.ListRoles(p)
if len(link) > 1 {
additionalResp, link, e := api.ListRolesByLink(link)
}