@compassdigital/sdk.typescript 4.90.0 → 4.92.0

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/src/index.ts CHANGED
@@ -344,6 +344,8 @@ import {
344
344
  GetAnnouncementResponse,
345
345
  PutAnnouncementBody,
346
346
  PutAnnouncementResponse,
347
+ PatchAnnouncementBody,
348
+ PatchAnnouncementResponse,
347
349
  DeleteAnnouncementResponse,
348
350
  } from './interface/announcement';
349
351
 
@@ -3903,8 +3905,8 @@ export class ServiceClient extends BaseServiceClient {
3903
3905
  * @param options - additional request options
3904
3906
  */
3905
3907
  get_announcements(
3906
- options: {
3907
- query: GetAnnouncementsQuery;
3908
+ options?: {
3909
+ query?: GetAnnouncementsQuery;
3908
3910
  } & RequestOptions,
3909
3911
  ): ResponsePromise<GetAnnouncementsResponse> {
3910
3912
  return this.request('announcement', '/announcement', 'get', `/announcement`, null, options);
@@ -3954,6 +3956,28 @@ export class ServiceClient extends BaseServiceClient {
3954
3956
  );
3955
3957
  }
3956
3958
 
3959
+ /**
3960
+ * PATCH /announcement/{id} - Update Announcement
3961
+ *
3962
+ * @param id - ID of the announcement to update
3963
+ * @param body - Announcement object that needs to be updated
3964
+ * @param options - additional request options
3965
+ */
3966
+ patch_announcement(
3967
+ id: string,
3968
+ body: PatchAnnouncementBody,
3969
+ options?: RequestOptions,
3970
+ ): ResponsePromise<PatchAnnouncementResponse> {
3971
+ return this.request(
3972
+ 'announcement',
3973
+ '/announcement/{id}',
3974
+ 'patch',
3975
+ `/announcement/${id}`,
3976
+ body,
3977
+ options,
3978
+ );
3979
+ }
3980
+
3957
3981
  /**
3958
3982
  * DELETE /announcement/{id} - Delete announcement item
3959
3983
  *
@@ -13,15 +13,31 @@ export interface Success {
13
13
  success?: boolean;
14
14
  }
15
15
 
16
- export interface Announcement {
17
- // announcement
18
- id?: string;
16
+ export interface AnnouncementRequest {
17
+ // Name of Announcement
18
+ name: string;
19
+ // Announcement Type
20
+ type: string;
21
+ key: string;
22
+ // App name
23
+ app: string;
24
+ // True if all the sites are linked
25
+ is_global?: boolean;
26
+ allowed_resources?: string[];
27
+ position: number;
28
+ active: boolean;
29
+ // Announcement Properties
30
+ info: {
31
+ en?: AnnouncementInfo;
32
+ fr?: AnnouncementInfo;
33
+ };
34
+ schedule?: Schedule;
35
+ [index: string]: any;
36
+ }
37
+
38
+ export interface AnnouncementPatchRequestBody {
19
39
  // Name of Announcement
20
40
  name?: string;
21
- // Date created
22
- created_at?: string;
23
- // Date modified
24
- last_modified?: string;
25
41
  // Announcement Type
26
42
  type?: string;
27
43
  key?: string;
@@ -34,24 +50,41 @@ export interface Announcement {
34
50
  active?: boolean;
35
51
  // Announcement Properties
36
52
  info?: {
37
- en?: Announcement_info;
38
- fr?: Announcement_info;
53
+ en?: AnnouncementInfo;
54
+ fr?: AnnouncementInfo;
39
55
  };
40
- // Schedule details
41
- schedule?: {
42
- // If true, refer to `sites`, if false, refer to start/end times below
43
- variable?: boolean;
44
- start_datetime?: string;
45
- end_datetime?: string;
46
- sites?: {
47
- // group
48
- id: string;
49
- start_datetime: string;
50
- end_datetime: string;
51
- }[];
56
+ schedule?: Schedule;
57
+ }
58
+
59
+ export interface Announcement {
60
+ // announcement
61
+ id: string;
62
+ // Name of Announcement
63
+ name: string;
64
+ // Announcement Type
65
+ type: string;
66
+ key: string;
67
+ // App name
68
+ app: string;
69
+ // True if all the sites are linked
70
+ is_global: boolean;
71
+ allowed_resources: string[];
72
+ active: boolean;
73
+ schedule: Schedule;
74
+ // Date created
75
+ created_at: string;
76
+ // Date modified
77
+ last_modified: string;
78
+ position?: number;
79
+ // Announcement Properties
80
+ info?: {
81
+ en?: AnnouncementInfo;
82
+ fr?: AnnouncementInfo;
52
83
  };
84
+ //@deprecated
53
85
  date?: Record<string, any>;
54
- author?: Author;
86
+ author?: User;
87
+ edit_history?: EditHistory[];
55
88
  [index: string]: any;
56
89
  }
57
90
 
@@ -59,15 +92,15 @@ export interface Announcements {
59
92
  announcements?: Announcement[];
60
93
  }
61
94
 
62
- export interface Announcement_info {
95
+ export interface AnnouncementInfo {
63
96
  image_url?: string;
64
- title?: string;
65
- description?: string;
66
- sub_text?: string;
97
+ title: string;
98
+ description: string;
99
+ sub_text: string;
67
100
  button_text?: string;
68
101
  }
69
102
 
70
- export interface Author {
103
+ export interface User {
71
104
  id: string;
72
105
  name: {
73
106
  first?: string;
@@ -75,9 +108,27 @@ export interface Author {
75
108
  };
76
109
  }
77
110
 
111
+ export interface EditHistory {
112
+ date?: string;
113
+ user?: User;
114
+ }
115
+
116
+ export interface Schedule {
117
+ // If true, refer to `sites`, if false, refer to start/end times below
118
+ variable: boolean;
119
+ start_datetime?: string;
120
+ end_datetime?: string;
121
+ sites?: {
122
+ // group
123
+ id: string;
124
+ start_datetime: string;
125
+ end_datetime: string;
126
+ }[];
127
+ }
128
+
78
129
  // POST /announcement - Create Announcement
79
130
 
80
- export type PostAnnouncementBody = Announcement;
131
+ export type PostAnnouncementBody = AnnouncementRequest;
81
132
 
82
133
  export type PostAnnouncementResponse = Announcement;
83
134
 
@@ -93,7 +144,7 @@ export interface GetAnnouncementsQuery {
93
144
  // Filter by latest creation date
94
145
  created_at_end?: string;
95
146
  // Filter by earliest modified date
96
- last_modified_start: string;
147
+ last_modified_start?: string;
97
148
  // Filter by latest modified date
98
149
  last_modified_end?: string;
99
150
  // Filter by earliest start date
@@ -113,6 +164,12 @@ export interface GetAnnouncementsQuery {
113
164
  enabled?: boolean;
114
165
  // Filter by announcement purpose
115
166
  purpose?: string;
167
+ // Filter by author name
168
+ author?: string;
169
+ // Field to sort by
170
+ sort_by?: string;
171
+ // Sort order (ASC or DESC)
172
+ sort_order?: string;
116
173
  // Graphql query string
117
174
  _query?: string;
118
175
  }
@@ -147,7 +204,7 @@ export interface PutAnnouncementPath {
147
204
  id: string;
148
205
  }
149
206
 
150
- export type PutAnnouncementBody = Announcement;
207
+ export type PutAnnouncementBody = AnnouncementRequest;
151
208
 
152
209
  export type PutAnnouncementResponse = Announcement;
153
210
 
@@ -155,6 +212,21 @@ export interface PutAnnouncementRequest extends BaseRequest, PutAnnouncementPath
155
212
  body: PutAnnouncementBody;
156
213
  }
157
214
 
215
+ // PATCH /announcement/{id} - Update Announcement
216
+
217
+ export interface PatchAnnouncementPath {
218
+ // ID of the announcement to update
219
+ id: string;
220
+ }
221
+
222
+ export type PatchAnnouncementBody = AnnouncementPatchRequestBody;
223
+
224
+ export type PatchAnnouncementResponse = Announcement;
225
+
226
+ export interface PatchAnnouncementRequest extends BaseRequest, PatchAnnouncementPath {
227
+ body: PatchAnnouncementBody;
228
+ }
229
+
158
230
  // DELETE /announcement/{id} - Delete announcement item
159
231
 
160
232
  export interface DeleteAnnouncementPath {
@@ -150,7 +150,8 @@ export type TaskStatus =
150
150
  | 'out_for_delivery'
151
151
  | 'delivered'
152
152
  | 'order_is_ready'
153
- | 'accepted';
153
+ | 'accepted'
154
+ | 'cancelled';
154
155
 
155
156
  // POST /task - Create new Task
156
157