@cstar.help/js 0.17.3 → 0.17.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -49,16 +49,16 @@ Manage tickets, customers, articles, team members, settings, game system, and ev
49
49
  ```typescript
50
50
  import { CStarClient } from '@cstar.help/js';
51
51
 
52
- const cstar = new CStarClient({
53
- apiKey: process.env.CSTAR_SECRET_KEY, // sk_live_... or sk_test_...
54
- teamId: process.env.CSTAR_TEAM_ID
55
- });
52
+ const apiKey = process.env.CSTAR_SECRET_KEY; // sk_live_... or sk_test_...
53
+ const teamId = process.env.CSTAR_TEAM_ID;
54
+ if (!apiKey || !teamId) throw new Error('Set CSTAR_SECRET_KEY and CSTAR_TEAM_ID.');
55
+ const cstar = new CStarClient({ apiKey, teamId });
56
56
 
57
57
  // List open tickets
58
58
  const { data: tickets } = await cstar.tickets.list({ status: 'open' });
59
59
 
60
60
  // Create a ticket
61
- const { data: ticket } = await cstar.tickets.create({
61
+ const ticket = await cstar.tickets.create({
62
62
  title: 'Help with billing',
63
63
  customerId: 'cus_abc123'
64
64
  });
@@ -69,6 +69,8 @@ for await (const ticket of cstar.tickets.listAutoPaginating({ status: 'open' }))
69
69
  }
70
70
  ```
71
71
 
72
+ Created, retrieved and updated resources are returned directly. List methods return `{ data, pagination, hasMore }`. Search returns `{ results, total, query }`. Read `cstar.lastMeta.requestId` immediately after a call when you need its request ID.
73
+
72
74
  ### Full Resource Reference
73
75
 
74
76
  **Core Resources** — Tickets, customers, and knowledge base.
@@ -167,14 +169,19 @@ await cstar.bulk.update({
167
169
  data: { status: 'closed' }
168
170
  });
169
171
 
170
- // Export data
171
- const { data: exportResult } = await cstar.export.create({
172
- resources: [{ type: 'tickets', filters: { status: 'closed' } }],
173
- format: 'csv'
172
+ // Export closed tickets as JSON with raw rows and per-resource counts
173
+ const exported = await cstar.export.create({
174
+ resources: ['tickets'],
175
+ filters: { status: 'closed' },
176
+ format: 'json'
174
177
  });
178
+ console.log(exported.summary.tickets);
179
+
180
+ // CSV is text and supports one resource at a time
181
+ const csv = await cstar.export.create({ resources: ['tickets'], format: 'csv' });
175
182
 
176
183
  // Saved views
177
- const { data: view } = await cstar.views.create({
184
+ const view = await cstar.views.create({
178
185
  name: 'Urgent Unresolved',
179
186
  entityType: 'tickets',
180
187
  filters: { priority: 'urgent', status: 'open' }
@@ -182,7 +189,7 @@ const { data: view } = await cstar.views.create({
182
189
  const { data: results } = await cstar.views.execute(view.id);
183
190
 
184
191
  // Search across everything
185
- const { data: searchResults } = await cstar.search.query({
192
+ const { results: searchResults } = await cstar.search.query({
186
193
  query: 'billing issue',
187
194
  types: ['tickets', 'customers']
188
195
  });
@@ -448,7 +455,7 @@ try {
448
455
  Safely retry create/update operations:
449
456
 
450
457
  ```typescript
451
- const { data: ticket } = await cstar.tickets.create(
458
+ const ticket = await cstar.tickets.create(
452
459
  { title: 'Billing issue', customerId: 'cus_abc' },
453
460
  { idempotencyKey: 'create-billing-issue-usr123' }
454
461
  );
package/dist/index.cjs CHANGED
@@ -278,7 +278,7 @@ function parseError(statusCode, body, retryAfter) {
278
278
  }
279
279
 
280
280
  // src/client.ts
281
- var SDK_VERSION = "0.17.3";
281
+ var SDK_VERSION = "0.17.4";
282
282
  var DEFAULT_BASE_URL = "https://www.cstar.help";
283
283
  var DEFAULT_API_VERSION = "2026-03-01";
284
284
  var DEFAULT_MAX_RETRIES = 3;
@@ -384,8 +384,13 @@ var HttpClient = class {
384
384
  }
385
385
  if (response.ok) {
386
386
  if (response.status === 204) return void 0;
387
- const json = await response.json();
388
387
  const headerRequestId = response.headers.get("x-request-id") ?? response.headers.get("x-cstar-request-id");
388
+ if (options?.responseType === "text") {
389
+ const text = await response.text();
390
+ this.captureMeta(null, headerRequestId);
391
+ return text;
392
+ }
393
+ const json = await response.json();
389
394
  this.captureMeta(json, headerRequestId);
390
395
  return this.unwrapEnvelope(json);
391
396
  }
@@ -1495,11 +1500,9 @@ var QuickRepliesResource = class {
1495
1500
  }
1496
1501
  /** Reorder quick replies. */
1497
1502
  async reorder(orderedIds) {
1498
- return this.client.request(
1499
- "PUT",
1500
- "/settings/quick-replies/reorder",
1501
- { body: { orderedIds } }
1502
- );
1503
+ return this.client.request("PUT", "/settings/quick-replies/reorder", {
1504
+ body: { orderedIds }
1505
+ });
1503
1506
  }
1504
1507
  };
1505
1508
  var SettingsResource = class {
@@ -1673,9 +1676,13 @@ var CustomFieldsResource = class {
1673
1676
  }
1674
1677
  /** Reorder custom fields within a content type. */
1675
1678
  async reorder(contentType, orderedIds) {
1676
- return this.client.request("PUT", "/custom-fields/reorder", {
1677
- body: { contentType, orderedIds }
1678
- });
1679
+ return this.client.request(
1680
+ "PUT",
1681
+ "/custom-fields/reorder",
1682
+ {
1683
+ body: { contentType, orderedIds }
1684
+ }
1685
+ );
1679
1686
  }
1680
1687
  };
1681
1688
 
@@ -1810,11 +1817,11 @@ var ExportResource = class {
1810
1817
  constructor(client) {
1811
1818
  this.client = client;
1812
1819
  }
1813
- /** Create an export. Returns exported data synchronously. */
1814
1820
  async create(params, options) {
1815
1821
  return this.client.request("POST", "/export", {
1816
1822
  body: params,
1817
- idempotencyKey: options?.idempotencyKey
1823
+ idempotencyKey: options?.idempotencyKey,
1824
+ responseType: params.format === "csv" ? "text" : "json"
1818
1825
  });
1819
1826
  }
1820
1827
  };
package/dist/index.d.cts CHANGED
@@ -79,6 +79,8 @@ interface FetchOptions {
79
79
  body?: unknown;
80
80
  query?: Record<string, string | string[] | number | boolean | undefined>;
81
81
  idempotencyKey?: string;
82
+ /** Decode successful downloads as text; error responses still use JSON. */
83
+ responseType?: 'json' | 'text';
82
84
  }
83
85
  /**
84
86
  * Low-level HTTP client for the cStar API.
@@ -708,7 +710,7 @@ declare class WebhooksResource extends BaseResource<Webhook, WebhookListParams,
708
710
  /** Fire a test webhook event to all active webhooks and CLI listeners. */
709
711
  triggerTest(params: WebhookTriggerTestParams, options?: RequestOptions): Promise<ApiResponse<WebhookTriggerTestResult>>;
710
712
  /** Get a sample webhook payload for an event type (used by Zapier). */
711
- sample(event: string): Promise<ApiResponse<unknown[]>>;
713
+ sample(event: string): Promise<ListResponse<unknown>>;
712
714
  /** Subscribe to an event (REST Hooks / Zapier protocol). */
713
715
  restSubscribe(params: WebhookSubscribeParams, options?: RequestOptions): Promise<ApiResponse<WebhookSubscription>>;
714
716
  /** Unsubscribe from an event (REST Hooks / Zapier protocol). Returns void (204 No Content). */
@@ -847,7 +849,7 @@ declare class AutomationsResource extends BaseResource<AutomationRule, Automatio
847
849
  /** Toggle a rule's enabled state. */
848
850
  toggle(ruleId: string, enabled?: boolean): Promise<ApiResponse<AutomationRule>>;
849
851
  /** Reorder rules by providing an ordered array of IDs. */
850
- reorder(orderedIds: string[]): Promise<ApiResponse<AutomationRule[]>>;
852
+ reorder(orderedIds: string[]): Promise<ListResponse<AutomationRule>>;
851
853
  /** Dry-run a rule against a specific resource (no actions executed). */
852
854
  test(ruleId: string, params: {
853
855
  resourceType: string;
@@ -1053,7 +1055,7 @@ declare class CommunityPostsResource extends BaseResource<CommunityPost, Communi
1053
1055
  following: boolean;
1054
1056
  }>>;
1055
1057
  /** List all comments on a post. */
1056
- listComments(postId: string): Promise<ApiResponse<CommunityComment[]>>;
1058
+ listComments(postId: string): Promise<ListResponse<CommunityComment>>;
1057
1059
  /** Add a comment to a post. */
1058
1060
  createComment(postId: string, params: CommunityCommentCreateParams): Promise<ApiResponse<CommunityComment>>;
1059
1061
  }
@@ -1282,7 +1284,7 @@ declare class StatusesResource {
1282
1284
  private readonly client;
1283
1285
  constructor(client: HttpClient);
1284
1286
  /** List all statuses. */
1285
- list(): Promise<ApiResponse<TicketStatus[]>>;
1287
+ list(): Promise<ListResponse<TicketStatus>>;
1286
1288
  /** Create a new status. */
1287
1289
  create(params: StatusCreateParams, options?: RequestOptions): Promise<ApiResponse<TicketStatus>>;
1288
1290
  /** Update a status. */
@@ -1290,14 +1292,14 @@ declare class StatusesResource {
1290
1292
  /** Delete a status. */
1291
1293
  del(statusKey: string): Promise<ApiResponse<DeleteResponse>>;
1292
1294
  /** Reorder statuses. */
1293
- reorder(orderedKeys: string[]): Promise<ApiResponse<TicketStatus[]>>;
1295
+ reorder(orderedKeys: string[]): Promise<ListResponse<TicketStatus>>;
1294
1296
  }
1295
1297
  /** Manage quick reply templates. */
1296
1298
  declare class QuickRepliesResource {
1297
1299
  private readonly client;
1298
1300
  constructor(client: HttpClient);
1299
1301
  /** List all quick replies. */
1300
- list(): Promise<ApiResponse<QuickReply[]>>;
1302
+ list(): Promise<ListResponse<QuickReply>>;
1301
1303
  /** Create a new quick reply. */
1302
1304
  create(params: QuickReplyCreateParams, options?: RequestOptions): Promise<ApiResponse<QuickReply>>;
1303
1305
  /** Update a quick reply. */
@@ -1305,7 +1307,7 @@ declare class QuickRepliesResource {
1305
1307
  /** Delete a quick reply. */
1306
1308
  del(replyId: string): Promise<ApiResponse<DeleteResponse>>;
1307
1309
  /** Reorder quick replies. */
1308
- reorder(orderedIds: string[]): Promise<ApiResponse<QuickReply[]>>;
1310
+ reorder(orderedIds: string[]): Promise<ListResponse<QuickReply>>;
1309
1311
  }
1310
1312
  /** Manage team settings. */
1311
1313
  declare class SettingsResource {
@@ -1500,7 +1502,10 @@ declare class CustomFieldsResource {
1500
1502
  /** Delete a custom field. */
1501
1503
  del(fieldId: string): Promise<ApiResponse<DeleteResponse>>;
1502
1504
  /** Reorder custom fields within a content type. */
1503
- reorder(contentType: 'ticket' | 'customer' | 'article', orderedIds: string[]): Promise<ApiResponse<CustomField[]>>;
1505
+ reorder(contentType: 'ticket' | 'customer' | 'article', orderedIds: string[]): Promise<{
1506
+ success: true;
1507
+ reordered: number;
1508
+ }>;
1504
1509
  }
1505
1510
 
1506
1511
  /** An SLA rule. */
@@ -1569,7 +1574,7 @@ declare class SlaResource {
1569
1574
  /** Delete an SLA rule. */
1570
1575
  del(ruleId: string): Promise<ApiResponse<DeleteResponse>>;
1571
1576
  /** Reorder SLA rules by providing an ordered array of IDs. */
1572
- reorder(orderedIds: string[]): Promise<ApiResponse<SlaRule[]>>;
1577
+ reorder(orderedIds: string[]): Promise<ListResponse<SlaRule>>;
1573
1578
  /** Get SLA compliance metrics. */
1574
1579
  metrics(params?: SlaMetricsParams): Promise<ApiResponse<SlaMetrics>>;
1575
1580
  }
@@ -1744,20 +1749,41 @@ declare class BulkResource {
1744
1749
  del(params: BulkDeleteParams, options?: RequestOptions): Promise<ApiResponse<BulkResult>>;
1745
1750
  }
1746
1751
 
1747
- /** Export request parameters. */
1748
- interface ExportCreateParams {
1749
- resources: Array<{
1750
- type: 'tickets' | 'customers' | 'articles';
1751
- filters?: Record<string, unknown>;
1752
- }>;
1753
- format?: 'json' | 'csv';
1754
- }
1755
- /** Export response. */
1752
+ /** Resource tables supported by the export endpoint. */
1753
+ type ExportResourceType = 'tickets' | 'customers' | 'articles';
1754
+ /** Filters shared by all selected resources. */
1755
+ interface ExportFilters {
1756
+ status?: string;
1757
+ priority?: string;
1758
+ createdAfter?: string;
1759
+ createdBefore?: string;
1760
+ }
1761
+ /** JSON may export multiple resources or default to all three. */
1762
+ interface ExportJsonParams {
1763
+ resources?: readonly [ExportResourceType, ...ExportResourceType[]];
1764
+ format?: 'json';
1765
+ filters?: ExportFilters;
1766
+ }
1767
+ /** CSV must select exactly one resource, including when passed through a helper. */
1768
+ interface ExportCsvParams {
1769
+ resources: readonly [ExportResourceType];
1770
+ format: 'csv';
1771
+ filters?: ExportFilters;
1772
+ }
1773
+ /** Export parameters preserve the relationship between format and resources. */
1774
+ type ExportCreateParams = ExportJsonParams | ExportCsvParams;
1775
+ /** JSON export with raw database rows, unlike the mapped API resource objects. */
1756
1776
  interface ExportResult {
1757
1777
  object: 'export';
1758
- format: string;
1759
- resources: Record<string, unknown[]> | string;
1760
- totalRows: number;
1778
+ format: 'json';
1779
+ exportedAt: string;
1780
+ teamId: string;
1781
+ tickets?: Record<string, unknown>[];
1782
+ customers?: Record<string, unknown>[];
1783
+ articles?: Record<string, unknown>[];
1784
+ /** Included when the selected tickets have messages. */
1785
+ messages?: Record<string, unknown>[];
1786
+ summary: Partial<Record<ExportResourceType | 'messages', number>>;
1761
1787
  }
1762
1788
 
1763
1789
  /** Import request parameters. */
@@ -1828,8 +1854,12 @@ interface ImportLogListParams extends PaginationParams {
1828
1854
  declare class ExportResource {
1829
1855
  private readonly client;
1830
1856
  constructor(client: HttpClient);
1831
- /** Create an export. Returns exported data synchronously. */
1832
- create(params: ExportCreateParams, options?: RequestOptions): Promise<ApiResponse<ExportResult>>;
1857
+ /** Create a CSV export. The API returns text for a single resource. */
1858
+ create(params: ExportCsvParams, options?: RequestOptions): Promise<string>;
1859
+ /** Create a JSON export with raw rows and per-resource counts. */
1860
+ create(params: ExportJsonParams, options?: RequestOptions): Promise<ExportResult>;
1861
+ /** A runtime-selected format returns JSON or CSV text accordingly. */
1862
+ create(params: ExportCreateParams, options?: RequestOptions): Promise<ExportResult | string>;
1833
1863
  }
1834
1864
  /** Import data into your team. */
1835
1865
  declare class ImportResource {
@@ -1893,13 +1923,19 @@ interface SearchParams {
1893
1923
  types?: Array<'tickets' | 'customers' | 'articles'>;
1894
1924
  limit?: number;
1895
1925
  }
1926
+ /** Cross-resource search results with the original query and returned count. */
1927
+ interface SearchResponse {
1928
+ results: SearchResult[];
1929
+ total: number;
1930
+ query: string;
1931
+ }
1896
1932
 
1897
1933
  /** Search across tickets, customers, and articles. */
1898
1934
  declare class SearchResource {
1899
1935
  private readonly client;
1900
1936
  constructor(client: HttpClient);
1901
1937
  /** Perform a cross-resource search. */
1902
- query(params: SearchParams): Promise<ApiResponse<SearchResult[]>>;
1938
+ query(params: SearchParams): Promise<SearchResponse>;
1903
1939
  }
1904
1940
 
1905
1941
  /** A tag with usage count. */
@@ -2489,7 +2525,7 @@ declare class AchievementsResource {
2489
2525
  /** List unlocked achievements only. */
2490
2526
  unlocked(params?: {
2491
2527
  userId: string;
2492
- }): Promise<ApiResponse<Achievement[]>>;
2528
+ }): Promise<ListResponse<Achievement>>;
2493
2529
  /** Get a single achievement. */
2494
2530
  get(achievementId: string, params?: {
2495
2531
  userId?: string;
@@ -2909,7 +2945,7 @@ interface CStarClientConfig {
2909
2945
  * viewing your site.
2910
2946
  *
2911
2947
  * For client-side integrations, use:
2912
- * - `@cstar.help/js/chat` — Customer chat widget (publishable key)
2948
+ * - `@cstar.help/js/chat` — Customer chat widget (HMAC or customer session)
2913
2949
  * - `@cstar.help/js/library` — Public knowledge base (no auth)
2914
2950
  * - `@cstar.help/js/community` — Public community forum (no auth)
2915
2951
  *
@@ -3037,4 +3073,4 @@ declare class CStarClient {
3037
3073
  get lastMeta(): LastMeta;
3038
3074
  }
3039
3075
 
3040
- export { type Achievement, type AchievementListParams, type ActivityEvent, type ActivityListParams, type AiAction, type AiActionParams, type AiActionResult, type AnalyticsOverview, type AnalyticsParams, type ApiResponse, type Article, type ArticleCreateParams, type ArticleListParams, type ArticleUpdateParams, type Attachment, type AttachmentListParams, type AuditLogEntry, type AuditLogListParams, type AutomationAction, type AutomationCondition, type AutomationConditions, type AutomationCreateParams, type AutomationExecution, type AutomationExecutionListParams, type AutomationListParams, type AutomationRule, type AutomationTestResult, type AutomationUpdateParams, type BillingPortal, type BillingPortalParams, type Boss, type BossDamageParams, type BossDamageResult, type BossDefeat, type BossDefeatListParams, type BossSpawnParams, type BulkDeleteParams, type BulkResult, type BulkUpdateParams, type BusinessHours, type BusinessHoursUpdateParams, CStarClient, type CStarClientConfig, CStarRealtime, type Category, type CategoryCreateParams, type CategoryListParams, type CategoryUpdateParams, type CommunityComment, type CommunityCommentCreateParams, type CommunityPost, type CommunityPostCreateParams, type CommunityPostListParams, type CommunityPostUpdateParams, type CommunityTopic, type ConnectionHandler, type Cosmetic, type CosmeticListParams, type CosmeticPreferences, type CsatSettings, type CsatSettingsUpdateParams, type CsatStats, type CsatSurvey, type CsatSurveyCreateParams, type CsatSurveyListParams, type CurrentSeason, type CustomField, type CustomFieldCreateParams, type CustomFieldListParams, type CustomFieldUpdateParams, type Customer, type CustomerCreateParams, type CustomerGroup, type CustomerGroupAddMembersParams, type CustomerGroupAddResult, type CustomerGroupCreateParams, type CustomerGroupListParams, type CustomerGroupMemberListParams, type CustomerGroupMembersResult, type CustomerGroupRemoveResult, type CustomerGroupUpdateParams, type CustomerListParams, type CustomerUpdateParams, type DeleteResponse, type ErrorHandler, type EventHandler, type ExportCreateParams, type ExportResult, type GameConfig, type HighFive, type HighFiveCanSend, type HighFiveCreateParams, type HighFiveListParams, type ImportCreateParams, type ImportLog, type ImportLogListParams, type ImportResult, type Invite, type InviteCreateParams, type InviteListParams, type LeaderboardEntry, type LeaderboardParams, type ListResponse, type Member, type MemberListParams, type MemberUpdateParams, type Mention, type MentionListParams, type MentionUnreadCount, type Message, type MessageCreateParams, type Metadata, type Notification, type NotificationListParams, OfflineQueue, type OfflineQueueOptions, type OneUp, type OneUpCreateParams, type OneUpListParams, type OneUpRemaining, type OneUpSendResult, type PaginationInfo, type PaginationParams, type Player, type Puzzle, type PuzzleCompleteParams, type PuzzleCompleteResult, type PuzzleLeaderboardParams, type PuzzleLeaderboardResult, type PuzzleStreak, type Quest, type QuestHistory, type QuestHistoryParams, type QuestList, type QueueItem, type QueueResult, type QuickReply, type QuickReplyCreateParams, type QuickReplyUpdateParams, type RealtimeEvent, type RealtimeOptions, type RequestOptions, type SavedView, type SearchParams, type SearchResult, type Season, type SeasonStats, type SkillAllocateParams, type SkillAllocateResult, type SkillTree, type SlaMetrics, type SlaMetricsParams, type SlaRule, type SlaRuleCreateParams, type SlaRuleListParams, type SlaRuleUpdateParams, type StatusCreateParams, type StatusUpdateParams, Subscription$1 as Subscription, type Tag, type TagListParams, type TeamSettings, type TeamSettingsUpdateParams, type Ticket, type TicketCreateParams, type TicketCustomerSummary, type TicketListParams, type TicketStatus, type TicketUpdateParams, type TopicCustomField, type UnreadCount, type ViewCreateParams, type ViewExecuteParams, type ViewListParams, type ViewUpdateParams, type Webhook, type WebhookCreateParams, type WebhookEventData, WebhookEventType, type WebhookListParams, type WebhookListener, type WebhookListenerParams, type WebhookSubscribeParams, type WebhookSubscription, type WebhookTestResult, type WebhookTriggerTestParams, type WebhookTriggerTestResult, type WebhookUpdateParams, type WidgetSettings, type WidgetSettingsUpdateParams };
3076
+ export { type Achievement, type AchievementListParams, type ActivityEvent, type ActivityListParams, type AiAction, type AiActionParams, type AiActionResult, type AnalyticsOverview, type AnalyticsParams, type ApiResponse, type Article, type ArticleCreateParams, type ArticleListParams, type ArticleUpdateParams, type Attachment, type AttachmentListParams, type AuditLogEntry, type AuditLogListParams, type AutomationAction, type AutomationCondition, type AutomationConditions, type AutomationCreateParams, type AutomationExecution, type AutomationExecutionListParams, type AutomationListParams, type AutomationRule, type AutomationTestResult, type AutomationUpdateParams, type BillingPortal, type BillingPortalParams, type Boss, type BossDamageParams, type BossDamageResult, type BossDefeat, type BossDefeatListParams, type BossSpawnParams, type BulkDeleteParams, type BulkResult, type BulkUpdateParams, type BusinessHours, type BusinessHoursUpdateParams, CStarClient, type CStarClientConfig, CStarRealtime, type Category, type CategoryCreateParams, type CategoryListParams, type CategoryUpdateParams, type CommunityComment, type CommunityCommentCreateParams, type CommunityPost, type CommunityPostCreateParams, type CommunityPostListParams, type CommunityPostUpdateParams, type CommunityTopic, type ConnectionHandler, type Cosmetic, type CosmeticListParams, type CosmeticPreferences, type CsatSettings, type CsatSettingsUpdateParams, type CsatStats, type CsatSurvey, type CsatSurveyCreateParams, type CsatSurveyListParams, type CurrentSeason, type CustomField, type CustomFieldCreateParams, type CustomFieldListParams, type CustomFieldUpdateParams, type Customer, type CustomerCreateParams, type CustomerGroup, type CustomerGroupAddMembersParams, type CustomerGroupAddResult, type CustomerGroupCreateParams, type CustomerGroupListParams, type CustomerGroupMemberListParams, type CustomerGroupMembersResult, type CustomerGroupRemoveResult, type CustomerGroupUpdateParams, type CustomerListParams, type CustomerUpdateParams, type DeleteResponse, type ErrorHandler, type EventHandler, type ExportCreateParams, type ExportCsvParams, type ExportFilters, type ExportJsonParams, type ExportResourceType, type ExportResult, type GameConfig, type HighFive, type HighFiveCanSend, type HighFiveCreateParams, type HighFiveListParams, type ImportCreateParams, type ImportLog, type ImportLogListParams, type ImportResult, type Invite, type InviteCreateParams, type InviteListParams, type LeaderboardEntry, type LeaderboardParams, type ListResponse, type Member, type MemberListParams, type MemberUpdateParams, type Mention, type MentionListParams, type MentionUnreadCount, type Message, type MessageCreateParams, type Metadata, type Notification, type NotificationListParams, OfflineQueue, type OfflineQueueOptions, type OneUp, type OneUpCreateParams, type OneUpListParams, type OneUpRemaining, type OneUpSendResult, type PaginationInfo, type PaginationParams, type Player, type Puzzle, type PuzzleCompleteParams, type PuzzleCompleteResult, type PuzzleLeaderboardParams, type PuzzleLeaderboardResult, type PuzzleStreak, type Quest, type QuestHistory, type QuestHistoryParams, type QuestList, type QueueItem, type QueueResult, type QuickReply, type QuickReplyCreateParams, type QuickReplyUpdateParams, type RealtimeEvent, type RealtimeOptions, type RequestOptions, type SavedView, type SearchParams, type SearchResponse, type SearchResult, type Season, type SeasonStats, type SkillAllocateParams, type SkillAllocateResult, type SkillTree, type SlaMetrics, type SlaMetricsParams, type SlaRule, type SlaRuleCreateParams, type SlaRuleListParams, type SlaRuleUpdateParams, type StatusCreateParams, type StatusUpdateParams, Subscription$1 as Subscription, type Tag, type TagListParams, type TeamSettings, type TeamSettingsUpdateParams, type Ticket, type TicketCreateParams, type TicketCustomerSummary, type TicketListParams, type TicketStatus, type TicketUpdateParams, type TopicCustomField, type UnreadCount, type ViewCreateParams, type ViewExecuteParams, type ViewListParams, type ViewUpdateParams, type Webhook, type WebhookCreateParams, type WebhookEventData, WebhookEventType, type WebhookListParams, type WebhookListener, type WebhookListenerParams, type WebhookSubscribeParams, type WebhookSubscription, type WebhookTestResult, type WebhookTriggerTestParams, type WebhookTriggerTestResult, type WebhookUpdateParams, type WidgetSettings, type WidgetSettingsUpdateParams };
package/dist/index.d.ts CHANGED
@@ -79,6 +79,8 @@ interface FetchOptions {
79
79
  body?: unknown;
80
80
  query?: Record<string, string | string[] | number | boolean | undefined>;
81
81
  idempotencyKey?: string;
82
+ /** Decode successful downloads as text; error responses still use JSON. */
83
+ responseType?: 'json' | 'text';
82
84
  }
83
85
  /**
84
86
  * Low-level HTTP client for the cStar API.
@@ -708,7 +710,7 @@ declare class WebhooksResource extends BaseResource<Webhook, WebhookListParams,
708
710
  /** Fire a test webhook event to all active webhooks and CLI listeners. */
709
711
  triggerTest(params: WebhookTriggerTestParams, options?: RequestOptions): Promise<ApiResponse<WebhookTriggerTestResult>>;
710
712
  /** Get a sample webhook payload for an event type (used by Zapier). */
711
- sample(event: string): Promise<ApiResponse<unknown[]>>;
713
+ sample(event: string): Promise<ListResponse<unknown>>;
712
714
  /** Subscribe to an event (REST Hooks / Zapier protocol). */
713
715
  restSubscribe(params: WebhookSubscribeParams, options?: RequestOptions): Promise<ApiResponse<WebhookSubscription>>;
714
716
  /** Unsubscribe from an event (REST Hooks / Zapier protocol). Returns void (204 No Content). */
@@ -847,7 +849,7 @@ declare class AutomationsResource extends BaseResource<AutomationRule, Automatio
847
849
  /** Toggle a rule's enabled state. */
848
850
  toggle(ruleId: string, enabled?: boolean): Promise<ApiResponse<AutomationRule>>;
849
851
  /** Reorder rules by providing an ordered array of IDs. */
850
- reorder(orderedIds: string[]): Promise<ApiResponse<AutomationRule[]>>;
852
+ reorder(orderedIds: string[]): Promise<ListResponse<AutomationRule>>;
851
853
  /** Dry-run a rule against a specific resource (no actions executed). */
852
854
  test(ruleId: string, params: {
853
855
  resourceType: string;
@@ -1053,7 +1055,7 @@ declare class CommunityPostsResource extends BaseResource<CommunityPost, Communi
1053
1055
  following: boolean;
1054
1056
  }>>;
1055
1057
  /** List all comments on a post. */
1056
- listComments(postId: string): Promise<ApiResponse<CommunityComment[]>>;
1058
+ listComments(postId: string): Promise<ListResponse<CommunityComment>>;
1057
1059
  /** Add a comment to a post. */
1058
1060
  createComment(postId: string, params: CommunityCommentCreateParams): Promise<ApiResponse<CommunityComment>>;
1059
1061
  }
@@ -1282,7 +1284,7 @@ declare class StatusesResource {
1282
1284
  private readonly client;
1283
1285
  constructor(client: HttpClient);
1284
1286
  /** List all statuses. */
1285
- list(): Promise<ApiResponse<TicketStatus[]>>;
1287
+ list(): Promise<ListResponse<TicketStatus>>;
1286
1288
  /** Create a new status. */
1287
1289
  create(params: StatusCreateParams, options?: RequestOptions): Promise<ApiResponse<TicketStatus>>;
1288
1290
  /** Update a status. */
@@ -1290,14 +1292,14 @@ declare class StatusesResource {
1290
1292
  /** Delete a status. */
1291
1293
  del(statusKey: string): Promise<ApiResponse<DeleteResponse>>;
1292
1294
  /** Reorder statuses. */
1293
- reorder(orderedKeys: string[]): Promise<ApiResponse<TicketStatus[]>>;
1295
+ reorder(orderedKeys: string[]): Promise<ListResponse<TicketStatus>>;
1294
1296
  }
1295
1297
  /** Manage quick reply templates. */
1296
1298
  declare class QuickRepliesResource {
1297
1299
  private readonly client;
1298
1300
  constructor(client: HttpClient);
1299
1301
  /** List all quick replies. */
1300
- list(): Promise<ApiResponse<QuickReply[]>>;
1302
+ list(): Promise<ListResponse<QuickReply>>;
1301
1303
  /** Create a new quick reply. */
1302
1304
  create(params: QuickReplyCreateParams, options?: RequestOptions): Promise<ApiResponse<QuickReply>>;
1303
1305
  /** Update a quick reply. */
@@ -1305,7 +1307,7 @@ declare class QuickRepliesResource {
1305
1307
  /** Delete a quick reply. */
1306
1308
  del(replyId: string): Promise<ApiResponse<DeleteResponse>>;
1307
1309
  /** Reorder quick replies. */
1308
- reorder(orderedIds: string[]): Promise<ApiResponse<QuickReply[]>>;
1310
+ reorder(orderedIds: string[]): Promise<ListResponse<QuickReply>>;
1309
1311
  }
1310
1312
  /** Manage team settings. */
1311
1313
  declare class SettingsResource {
@@ -1500,7 +1502,10 @@ declare class CustomFieldsResource {
1500
1502
  /** Delete a custom field. */
1501
1503
  del(fieldId: string): Promise<ApiResponse<DeleteResponse>>;
1502
1504
  /** Reorder custom fields within a content type. */
1503
- reorder(contentType: 'ticket' | 'customer' | 'article', orderedIds: string[]): Promise<ApiResponse<CustomField[]>>;
1505
+ reorder(contentType: 'ticket' | 'customer' | 'article', orderedIds: string[]): Promise<{
1506
+ success: true;
1507
+ reordered: number;
1508
+ }>;
1504
1509
  }
1505
1510
 
1506
1511
  /** An SLA rule. */
@@ -1569,7 +1574,7 @@ declare class SlaResource {
1569
1574
  /** Delete an SLA rule. */
1570
1575
  del(ruleId: string): Promise<ApiResponse<DeleteResponse>>;
1571
1576
  /** Reorder SLA rules by providing an ordered array of IDs. */
1572
- reorder(orderedIds: string[]): Promise<ApiResponse<SlaRule[]>>;
1577
+ reorder(orderedIds: string[]): Promise<ListResponse<SlaRule>>;
1573
1578
  /** Get SLA compliance metrics. */
1574
1579
  metrics(params?: SlaMetricsParams): Promise<ApiResponse<SlaMetrics>>;
1575
1580
  }
@@ -1744,20 +1749,41 @@ declare class BulkResource {
1744
1749
  del(params: BulkDeleteParams, options?: RequestOptions): Promise<ApiResponse<BulkResult>>;
1745
1750
  }
1746
1751
 
1747
- /** Export request parameters. */
1748
- interface ExportCreateParams {
1749
- resources: Array<{
1750
- type: 'tickets' | 'customers' | 'articles';
1751
- filters?: Record<string, unknown>;
1752
- }>;
1753
- format?: 'json' | 'csv';
1754
- }
1755
- /** Export response. */
1752
+ /** Resource tables supported by the export endpoint. */
1753
+ type ExportResourceType = 'tickets' | 'customers' | 'articles';
1754
+ /** Filters shared by all selected resources. */
1755
+ interface ExportFilters {
1756
+ status?: string;
1757
+ priority?: string;
1758
+ createdAfter?: string;
1759
+ createdBefore?: string;
1760
+ }
1761
+ /** JSON may export multiple resources or default to all three. */
1762
+ interface ExportJsonParams {
1763
+ resources?: readonly [ExportResourceType, ...ExportResourceType[]];
1764
+ format?: 'json';
1765
+ filters?: ExportFilters;
1766
+ }
1767
+ /** CSV must select exactly one resource, including when passed through a helper. */
1768
+ interface ExportCsvParams {
1769
+ resources: readonly [ExportResourceType];
1770
+ format: 'csv';
1771
+ filters?: ExportFilters;
1772
+ }
1773
+ /** Export parameters preserve the relationship between format and resources. */
1774
+ type ExportCreateParams = ExportJsonParams | ExportCsvParams;
1775
+ /** JSON export with raw database rows, unlike the mapped API resource objects. */
1756
1776
  interface ExportResult {
1757
1777
  object: 'export';
1758
- format: string;
1759
- resources: Record<string, unknown[]> | string;
1760
- totalRows: number;
1778
+ format: 'json';
1779
+ exportedAt: string;
1780
+ teamId: string;
1781
+ tickets?: Record<string, unknown>[];
1782
+ customers?: Record<string, unknown>[];
1783
+ articles?: Record<string, unknown>[];
1784
+ /** Included when the selected tickets have messages. */
1785
+ messages?: Record<string, unknown>[];
1786
+ summary: Partial<Record<ExportResourceType | 'messages', number>>;
1761
1787
  }
1762
1788
 
1763
1789
  /** Import request parameters. */
@@ -1828,8 +1854,12 @@ interface ImportLogListParams extends PaginationParams {
1828
1854
  declare class ExportResource {
1829
1855
  private readonly client;
1830
1856
  constructor(client: HttpClient);
1831
- /** Create an export. Returns exported data synchronously. */
1832
- create(params: ExportCreateParams, options?: RequestOptions): Promise<ApiResponse<ExportResult>>;
1857
+ /** Create a CSV export. The API returns text for a single resource. */
1858
+ create(params: ExportCsvParams, options?: RequestOptions): Promise<string>;
1859
+ /** Create a JSON export with raw rows and per-resource counts. */
1860
+ create(params: ExportJsonParams, options?: RequestOptions): Promise<ExportResult>;
1861
+ /** A runtime-selected format returns JSON or CSV text accordingly. */
1862
+ create(params: ExportCreateParams, options?: RequestOptions): Promise<ExportResult | string>;
1833
1863
  }
1834
1864
  /** Import data into your team. */
1835
1865
  declare class ImportResource {
@@ -1893,13 +1923,19 @@ interface SearchParams {
1893
1923
  types?: Array<'tickets' | 'customers' | 'articles'>;
1894
1924
  limit?: number;
1895
1925
  }
1926
+ /** Cross-resource search results with the original query and returned count. */
1927
+ interface SearchResponse {
1928
+ results: SearchResult[];
1929
+ total: number;
1930
+ query: string;
1931
+ }
1896
1932
 
1897
1933
  /** Search across tickets, customers, and articles. */
1898
1934
  declare class SearchResource {
1899
1935
  private readonly client;
1900
1936
  constructor(client: HttpClient);
1901
1937
  /** Perform a cross-resource search. */
1902
- query(params: SearchParams): Promise<ApiResponse<SearchResult[]>>;
1938
+ query(params: SearchParams): Promise<SearchResponse>;
1903
1939
  }
1904
1940
 
1905
1941
  /** A tag with usage count. */
@@ -2489,7 +2525,7 @@ declare class AchievementsResource {
2489
2525
  /** List unlocked achievements only. */
2490
2526
  unlocked(params?: {
2491
2527
  userId: string;
2492
- }): Promise<ApiResponse<Achievement[]>>;
2528
+ }): Promise<ListResponse<Achievement>>;
2493
2529
  /** Get a single achievement. */
2494
2530
  get(achievementId: string, params?: {
2495
2531
  userId?: string;
@@ -2909,7 +2945,7 @@ interface CStarClientConfig {
2909
2945
  * viewing your site.
2910
2946
  *
2911
2947
  * For client-side integrations, use:
2912
- * - `@cstar.help/js/chat` — Customer chat widget (publishable key)
2948
+ * - `@cstar.help/js/chat` — Customer chat widget (HMAC or customer session)
2913
2949
  * - `@cstar.help/js/library` — Public knowledge base (no auth)
2914
2950
  * - `@cstar.help/js/community` — Public community forum (no auth)
2915
2951
  *
@@ -3037,4 +3073,4 @@ declare class CStarClient {
3037
3073
  get lastMeta(): LastMeta;
3038
3074
  }
3039
3075
 
3040
- export { type Achievement, type AchievementListParams, type ActivityEvent, type ActivityListParams, type AiAction, type AiActionParams, type AiActionResult, type AnalyticsOverview, type AnalyticsParams, type ApiResponse, type Article, type ArticleCreateParams, type ArticleListParams, type ArticleUpdateParams, type Attachment, type AttachmentListParams, type AuditLogEntry, type AuditLogListParams, type AutomationAction, type AutomationCondition, type AutomationConditions, type AutomationCreateParams, type AutomationExecution, type AutomationExecutionListParams, type AutomationListParams, type AutomationRule, type AutomationTestResult, type AutomationUpdateParams, type BillingPortal, type BillingPortalParams, type Boss, type BossDamageParams, type BossDamageResult, type BossDefeat, type BossDefeatListParams, type BossSpawnParams, type BulkDeleteParams, type BulkResult, type BulkUpdateParams, type BusinessHours, type BusinessHoursUpdateParams, CStarClient, type CStarClientConfig, CStarRealtime, type Category, type CategoryCreateParams, type CategoryListParams, type CategoryUpdateParams, type CommunityComment, type CommunityCommentCreateParams, type CommunityPost, type CommunityPostCreateParams, type CommunityPostListParams, type CommunityPostUpdateParams, type CommunityTopic, type ConnectionHandler, type Cosmetic, type CosmeticListParams, type CosmeticPreferences, type CsatSettings, type CsatSettingsUpdateParams, type CsatStats, type CsatSurvey, type CsatSurveyCreateParams, type CsatSurveyListParams, type CurrentSeason, type CustomField, type CustomFieldCreateParams, type CustomFieldListParams, type CustomFieldUpdateParams, type Customer, type CustomerCreateParams, type CustomerGroup, type CustomerGroupAddMembersParams, type CustomerGroupAddResult, type CustomerGroupCreateParams, type CustomerGroupListParams, type CustomerGroupMemberListParams, type CustomerGroupMembersResult, type CustomerGroupRemoveResult, type CustomerGroupUpdateParams, type CustomerListParams, type CustomerUpdateParams, type DeleteResponse, type ErrorHandler, type EventHandler, type ExportCreateParams, type ExportResult, type GameConfig, type HighFive, type HighFiveCanSend, type HighFiveCreateParams, type HighFiveListParams, type ImportCreateParams, type ImportLog, type ImportLogListParams, type ImportResult, type Invite, type InviteCreateParams, type InviteListParams, type LeaderboardEntry, type LeaderboardParams, type ListResponse, type Member, type MemberListParams, type MemberUpdateParams, type Mention, type MentionListParams, type MentionUnreadCount, type Message, type MessageCreateParams, type Metadata, type Notification, type NotificationListParams, OfflineQueue, type OfflineQueueOptions, type OneUp, type OneUpCreateParams, type OneUpListParams, type OneUpRemaining, type OneUpSendResult, type PaginationInfo, type PaginationParams, type Player, type Puzzle, type PuzzleCompleteParams, type PuzzleCompleteResult, type PuzzleLeaderboardParams, type PuzzleLeaderboardResult, type PuzzleStreak, type Quest, type QuestHistory, type QuestHistoryParams, type QuestList, type QueueItem, type QueueResult, type QuickReply, type QuickReplyCreateParams, type QuickReplyUpdateParams, type RealtimeEvent, type RealtimeOptions, type RequestOptions, type SavedView, type SearchParams, type SearchResult, type Season, type SeasonStats, type SkillAllocateParams, type SkillAllocateResult, type SkillTree, type SlaMetrics, type SlaMetricsParams, type SlaRule, type SlaRuleCreateParams, type SlaRuleListParams, type SlaRuleUpdateParams, type StatusCreateParams, type StatusUpdateParams, Subscription$1 as Subscription, type Tag, type TagListParams, type TeamSettings, type TeamSettingsUpdateParams, type Ticket, type TicketCreateParams, type TicketCustomerSummary, type TicketListParams, type TicketStatus, type TicketUpdateParams, type TopicCustomField, type UnreadCount, type ViewCreateParams, type ViewExecuteParams, type ViewListParams, type ViewUpdateParams, type Webhook, type WebhookCreateParams, type WebhookEventData, WebhookEventType, type WebhookListParams, type WebhookListener, type WebhookListenerParams, type WebhookSubscribeParams, type WebhookSubscription, type WebhookTestResult, type WebhookTriggerTestParams, type WebhookTriggerTestResult, type WebhookUpdateParams, type WidgetSettings, type WidgetSettingsUpdateParams };
3076
+ export { type Achievement, type AchievementListParams, type ActivityEvent, type ActivityListParams, type AiAction, type AiActionParams, type AiActionResult, type AnalyticsOverview, type AnalyticsParams, type ApiResponse, type Article, type ArticleCreateParams, type ArticleListParams, type ArticleUpdateParams, type Attachment, type AttachmentListParams, type AuditLogEntry, type AuditLogListParams, type AutomationAction, type AutomationCondition, type AutomationConditions, type AutomationCreateParams, type AutomationExecution, type AutomationExecutionListParams, type AutomationListParams, type AutomationRule, type AutomationTestResult, type AutomationUpdateParams, type BillingPortal, type BillingPortalParams, type Boss, type BossDamageParams, type BossDamageResult, type BossDefeat, type BossDefeatListParams, type BossSpawnParams, type BulkDeleteParams, type BulkResult, type BulkUpdateParams, type BusinessHours, type BusinessHoursUpdateParams, CStarClient, type CStarClientConfig, CStarRealtime, type Category, type CategoryCreateParams, type CategoryListParams, type CategoryUpdateParams, type CommunityComment, type CommunityCommentCreateParams, type CommunityPost, type CommunityPostCreateParams, type CommunityPostListParams, type CommunityPostUpdateParams, type CommunityTopic, type ConnectionHandler, type Cosmetic, type CosmeticListParams, type CosmeticPreferences, type CsatSettings, type CsatSettingsUpdateParams, type CsatStats, type CsatSurvey, type CsatSurveyCreateParams, type CsatSurveyListParams, type CurrentSeason, type CustomField, type CustomFieldCreateParams, type CustomFieldListParams, type CustomFieldUpdateParams, type Customer, type CustomerCreateParams, type CustomerGroup, type CustomerGroupAddMembersParams, type CustomerGroupAddResult, type CustomerGroupCreateParams, type CustomerGroupListParams, type CustomerGroupMemberListParams, type CustomerGroupMembersResult, type CustomerGroupRemoveResult, type CustomerGroupUpdateParams, type CustomerListParams, type CustomerUpdateParams, type DeleteResponse, type ErrorHandler, type EventHandler, type ExportCreateParams, type ExportCsvParams, type ExportFilters, type ExportJsonParams, type ExportResourceType, type ExportResult, type GameConfig, type HighFive, type HighFiveCanSend, type HighFiveCreateParams, type HighFiveListParams, type ImportCreateParams, type ImportLog, type ImportLogListParams, type ImportResult, type Invite, type InviteCreateParams, type InviteListParams, type LeaderboardEntry, type LeaderboardParams, type ListResponse, type Member, type MemberListParams, type MemberUpdateParams, type Mention, type MentionListParams, type MentionUnreadCount, type Message, type MessageCreateParams, type Metadata, type Notification, type NotificationListParams, OfflineQueue, type OfflineQueueOptions, type OneUp, type OneUpCreateParams, type OneUpListParams, type OneUpRemaining, type OneUpSendResult, type PaginationInfo, type PaginationParams, type Player, type Puzzle, type PuzzleCompleteParams, type PuzzleCompleteResult, type PuzzleLeaderboardParams, type PuzzleLeaderboardResult, type PuzzleStreak, type Quest, type QuestHistory, type QuestHistoryParams, type QuestList, type QueueItem, type QueueResult, type QuickReply, type QuickReplyCreateParams, type QuickReplyUpdateParams, type RealtimeEvent, type RealtimeOptions, type RequestOptions, type SavedView, type SearchParams, type SearchResponse, type SearchResult, type Season, type SeasonStats, type SkillAllocateParams, type SkillAllocateResult, type SkillTree, type SlaMetrics, type SlaMetricsParams, type SlaRule, type SlaRuleCreateParams, type SlaRuleListParams, type SlaRuleUpdateParams, type StatusCreateParams, type StatusUpdateParams, Subscription$1 as Subscription, type Tag, type TagListParams, type TeamSettings, type TeamSettingsUpdateParams, type Ticket, type TicketCreateParams, type TicketCustomerSummary, type TicketListParams, type TicketStatus, type TicketUpdateParams, type TopicCustomField, type UnreadCount, type ViewCreateParams, type ViewExecuteParams, type ViewListParams, type ViewUpdateParams, type Webhook, type WebhookCreateParams, type WebhookEventData, WebhookEventType, type WebhookListParams, type WebhookListener, type WebhookListenerParams, type WebhookSubscribeParams, type WebhookSubscription, type WebhookTestResult, type WebhookTriggerTestParams, type WebhookTriggerTestResult, type WebhookUpdateParams, type WidgetSettings, type WidgetSettingsUpdateParams };
package/dist/index.js CHANGED
@@ -237,7 +237,7 @@ function parseError(statusCode, body, retryAfter) {
237
237
  }
238
238
 
239
239
  // src/client.ts
240
- var SDK_VERSION = "0.17.3";
240
+ var SDK_VERSION = "0.17.4";
241
241
  var DEFAULT_BASE_URL = "https://www.cstar.help";
242
242
  var DEFAULT_API_VERSION = "2026-03-01";
243
243
  var DEFAULT_MAX_RETRIES = 3;
@@ -343,8 +343,13 @@ var HttpClient = class {
343
343
  }
344
344
  if (response.ok) {
345
345
  if (response.status === 204) return void 0;
346
- const json = await response.json();
347
346
  const headerRequestId = response.headers.get("x-request-id") ?? response.headers.get("x-cstar-request-id");
347
+ if (options?.responseType === "text") {
348
+ const text = await response.text();
349
+ this.captureMeta(null, headerRequestId);
350
+ return text;
351
+ }
352
+ const json = await response.json();
348
353
  this.captureMeta(json, headerRequestId);
349
354
  return this.unwrapEnvelope(json);
350
355
  }
@@ -1454,11 +1459,9 @@ var QuickRepliesResource = class {
1454
1459
  }
1455
1460
  /** Reorder quick replies. */
1456
1461
  async reorder(orderedIds) {
1457
- return this.client.request(
1458
- "PUT",
1459
- "/settings/quick-replies/reorder",
1460
- { body: { orderedIds } }
1461
- );
1462
+ return this.client.request("PUT", "/settings/quick-replies/reorder", {
1463
+ body: { orderedIds }
1464
+ });
1462
1465
  }
1463
1466
  };
1464
1467
  var SettingsResource = class {
@@ -1632,9 +1635,13 @@ var CustomFieldsResource = class {
1632
1635
  }
1633
1636
  /** Reorder custom fields within a content type. */
1634
1637
  async reorder(contentType, orderedIds) {
1635
- return this.client.request("PUT", "/custom-fields/reorder", {
1636
- body: { contentType, orderedIds }
1637
- });
1638
+ return this.client.request(
1639
+ "PUT",
1640
+ "/custom-fields/reorder",
1641
+ {
1642
+ body: { contentType, orderedIds }
1643
+ }
1644
+ );
1638
1645
  }
1639
1646
  };
1640
1647
 
@@ -1769,11 +1776,11 @@ var ExportResource = class {
1769
1776
  constructor(client) {
1770
1777
  this.client = client;
1771
1778
  }
1772
- /** Create an export. Returns exported data synchronously. */
1773
1779
  async create(params, options) {
1774
1780
  return this.client.request("POST", "/export", {
1775
1781
  body: params,
1776
- idempotencyKey: options?.idempotencyKey
1782
+ idempotencyKey: options?.idempotencyKey,
1783
+ responseType: params.format === "csv" ? "text" : "json"
1777
1784
  });
1778
1785
  }
1779
1786
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cstar.help/js",
3
- "version": "0.17.3",
3
+ "version": "0.17.4",
4
4
  "description": "Official TypeScript SDK for the cStar customer support platform",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",