Skip to content

Commit 2acb99c

Browse files
authored
Merge pull request #1 from bundleup/claude/api-endpoint-migration-5vvdx7
Rename unify.pm.issues to unify.ticketing.tickets
2 parents 5c1e5c1 + 4e2b4c2 commit 2acb99c

6 files changed

Lines changed: 36 additions & 36 deletions

File tree

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Runnable examples are available in the [`examples/`](./examples) directory:
8686

8787
- [`examples/basic_usage.js`](./examples/basic_usage.js) - Client setup, connections, integrations, and webhooks
8888
- [`examples/proxy_api.js`](./examples/proxy_api.js) - Proxy API GET request with a connection
89-
- [`examples/unify_api.js`](./examples/unify_api.js) - Unify Chat, Git, and PM endpoint usage
89+
- [`examples/unify_api.js`](./examples/unify_api.js) - Unify Chat, Git, and Ticketing endpoint usage
9090
- [`examples/README.md`](./examples/README.md) - Setup and execution instructions
9191

9292
## Quick Start
@@ -840,20 +840,20 @@ console.log('Releases:', result.data);
840840
}
841841
```
842842

843-
#### Project Management API
843+
#### Ticketing API
844844

845-
The PM API provides a unified interface for project management platforms like Jira, Linear, and Asana.
845+
The Ticketing API provides a unified interface for ticketing and project management platforms like Jira, Linear, and Asana.
846846

847-
##### List Issues
847+
##### List Tickets
848848

849849
```javascript
850-
const result = await unify.pm.issues({
850+
const result = await unify.ticketing.tickets({
851851
limit: 100,
852852
after: null,
853853
include_raw: false,
854854
});
855855

856-
console.log('Issues:', result.data);
856+
console.log('Tickets:', result.data);
857857
```
858858

859859
**Response:**
@@ -880,7 +880,7 @@ console.log('Issues:', result.data);
880880
**Filtering and sorting:**
881881

882882
```javascript
883-
const openIssues = result.data.filter(issue => issue.status === 'open');
883+
const openTickets = result.data.filter(ticket => ticket.status === 'open');
884884
const sortedByDate = result.data.sort((a, b) => new Date(b.created_at) - new Date(a.created_at));
885885
```
886886

@@ -950,7 +950,7 @@ src/
950950
│ ├── base.ts # Base Unify class
951951
│ ├── chat.ts # Chat Unify API
952952
│ ├── git.ts # Git Unify API
953-
│ └── pm.ts # PM Unify API
953+
│ └── ticketing.ts # Ticketing Unify API
954954
└── __tests__/ # Test files
955955
```
956956

examples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ node examples/unify_api.js
2626

2727
- `basic_usage.js` — initialize the SDK and list connections, integrations, and webhooks
2828
- `proxy_api.js` — send a GET request through the Proxy API
29-
- `unify_api.js` — call Unify Chat, Git, and PM endpoints
29+
- `unify_api.js` — call Unify Chat, Git, and Ticketing endpoints

examples/unify_api.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ try {
3131
}
3232

3333
try {
34-
const issues = await unify.pm.issues({ limit: 10 });
35-
console.log(`PM issues: ${issues.data?.length ?? 0}`);
34+
const tickets = await unify.ticketing.tickets({ limit: 10 });
35+
console.log(`Ticketing tickets: ${tickets.data?.length ?? 0}`);
3636
} catch (error) {
37-
console.error(`Failed to fetch PM issues: ${error.message}`);
37+
console.error(`Failed to fetch tickets: ${error.message}`);
3838
}

src/__tests__/unify.test.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Unify } from '../unify';
22
import { Chat } from '../unify/chat';
33
import { Git } from '../unify/git';
4-
import { PM } from '../unify/pm';
4+
import { Ticketing } from '../unify/ticketing';
55

66
// Mock the global fetch function
77
global.fetch = jest.fn();
@@ -63,23 +63,23 @@ describe('Unify', () => {
6363
});
6464
});
6565

66-
describe('pm getter', () => {
67-
it('should return a PM instance', () => {
68-
const pm = unify.pm;
69-
expect(pm).toBeInstanceOf(PM);
66+
describe('ticketing getter', () => {
67+
it('should return a Ticketing instance', () => {
68+
const ticketing = unify.ticketing;
69+
expect(ticketing).toBeInstanceOf(Ticketing);
7070
});
7171

72-
it('should create a new PM instance each time', () => {
73-
const pm1 = unify.pm;
74-
const pm2 = unify.pm;
75-
expect(pm1).not.toBe(pm2);
72+
it('should create a new Ticketing instance each time', () => {
73+
const ticketing1 = unify.ticketing;
74+
const ticketing2 = unify.ticketing;
75+
expect(ticketing1).not.toBe(ticketing2);
7676
});
7777

78-
it('should initialize PM with correct apiKey and connectionId', () => {
79-
const pm = unify.pm;
78+
it('should initialize Ticketing with correct apiKey and connectionId', () => {
79+
const ticketing = unify.ticketing;
8080
// Access protected properties for testing
81-
expect((pm as any).apiKey).toBe(apiKey);
82-
expect((pm as any).connectionId).toBe(connectionId);
81+
expect((ticketing as any).apiKey).toBe(apiKey);
82+
expect((ticketing as any).connectionId).toBe(connectionId);
8383
});
8484
});
8585

src/unify.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Chat } from './unify/chat';
22
import { Git } from './unify/git';
3-
import { PM } from './unify/pm';
3+
import { Ticketing } from './unify/ticketing';
44

55
export class Unify {
66
constructor(
@@ -23,9 +23,9 @@ export class Unify {
2323
}
2424

2525
/**
26-
* Access the PM API for the connection.
26+
* Access the Ticketing API for the connection.
2727
*/
28-
get pm() {
29-
return new PM(this.apiKey, this.connectionId);
28+
get ticketing() {
29+
return new Ticketing(this.apiKey, this.connectionId);
3030
}
3131
}

src/unify/pm.ts renamed to src/unify/ticketing.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
import { Base, type Params, type Response } from './base';
22

3-
export class PM extends Base {
4-
protected namespace = 'pm';
3+
export class Ticketing extends Base {
4+
protected namespace = 'ticketing';
55

66
/**
7-
* Fetch issues
8-
* @param limit - Maximum number of issues to retrieve.
7+
* Fetch tickets
8+
* @param limit - Maximum number of tickets to retrieve.
99
* @param after - Cursor for pagination.
1010
* @param include_raw - Whether to include raw response data.
1111
* @returns A promise that resolves to the fetch response.
1212
*/
13-
async issues({ limit = 100, after, include_raw = false }: Params = {}) {
14-
const url = this.buildUrl('issues', { limit, after, include_raw });
13+
async tickets({ limit = 100, after, include_raw = false }: Params = {}) {
14+
const url = this.buildUrl('tickets', { limit, after, include_raw });
1515

1616
const response = await fetch(url, { headers: this.headers });
1717

1818
if (!response.ok) {
19-
throw new Error(`Failed to fetch ${this.namespace}/issues: ${response.statusText}`);
19+
throw new Error(`Failed to fetch ${this.namespace}/tickets: ${response.statusText}`);
2020
}
2121

2222
const data = await response.json();

0 commit comments

Comments
 (0)