{"id":25839736,"url":"https://github.com/goparrot/square-connect-plus","last_synced_at":"2025-03-01T04:34:15.311Z","repository":{"id":41973650,"uuid":"237393943","full_name":"goparrot/square-connect-plus","owner":"goparrot","description":"Typescript library which extends the official Square Connect APIs library with additional functionality","archived":false,"fork":false,"pushed_at":"2024-08-16T10:21:47.000Z","size":144,"stargazers_count":4,"open_issues_count":5,"forks_count":0,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-02-20T18:47:27.428Z","etag":null,"topics":["library","node","retry","square-connect","typescript"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/goparrot.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-31T09:01:04.000Z","updated_at":"2024-08-16T10:21:50.000Z","dependencies_parsed_at":"2024-08-16T11:29:27.347Z","dependency_job_id":"8fce2ec9-aff3-485f-90aa-10de8998a656","html_url":"https://github.com/goparrot/square-connect-plus","commit_stats":{"total_commits":30,"total_committers":7,"mean_commits":4.285714285714286,"dds":0.6666666666666667,"last_synced_commit":"b6812cce3adbe0e765a18e1f22237bc53f2cd7b1"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goparrot%2Fsquare-connect-plus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goparrot%2Fsquare-connect-plus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goparrot%2Fsquare-connect-plus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goparrot%2Fsquare-connect-plus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/goparrot","download_url":"https://codeload.github.com/goparrot/square-connect-plus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241202226,"owners_count":19926565,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["library","node","retry","square-connect","typescript"],"created_at":"2025-03-01T04:34:14.462Z","updated_at":"2025-03-01T04:34:15.297Z","avatar_url":"https://github.com/goparrot.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://github.com/goparrot/square-connect-plus/workflows/CI/badge.svg?branch=master)](https://github.com/goparrot/square-connect-plus/actions?query=branch%3Amaster+event%3Apush+workflow%3ACI)\n[![Coverage Status](https://coveralls.io/repos/github/goparrot/square-connect-plus/badge.svg?branch=master)](https://coveralls.io/github/goparrot/square-connect-plus?branch=master)\n[![NPM version](https://img.shields.io/npm/v/@goparrot/square-connect-plus)](https://www.npmjs.com/package/@goparrot/square-connect-plus)\n[![Greenkeeper badge](https://badges.greenkeeper.io/goparrot/square-connect-plus.svg)](https://greenkeeper.io/)\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\n# Square Connect Plus\n\n**Square Connect Plus** is a Typescript library which extends the official Square Node.js SDK library with additional functionality.\nThe library does not modify request and response payload.\n\n-   [Installation](#installation)\n-   [Usage](#usage)\n-   [Versioning](#versioning)\n-   [Contributing](#contributing)\n-   [Unit Tests](#unit-tests)\n-   [Background](#background)\n-   [License](#license)\n\n## Installation\n\n    $ npm i @goparrot/square-connect-plus square@17.0.0\n\n## Usage\n\n### Simple example\n\n```typescript\nimport { SquareClient } from '@goparrot/square-connect-plus';\nimport { ListLocationsResponse } from 'square';\n\nconst accessToken: string = `${process.env.SQUARE_ACCESS_TOKEN}`;\nconst squareClient: SquareClient = new SquareClient(accessToken);\n\n(async () =\u003e {\n    try {\n        const listLocationsResponse: ListLocationsResponse = await squareClient.getLocationsApi().listLocations();\n        if (listLocationsResponse.errors.length) {\n            throw new Error(`cant fetch locations`);\n        }\n\n        console.info('locations', listLocationsResponse.locations);\n    } catch (error) {\n        console.error(error);\n        // or error as string with stack + request and response payload\n        // console.error(`${error.stack}\\npayload: ${error.toString()}`);\n    }\n})();\n```\n\n### Advanced example\n\n```typescript\nimport { SquareClient, exponentialDelay, retryCondition } from '@goparrot/square-connect-plus';\n\nconst accessToken: string = `${process.env.SQUARE_ACCESS_TOKEN}`;\nconst squareClient: SquareClient = new SquareClient(accessToken, {\n    retry: {\n        maxRetries: 10,\n    },\n    configuration: {\n        timeout: 60_000,\n    },\n    logger: console,\n});\n```\n\n## Available Options\n\n### `retry` Options\n\n| Name           | Type       | Default            | Description                                                                                                                                                                                                                                 |\n| -------------- | ---------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| maxRetries     | `Number`   | `6`                | The number of times to retry before failing.                                                                                                                                                                                                |\n| retryCondition | `Function` | `retryCondition`   | A callback to further control if a request should be retried. By default, the built-in `retryCondition` function is used.                                                                                                                   |\n| retryDelay     | `Function` | `exponentialDelay` | A callback to further control the delay between retried requests. By default, the built-in `exponentialDelay` function is used ([Exponential Backoff](https://developers.google.com/analytics/devguides/reporting/core/v3/errors#backoff)). |\n\n### `originClient` Options\n\nA set of possible settings for the original library.\n\n| Name              | Type     | Default                        | Description                                                               |\n| ----------------- | -------- | ------------------------------ | ------------------------------------------------------------------------- |\n| customUrl         | `String` | `https://connect.squareup.com` | The custom URL against which to resolve every API call's (relative) path. |\n| additionalHeaders | `Object` | `{}`                           | Record\u003cstring, string\u003e                                                    |\n| timeout           | `Number` | `60_000`                       | The default HTTP timeout for all API calls.                               |\n| squareVersion     | `String` | `2021-12-15`                   | The default square api version for all API calls.                         |\n| environment       | `Enum`   | `Environment.Production`       | The default square enviroment for all API calls.                          |\n| accessToken       | `String` | `''`                           | Scoped access token.                                                      |\n\n### `logger` Option\n\nBy default, the built-in `NullLogger` class is used.\nYou can use any logger that fits the built-in `ILogger` interface\n\n## Versioning\n\nSquare Connect Plus follows [Semantic Versioning](http://semver.org/).\n\n## Contributing\n\nSee [`CONTRIBUTING`](https://github.com/goparrot/square-connect-plus/blob/master/CONTRIBUTING.md#contributing) file.\n\n## Unit Tests\n\nIn order to run the test suite, install the development dependencies:\n\n    $ npm i\n\nThen, run the following command:\n\n    $ npm run coverage\n\n## License\n\nSquare Connect Plus is [MIT licensed](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoparrot%2Fsquare-connect-plus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoparrot%2Fsquare-connect-plus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoparrot%2Fsquare-connect-plus/lists"}