From 4e2b4c2146f78d3975d9da211631fbc07f3bbdfc Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 15 Jul 2026 08:24:41 +0000 Subject: [PATCH] Rename unify.pm.issues to unify.ticketing.tickets Mirror the Unify API migration from the /pm/issues endpoint to /ticketing/tickets: - Rename src/unify/pm.ts -> ticketing.ts (PM class -> Ticketing, namespace "pm" -> "ticketing", issues() -> tickets()) - Update the unify.ticketing accessor in src/unify.ts - Update tests, README, and examples Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_014zVgT6VdGxc5a96oMxJU87 --- README.md | 16 ++++++++-------- examples/README.md | 2 +- examples/unify_api.js | 6 +++--- src/__tests__/unify.test.ts | 26 +++++++++++++------------- src/unify.ts | 8 ++++---- src/unify/{pm.ts => ticketing.ts} | 14 +++++++------- 6 files changed, 36 insertions(+), 36 deletions(-) rename src/unify/{pm.ts => ticketing.ts} (61%) diff --git a/README.md b/README.md index db8e434..7143b35 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,7 @@ Runnable examples are available in the [`examples/`](./examples) directory: - [`examples/basic_usage.js`](./examples/basic_usage.js) - Client setup, connections, integrations, and webhooks - [`examples/proxy_api.js`](./examples/proxy_api.js) - Proxy API GET request with a connection -- [`examples/unify_api.js`](./examples/unify_api.js) - Unify Chat, Git, and PM endpoint usage +- [`examples/unify_api.js`](./examples/unify_api.js) - Unify Chat, Git, and Ticketing endpoint usage - [`examples/README.md`](./examples/README.md) - Setup and execution instructions ## Quick Start @@ -840,20 +840,20 @@ console.log('Releases:', result.data); } ``` -#### Project Management API +#### Ticketing API -The PM API provides a unified interface for project management platforms like Jira, Linear, and Asana. +The Ticketing API provides a unified interface for ticketing and project management platforms like Jira, Linear, and Asana. -##### List Issues +##### List Tickets ```javascript -const result = await unify.pm.issues({ +const result = await unify.ticketing.tickets({ limit: 100, after: null, include_raw: false, }); -console.log('Issues:', result.data); +console.log('Tickets:', result.data); ``` **Response:** @@ -880,7 +880,7 @@ console.log('Issues:', result.data); **Filtering and sorting:** ```javascript -const openIssues = result.data.filter(issue => issue.status === 'open'); +const openTickets = result.data.filter(ticket => ticket.status === 'open'); const sortedByDate = result.data.sort((a, b) => new Date(b.created_at) - new Date(a.created_at)); ``` @@ -950,7 +950,7 @@ src/ │ ├── base.ts # Base Unify class │ ├── chat.ts # Chat Unify API │ ├── git.ts # Git Unify API -│ └── pm.ts # PM Unify API +│ └── ticketing.ts # Ticketing Unify API └── __tests__/ # Test files ``` diff --git a/examples/README.md b/examples/README.md index 52a9251..9ac6b8c 100644 --- a/examples/README.md +++ b/examples/README.md @@ -26,4 +26,4 @@ node examples/unify_api.js - `basic_usage.js` — initialize the SDK and list connections, integrations, and webhooks - `proxy_api.js` — send a GET request through the Proxy API -- `unify_api.js` — call Unify Chat, Git, and PM endpoints +- `unify_api.js` — call Unify Chat, Git, and Ticketing endpoints diff --git a/examples/unify_api.js b/examples/unify_api.js index 57cb206..9aabf2b 100644 --- a/examples/unify_api.js +++ b/examples/unify_api.js @@ -31,8 +31,8 @@ try { } try { - const issues = await unify.pm.issues({ limit: 10 }); - console.log(`PM issues: ${issues.data?.length ?? 0}`); + const tickets = await unify.ticketing.tickets({ limit: 10 }); + console.log(`Ticketing tickets: ${tickets.data?.length ?? 0}`); } catch (error) { - console.error(`Failed to fetch PM issues: ${error.message}`); + console.error(`Failed to fetch tickets: ${error.message}`); } diff --git a/src/__tests__/unify.test.ts b/src/__tests__/unify.test.ts index e13a20f..6285530 100644 --- a/src/__tests__/unify.test.ts +++ b/src/__tests__/unify.test.ts @@ -1,7 +1,7 @@ import { Unify } from '../unify'; import { Chat } from '../unify/chat'; import { Git } from '../unify/git'; -import { PM } from '../unify/pm'; +import { Ticketing } from '../unify/ticketing'; // Mock the global fetch function global.fetch = jest.fn(); @@ -63,23 +63,23 @@ describe('Unify', () => { }); }); - describe('pm getter', () => { - it('should return a PM instance', () => { - const pm = unify.pm; - expect(pm).toBeInstanceOf(PM); + describe('ticketing getter', () => { + it('should return a Ticketing instance', () => { + const ticketing = unify.ticketing; + expect(ticketing).toBeInstanceOf(Ticketing); }); - it('should create a new PM instance each time', () => { - const pm1 = unify.pm; - const pm2 = unify.pm; - expect(pm1).not.toBe(pm2); + it('should create a new Ticketing instance each time', () => { + const ticketing1 = unify.ticketing; + const ticketing2 = unify.ticketing; + expect(ticketing1).not.toBe(ticketing2); }); - it('should initialize PM with correct apiKey and connectionId', () => { - const pm = unify.pm; + it('should initialize Ticketing with correct apiKey and connectionId', () => { + const ticketing = unify.ticketing; // Access protected properties for testing - expect((pm as any).apiKey).toBe(apiKey); - expect((pm as any).connectionId).toBe(connectionId); + expect((ticketing as any).apiKey).toBe(apiKey); + expect((ticketing as any).connectionId).toBe(connectionId); }); }); diff --git a/src/unify.ts b/src/unify.ts index 7ddf1cc..299e5b9 100644 --- a/src/unify.ts +++ b/src/unify.ts @@ -1,6 +1,6 @@ import { Chat } from './unify/chat'; import { Git } from './unify/git'; -import { PM } from './unify/pm'; +import { Ticketing } from './unify/ticketing'; export class Unify { constructor( @@ -23,9 +23,9 @@ export class Unify { } /** - * Access the PM API for the connection. + * Access the Ticketing API for the connection. */ - get pm() { - return new PM(this.apiKey, this.connectionId); + get ticketing() { + return new Ticketing(this.apiKey, this.connectionId); } } diff --git a/src/unify/pm.ts b/src/unify/ticketing.ts similarity index 61% rename from src/unify/pm.ts rename to src/unify/ticketing.ts index c332bbd..05a3627 100644 --- a/src/unify/pm.ts +++ b/src/unify/ticketing.ts @@ -1,22 +1,22 @@ import { Base, type Params, type Response } from './base'; -export class PM extends Base { - protected namespace = 'pm'; +export class Ticketing extends Base { + protected namespace = 'ticketing'; /** - * Fetch issues - * @param limit - Maximum number of issues to retrieve. + * Fetch tickets + * @param limit - Maximum number of tickets to retrieve. * @param after - Cursor for pagination. * @param include_raw - Whether to include raw response data. * @returns A promise that resolves to the fetch response. */ - async issues({ limit = 100, after, include_raw = false }: Params = {}) { - const url = this.buildUrl('issues', { limit, after, include_raw }); + async tickets({ limit = 100, after, include_raw = false }: Params = {}) { + const url = this.buildUrl('tickets', { limit, after, include_raw }); const response = await fetch(url, { headers: this.headers }); if (!response.ok) { - throw new Error(`Failed to fetch ${this.namespace}/issues: ${response.statusText}`); + throw new Error(`Failed to fetch ${this.namespace}/tickets: ${response.statusText}`); } const data = await response.json();