Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/haydenbleasel/atlassian-ts
A type-safe Typescript client for the Atlassian REST API, powered by openapi-fetch and ky.
https://github.com/haydenbleasel/atlassian-ts
atlassian client ky openapi-fetch typescript
Last synced: 4 days ago
JSON representation
A type-safe Typescript client for the Atlassian REST API, powered by openapi-fetch and ky.
- Host: GitHub
- URL: https://github.com/haydenbleasel/atlassian-ts
- Owner: haydenbleasel
- License: mit
- Created: 2024-08-10T20:28:05.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-11-02T00:18:05.000Z (14 days ago)
- Last Synced: 2024-11-02T01:17:58.701Z (14 days ago)
- Topics: atlassian, client, ky, openapi-fetch, typescript
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/atlassian-ts
- Size: 647 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# atlassian-ts
[![Version](https://img.shields.io/npm/v/atlassian-ts.svg)](https://www.npmjs.org/package/atlassian-ts) [![Build Status](https://github.com/haydenbleasel/atlassian-ts/actions/workflows/push.yml/badge.svg?branch=main)](https://github.com/haydenbleasel/atlassian-ts/actions?query=branch%3Amain)
![atlassian-ts](/sample.png)
A type-safe Typescript client for the Atlassian REST API, powered by openapi-fetch and ky.
## Features
- Full TypeScript support for Atlassian REST API endpoints
- OAuth 2.0 and Basic Authentication support
- Automatic retries with configurable limits
- Built on top of robust libraries: openapi-fetch and ky## Installation
```bash
pnpm add atlassian-ts
```## Usage
You can create a client for either OAuth 2.0 or Basic Authentication.
### OAuth 2.0 Client
For integrations that are not Forge or Connect apps, use OAuth 2.0 authorization code grants (3LO) for security (3LO scopes are shown as for operations OAuth scopes required). Read more [here](https://developer.atlassian.com/cloud/jira/platform/oauth-2-3lo-apps/).
```ts
import { createOauth2Client } from 'atlassian-ts';const client = createOauth2Client({
cloudId: 'your-cloud-id',
accessToken: 'your-access-token',
retries: 3,
});const projects = await client.GET('/rest/api/3/project');
```### Basic Authentication Client
For personal scripts, bots, and ad-hoc execution of the REST APIs use basic authentication. Read more [here](https://developer.atlassian.com/cloud/jira/platform/basic-auth-for-rest-apis/).
```ts
import { createBasicAuthClient } from 'atlassian-ts';const client = createBasicAuthClient({
siteUrl: 'https://your-site.atlassian.net',
email: '[email protected]',
apiToken: 'your-api-token',
retries: 3,
});const projects = await client.GET('/rest/api/3/project');
```