Giter VIP home page Giter VIP logo

squareupw's Introduction

Package squareupw implements a wrapper for SquareUp API for Go (Golang).

API endpoints

Current version support following API endpoints:

Business & Locations

  • Retrieve Business
  • List Locations

Employee

  • Create Employee
  • Update Employee
  • List Employees
  • Retrieve Employee

Role

  • Create Role
  • Update Role
  • List Roles
  • Retrieve Role

Example

    //  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)
}

Pagination

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)
}

squareupw's People

Contributors

andreev1024 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.