@weavix/tracker-api-plugin
v0.1.6
Published
Typed Tracker API client for plugins, host-agnostic (works with any @weavix/sdk-core plugin)
Readme
@weavix/tracker-api-plugin
Typed Tracker Public API client for iframe plugins.
If you are building a Tracker plugin, you likely want
@weavix/tracker-plugin-sdkinstead — it bundles this package together with host API, storage, UI helpers, and Tracker types.
Installation
npm install @weavix/tracker-api-plugin @weavix/sdk-coreQuick start
import { trackerApi } from '@weavix/tracker-api-plugin';
// GET — returns { data, headers }
const { data: issue } = await trackerApi.v3.get['/issues/{id}']({
pathParams: { id: 'QUEUE-123' },
});
// POST
const { data: newIssue } = await trackerApi.v3.post['/v2/issues']({
bodyParams: { queue: { key: 'TASK' }, summary: 'New issue' },
});trackerApi.v3
A typed proxy over Tracker Public API v3 endpoints. Keys are OpenAPI endpoint paths from @weavix/tracker-api-types; the IDE provides autocomplete and JSDoc.
Full endpoint reference: Tracker API Reference.
Methods
| Method | payload fields | Description |
|--------|-----------------|-------------|
| trackerApi.v3.get[path](payload) | pathParams?, queryParams? | GET request |
| trackerApi.v3.post[path](payload) | bodyParams?, pathParams?, queryParams? | POST request |
| trackerApi.v3.put[path](payload) | bodyParams?, pathParams?, queryParams? | PUT request |
| trackerApi.v3.patch[path](payload) | bodyParams?, pathParams?, queryParams? | PATCH request |
| trackerApi.v3.delete[path](payload) | pathParams?, queryParams? | DELETE request |
All methods return Promise<{ data: T; headers: Record<string, string> }> where T is typed per endpoint.
Examples
import { trackerApi } from '@weavix/tracker-api-plugin';
// Get issue by key
const { data: issue } = await trackerApi.v3.get['/issues/{id}']({
pathParams: { id: 'QUEUE-123' },
queryParams: { expand: ['COMMENTS'] },
});
// Create issue
const { data: created } = await trackerApi.v3.post['/v2/issues']({
bodyParams: {
queue: { key: 'QUEUE' },
summary: 'Issue title',
},
});
// Update issue
await trackerApi.v3.patch['/v2/issues/{id}']({
pathParams: { id: 'QUEUE-123' },
bodyParams: { summary: 'Updated title' },
});
// Search issues
const { data: issues } = await trackerApi.v3.post['/v2/issues/_search']({
bodyParams: { filter: { queue: 'QUEUE' } },
});
// List queues
const { data: queues } = await trackerApi.v3.get['/v2/queues']({
queryParams: { page: 1, perPage: 100 },
});Types
import type {
TrackerApi, // Class type of trackerApi
TrackerApiV3, // Type of trackerApi.v3
TrackerApiCallOptions, // { pathParams?, queryParams?, bodyParams?, file? }
ApiCallResult, // { data: unknown; headers: Record<string, string> }
} from '@weavix/tracker-api-plugin';TrackerApiCallOptions
| Field | Type | Description |
|-------|------|-------------|
| pathParams | Record<string, string> | URL path parameters (e.g. { id: 'QUEUE-123' }) |
| queryParams | Record<string, unknown> | URL query parameters |
| bodyParams | Record<string, unknown> | Request body |
| file | File | File upload (for multipart endpoints) |
Related packages
| Package | Purpose |
|---------|---------|
| @weavix/tracker-plugin-sdk | Full Tracker plugin SDK (recommended) |
| @weavix/tracker-api-types | Tracker Public API v3 OpenAPI types |
| @weavix/sdk-core | Plugin bridge runtime |
License
SEE LICENSE IN LICENSE
