Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
**/*{.,-}min.js
types-test.ts
tsconfig.types.json
*.d.ts
10 changes: 10 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@ jobs:
node-version: "16"
- run: npm install
- run: npm run lint

types:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22"
- run: npm install
- run: npm run test:types
4 changes: 3 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ Makefile
tests
.travis*
*.tgz
*.md
*.md
types-test.ts
tsconfig.types.json
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,21 @@ In order to manage the lifetime of your access token and minimize the number of

As calls are asynchronous, use `await` when executing API calls, otherwise the calls will not use the cached token.

### TypeScript

Type declarations ship with the package. There is no separate `@types` package to install.

```typescript
import api from "gettyimages-api";

const client = new api({ apiKey: "your_api_key", apiSecret: "your_api_secret" });
const response = await client.searchimages().withPhrase("beach").withPageSize(1).execute();
```

Builders named in the singular, such as `withCollectionCode`, accept either a single value or
an array of values. Responses are typed as `any`, because the API returns different fields
depending on the endpoint, the requested response fields, and your products.

## Examples

Ensure that `"type": "module"` is set in your `package.json` to enable ES Modules and async/await support.
Expand Down
Loading
Loading