|
1
|
import { HttpTypes } from "@medusajs/types" |
|
2
|
import { Client } from "../client.js" |
|
3
|
import { ClientHeaders } from "../types.js" |
|
4
|
|
|
5
|
export class PropertyLabel { |
|
6
|
constructor(private client: Client) {} |
|
7
|
|
|
8
|
/** |
|
9
|
* List property labels with optional filtering |
|
10
|
*/ |
|
11
|
async list( |
|
12
|
query?: HttpTypes.AdminGetPropertyLabelsParams, |
|
13
|
headers?: ClientHeaders |
|
14
|
): Promise<HttpTypes.AdminPropertyLabelListResponse> { |
|
15
|
return await this.client.fetch("/admin/property-labels", { |
|
16
|
method: "GET", |
|
17
|
headers, |
|
18
|
query, |
|
19
|
}) |
|
20
|
} |
|
21
|
|
|
22
|
/** |
|
23
|
* Create a new property label |
|
24
|
*/ |
|
25
|
async create( |
|
26
|
body: HttpTypes.AdminCreatePropertyLabel, |
|
27
|
headers?: ClientHeaders |
|
28
|
): Promise<HttpTypes.AdminPropertyLabelResponse> { |
|
29
|
return await this.client.fetch("/admin/property-labels", { |
|
30
|
method: "POST", |
|
31
|
headers, |
|
32
|
body, |
|
33
|
}) |
|
34
|
} |
|
35
|
|
|
36
|
/** |
|
37
|
* Retrieve a specific property label |
|
38
|
*/ |
|
39
|
async retrieve( |
|
40
|
id: string, |
|
41
|
query?: HttpTypes.AdminGetPropertyLabelParams, |
|
42
|
headers?: ClientHeaders |
|
43
|
): Promise<HttpTypes.AdminPropertyLabelResponse> { |
|
44
|
return await this.client.fetch(`/admin/property-labels/${id}`, { |
|
45
|
method: "GET", |
|
46
|
headers, |
|
47
|
query, |
|
48
|
}) |
|
49
|
} |
|
50
|
|
|
51
|
/** |
|
52
|
* Update a property label |
|
53
|
*/ |
|
54
|
async update( |
|
55
|
id: string, |
|
56
|
body: Omit<HttpTypes.AdminUpdatePropertyLabel, "id">, |
|
57
|
headers?: ClientHeaders |
|
58
|
): Promise<HttpTypes.AdminPropertyLabelResponse> { |
|
59
|
return await this.client.fetch(`/admin/property-labels/${id}`, { |
|
60
|
method: "POST", |
|
61
|
headers, |
|
62
|
body, |
|
63
|
}) |
|
64
|
} |
|
65
|
|
|
66
|
/** |
|
67
|
* Delete a property label |
|
68
|
*/ |
|
69
|
async delete( |
|
70
|
id: string, |
|
71
|
headers?: ClientHeaders |
|
72
|
): Promise<HttpTypes.AdminPropertyLabelDeleteResponse> { |
|
73
|
return await this.client.fetch(`/admin/property-labels/${id}`, { |
|
74
|
method: "DELETE", |
|
75
|
headers, |
|
76
|
}) |
|
77
|
} |
|
78
|
|
|
79
|
/** |
|
80
|
* Batch create, update, or delete property labels |
|
81
|
*/ |
|
82
|
async batch( |
|
83
|
body: HttpTypes.AdminBatchPropertyLabels, |
|
84
|
headers?: ClientHeaders |
|
85
|
): Promise<HttpTypes.AdminBatchPropertyLabelResponse> { |
|
86
|
return await this.client.fetch("/admin/property-labels/batch", { |
|
87
|
method: "POST", |
|
88
|
headers, |
|
89
|
body, |
|
90
|
}) |
|
91
|
} |
|
92
|
} |