@@ -5,9 +5,11 @@ import {
55 CreateCustomer ,
66 UpdateCustomer ,
77 ListCustomersParams ,
8+ LinkIssuesToCustomerResponse ,
89} from "../../models/Customer" ;
910import { Properties } from "./Properties" ;
1011import { Requests } from "./Requests" ;
12+ import { PaginatedResponse } from "../../models/common" ;
1113
1214/**
1315 * Customers API resource
@@ -27,73 +29,45 @@ export class Customers extends BaseResource {
2729 /**
2830 * Create a new customer
2931 */
30- async create (
31- workspaceSlug : string ,
32- createCustomer : CreateCustomer
33- ) : Promise < Customer > {
34- return this . post < Customer > (
35- `/workspaces/${ workspaceSlug } /customers/` ,
36- createCustomer
37- ) ;
32+ async create ( workspaceSlug : string , createCustomer : CreateCustomer ) : Promise < Customer > {
33+ return this . post < Customer > ( `/workspaces/${ workspaceSlug } /customers/` , createCustomer ) ;
3834 }
3935
4036 /**
4137 * Retrieve a customer by ID
4238 */
4339 async retrieve ( workspaceSlug : string , customerId : string ) : Promise < Customer > {
44- return this . get < Customer > (
45- `/workspaces/${ workspaceSlug } /customers/${ customerId } /`
46- ) ;
40+ return this . get < Customer > ( `/workspaces/${ workspaceSlug } /customers/${ customerId } /` ) ;
4741 }
4842
4943 /**
5044 * Update a customer
5145 */
52- async update (
53- workspaceSlug : string ,
54- customerId : string ,
55- updateCustomer : UpdateCustomer
56- ) : Promise < Customer > {
57- return this . patch < Customer > (
58- `/workspaces/${ workspaceSlug } /customers/${ customerId } /` ,
59- updateCustomer
60- ) ;
46+ async update ( workspaceSlug : string , customerId : string , updateCustomer : UpdateCustomer ) : Promise < Customer > {
47+ return this . patch < Customer > ( `/workspaces/${ workspaceSlug } /customers/${ customerId } /` , updateCustomer ) ;
6148 }
6249
6350 /**
6451 * Delete a customer
6552 */
6653 async delete ( workspaceSlug : string , customerId : string ) : Promise < void > {
67- return this . httpDelete (
68- `/workspaces/${ workspaceSlug } /customers/${ customerId } /`
69- ) ;
54+ return this . httpDelete ( `/workspaces/${ workspaceSlug } /customers/${ customerId } /` ) ;
7055 }
7156
7257 /**
7358 * List customers with optional filtering
7459 */
75- async list (
76- workspaceSlug : string ,
77- params ?: ListCustomersParams
78- ) : Promise < Customer [ ] > {
79- return this . get < Customer [ ] > (
80- `/workspaces/${ workspaceSlug } /customers/` ,
81- params
82- ) ;
60+ async list ( workspaceSlug : string , params ?: ListCustomersParams ) : Promise < PaginatedResponse < Customer > > {
61+ return this . get < PaginatedResponse < Customer > > ( `/workspaces/${ workspaceSlug } /customers/` , params ) ;
8362 }
8463
8564 // ===== CUSTOMER ISSUES API METHODS =====
8665
8766 /**
8867 * List customer issues
8968 */
90- async listCustomerIssues (
91- workspaceSlug : string ,
92- customerId : string
93- ) : Promise < any [ ] > {
94- return this . get < any [ ] > (
95- `/workspaces/${ workspaceSlug } /customers/${ customerId } /issues/`
96- ) ;
69+ async listCustomerIssues ( workspaceSlug : string , customerId : string ) : Promise < any [ ] > {
70+ return this . get < any [ ] > ( `/workspaces/${ workspaceSlug } /customers/${ customerId } /issues/` ) ;
9771 }
9872
9973 /**
@@ -103,23 +77,16 @@ export class Customers extends BaseResource {
10377 workspaceSlug : string ,
10478 customerId : string ,
10579 issueIds : string [ ]
106- ) : Promise < any > {
107- return this . post < any > (
108- `/workspaces/${ workspaceSlug } /customers/${ customerId } /issues/` ,
109- { issue_ids : issueIds }
110- ) ;
80+ ) : Promise < LinkIssuesToCustomerResponse > {
81+ return this . post < LinkIssuesToCustomerResponse > ( `/workspaces/${ workspaceSlug } /customers/${ customerId } /issues/` , {
82+ issue_ids : issueIds ,
83+ } ) ;
11184 }
11285
11386 /**
11487 * Unlink issue from customer
11588 */
116- async unlinkIssueFromCustomer (
117- workspaceSlug : string ,
118- customerId : string ,
119- issueId : string
120- ) : Promise < void > {
121- return this . httpDelete (
122- `/workspaces/${ workspaceSlug } /customers/${ customerId } /issues/${ issueId } /`
123- ) ;
89+ async unlinkIssueFromCustomer ( workspaceSlug : string , customerId : string , issueId : string ) : Promise < void > {
90+ return this . httpDelete ( `/workspaces/${ workspaceSlug } /customers/${ customerId } /issues/${ issueId } /` ) ;
12491 }
12592}
0 commit comments