curtain-web-api 1.0.70 → 1.0.72

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.
@@ -96,6 +96,31 @@ export interface CreatePermanentLinkRequest {
96
96
  requested_expiry_months?: number;
97
97
  reason?: string;
98
98
  }
99
+ export interface CurtainCollection {
100
+ id: number;
101
+ created: string;
102
+ updated: string;
103
+ name: string;
104
+ description: string;
105
+ owner: number;
106
+ owner_username: string;
107
+ curtains: number[];
108
+ curtain_count: number;
109
+ }
110
+ export interface CreateCurtainCollection {
111
+ name: string;
112
+ description?: string;
113
+ curtains?: number[];
114
+ }
115
+ export interface UpdateCurtainCollection {
116
+ name?: string;
117
+ description?: string;
118
+ curtains?: number[];
119
+ }
120
+ export interface AddCurtainToCollection {
121
+ curtain_id?: number;
122
+ link_id?: string;
123
+ }
99
124
  export declare class CurtainWebAPI {
100
125
  loginURL: string;
101
126
  logoutURL: string;
@@ -125,6 +150,7 @@ export declare class CurtainWebAPI {
125
150
  getOwnership(linkId: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
126
151
  getOwners(linkId: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
127
152
  addOwner(linkId: string, owner: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
153
+ removeOwner(linkId: string, owner: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
128
154
  getCurtainLinks(username: string, sessionDescription?: string, offset?: number, sessionType?: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
129
155
  getSiteProperties(): Promise<import("axios").AxiosResponse<SiteProperties, any, {}>>;
130
156
  saveDataFilterList(name: string, data: string, category?: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
@@ -195,4 +221,20 @@ export declare class CurtainWebAPI {
195
221
  message: string;
196
222
  request: PermanentLinkRequest;
197
223
  }, any, {}>>;
224
+ getCurtainCollections(limit?: number, offset?: number, search?: string, ordering?: string): Promise<import("axios").AxiosResponse<{
225
+ count: number;
226
+ results: CurtainCollection[];
227
+ }, any, {}>>;
228
+ getCurtainCollection(id: number): Promise<import("axios").AxiosResponse<CurtainCollection, any, {}>>;
229
+ createCurtainCollection(collection: CreateCurtainCollection): Promise<import("axios").AxiosResponse<CurtainCollection, any, {}>>;
230
+ updateCurtainCollection(id: number, collection: UpdateCurtainCollection): Promise<import("axios").AxiosResponse<CurtainCollection, any, {}>>;
231
+ deleteCurtainCollection(id: number): Promise<import("axios").AxiosResponse<any, any, {}>>;
232
+ addCurtainToCollection(collectionId: number, data: AddCurtainToCollection): Promise<import("axios").AxiosResponse<{
233
+ message: string;
234
+ collection: CurtainCollection;
235
+ }, any, {}>>;
236
+ removeCurtainFromCollection(collectionId: number, data: AddCurtainToCollection): Promise<import("axios").AxiosResponse<{
237
+ message: string;
238
+ collection: CurtainCollection;
239
+ }, any, {}>>;
198
240
  }
@@ -381,7 +381,23 @@ export class CurtainWebAPI {
381
381
  let headers = new AxiosHeaders();
382
382
  headers["Accept"] = "application/json";
383
383
  headers["Content-Type"] = "multipart/form-data";
384
- return this.axiosInstance.patch(this.baseURL + "curtain/" + linkId + "/add_owner/", form, { headers: headers, responseType: "json" }).then((response) => {
384
+ return this.axiosInstance.patch(this.baseURL + "curtain/" + linkId + "/add_owner/", form, {
385
+ headers: headers,
386
+ responseType: "json"
387
+ }).then((response) => {
388
+ return response;
389
+ });
390
+ }
391
+ removeOwner(linkId, owner) {
392
+ let form = new FormData();
393
+ form.append("username", owner);
394
+ let headers = new AxiosHeaders();
395
+ headers["Accept"] = "application/json";
396
+ headers["Content-Type"] = "multipart/form-data";
397
+ return this.axiosInstance.patch(this.baseURL + "curtain/" + linkId + "/remove_owner/", form, {
398
+ headers: headers,
399
+ responseType: "json"
400
+ }).then((response) => {
385
401
  return response;
386
402
  });
387
403
  }
@@ -858,4 +874,52 @@ export class CurtainWebAPI {
858
874
  const data = admin_notes ? { admin_notes } : {};
859
875
  return this.axiosInstance.post(this.baseURL + "permanent-link-requests/" + id + "/reject/", data, { headers: headers, responseType: "json" });
860
876
  }
877
+ getCurtainCollections(limit = 10, offset = 0, search, ordering) {
878
+ let headers = new AxiosHeaders();
879
+ headers["Accept"] = "application/json";
880
+ let params = new URLSearchParams();
881
+ params.append("limit", limit.toString());
882
+ params.append("offset", offset.toString());
883
+ if (search) {
884
+ params.append("search", search);
885
+ }
886
+ if (ordering) {
887
+ params.append("ordering", ordering);
888
+ }
889
+ return this.axiosInstance.get(this.baseURL + "curtain-collections/", { headers: headers, params: params, responseType: "json" });
890
+ }
891
+ getCurtainCollection(id) {
892
+ let headers = new AxiosHeaders();
893
+ headers["Accept"] = "application/json";
894
+ return this.axiosInstance.get(this.baseURL + "curtain-collections/" + id + "/", { headers: headers, responseType: "json" });
895
+ }
896
+ createCurtainCollection(collection) {
897
+ let headers = new AxiosHeaders();
898
+ headers["Accept"] = "application/json";
899
+ headers["Content-Type"] = "application/json";
900
+ return this.axiosInstance.post(this.baseURL + "curtain-collections/", collection, { headers: headers, responseType: "json" });
901
+ }
902
+ updateCurtainCollection(id, collection) {
903
+ let headers = new AxiosHeaders();
904
+ headers["Accept"] = "application/json";
905
+ headers["Content-Type"] = "application/json";
906
+ return this.axiosInstance.patch(this.baseURL + "curtain-collections/" + id + "/", collection, { headers: headers, responseType: "json" });
907
+ }
908
+ deleteCurtainCollection(id) {
909
+ let headers = new AxiosHeaders();
910
+ headers["Accept"] = "application/json";
911
+ return this.axiosInstance.delete(this.baseURL + "curtain-collections/" + id + "/", { headers: headers });
912
+ }
913
+ addCurtainToCollection(collectionId, data) {
914
+ let headers = new AxiosHeaders();
915
+ headers["Accept"] = "application/json";
916
+ headers["Content-Type"] = "application/json";
917
+ return this.axiosInstance.post(this.baseURL + "curtain-collections/" + collectionId + "/add_curtain/", data, { headers: headers, responseType: "json" });
918
+ }
919
+ removeCurtainFromCollection(collectionId, data) {
920
+ let headers = new AxiosHeaders();
921
+ headers["Accept"] = "application/json";
922
+ headers["Content-Type"] = "application/json";
923
+ return this.axiosInstance.post(this.baseURL + "curtain-collections/" + collectionId + "/remove_curtain/", data, { headers: headers, responseType: "json" });
924
+ }
861
925
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "curtain-web-api",
3
- "version": "1.0.70",
3
+ "version": "1.0.72",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./build/index.js",
@@ -133,6 +133,35 @@ export interface CreatePermanentLinkRequest {
133
133
  reason?: string;
134
134
  }
135
135
 
136
+ export interface CurtainCollection {
137
+ id: number;
138
+ created: string;
139
+ updated: string;
140
+ name: string;
141
+ description: string;
142
+ owner: number;
143
+ owner_username: string;
144
+ curtains: number[];
145
+ curtain_count: number;
146
+ }
147
+
148
+ export interface CreateCurtainCollection {
149
+ name: string;
150
+ description?: string;
151
+ curtains?: number[];
152
+ }
153
+
154
+ export interface UpdateCurtainCollection {
155
+ name?: string;
156
+ description?: string;
157
+ curtains?: number[];
158
+ }
159
+
160
+ export interface AddCurtainToCollection {
161
+ curtain_id?: number;
162
+ link_id?: string;
163
+ }
164
+
136
165
  export class CurtainWebAPI {
137
166
  loginURL: string = "";
138
167
  logoutURL: string = "";
@@ -514,7 +543,26 @@ export class CurtainWebAPI {
514
543
  headers["Accept"] = "application/json";
515
544
  headers["Content-Type"] = "multipart/form-data";
516
545
 
517
- return this.axiosInstance.patch(this.baseURL + "curtain/" + linkId + "/add_owner/", form, {headers: headers, responseType:"json"}).then((response) => {
546
+ return this.axiosInstance.patch(this.baseURL + "curtain/" + linkId + "/add_owner/", form, {
547
+ headers: headers,
548
+ responseType: "json"
549
+ }).then((response) => {
550
+ return response;
551
+ })
552
+ }
553
+
554
+ removeOwner(linkId: string, owner: string) {
555
+ let form = new FormData();
556
+ form.append("username", owner);
557
+
558
+ let headers = new AxiosHeaders();
559
+ headers["Accept"] = "application/json";
560
+ headers["Content-Type"] = "multipart/form-data";
561
+
562
+ return this.axiosInstance.patch(this.baseURL + "curtain/" + linkId + "/remove_owner/", form, {
563
+ headers: headers,
564
+ responseType: "json"
565
+ }).then((response) => {
518
566
  return response;
519
567
  })
520
568
  }
@@ -1071,5 +1119,60 @@ export class CurtainWebAPI {
1071
1119
  const data = admin_notes ? {admin_notes} : {};
1072
1120
  return this.axiosInstance.post<{message: string, request: PermanentLinkRequest}>(this.baseURL + "permanent-link-requests/" + id + "/reject/", data, {headers: headers, responseType: "json"});
1073
1121
  }
1122
+
1123
+ getCurtainCollections(limit: number = 10, offset: number = 0, search?: string, ordering?: string) {
1124
+ let headers = new AxiosHeaders();
1125
+ headers["Accept"] = "application/json";
1126
+ let params = new URLSearchParams();
1127
+ params.append("limit", limit.toString());
1128
+ params.append("offset", offset.toString());
1129
+ if (search) {
1130
+ params.append("search", search);
1131
+ }
1132
+ if (ordering) {
1133
+ params.append("ordering", ordering);
1134
+ }
1135
+ return this.axiosInstance.get<{count: number, results: CurtainCollection[]}>(this.baseURL + "curtain-collections/", {headers: headers, params: params, responseType: "json"});
1136
+ }
1137
+
1138
+ getCurtainCollection(id: number) {
1139
+ let headers = new AxiosHeaders();
1140
+ headers["Accept"] = "application/json";
1141
+ return this.axiosInstance.get<CurtainCollection>(this.baseURL + "curtain-collections/" + id + "/", {headers: headers, responseType: "json"});
1142
+ }
1143
+
1144
+ createCurtainCollection(collection: CreateCurtainCollection) {
1145
+ let headers = new AxiosHeaders();
1146
+ headers["Accept"] = "application/json";
1147
+ headers["Content-Type"] = "application/json";
1148
+ return this.axiosInstance.post<CurtainCollection>(this.baseURL + "curtain-collections/", collection, {headers: headers, responseType: "json"});
1149
+ }
1150
+
1151
+ updateCurtainCollection(id: number, collection: UpdateCurtainCollection) {
1152
+ let headers = new AxiosHeaders();
1153
+ headers["Accept"] = "application/json";
1154
+ headers["Content-Type"] = "application/json";
1155
+ return this.axiosInstance.patch<CurtainCollection>(this.baseURL + "curtain-collections/" + id + "/", collection, {headers: headers, responseType: "json"});
1156
+ }
1157
+
1158
+ deleteCurtainCollection(id: number) {
1159
+ let headers = new AxiosHeaders();
1160
+ headers["Accept"] = "application/json";
1161
+ return this.axiosInstance.delete(this.baseURL + "curtain-collections/" + id + "/", {headers: headers});
1162
+ }
1163
+
1164
+ addCurtainToCollection(collectionId: number, data: AddCurtainToCollection) {
1165
+ let headers = new AxiosHeaders();
1166
+ headers["Accept"] = "application/json";
1167
+ headers["Content-Type"] = "application/json";
1168
+ return this.axiosInstance.post<{message: string, collection: CurtainCollection}>(this.baseURL + "curtain-collections/" + collectionId + "/add_curtain/", data, {headers: headers, responseType: "json"});
1169
+ }
1170
+
1171
+ removeCurtainFromCollection(collectionId: number, data: AddCurtainToCollection) {
1172
+ let headers = new AxiosHeaders();
1173
+ headers["Accept"] = "application/json";
1174
+ headers["Content-Type"] = "application/json";
1175
+ return this.axiosInstance.post<{message: string, collection: CurtainCollection}>(this.baseURL + "curtain-collections/" + collectionId + "/remove_curtain/", data, {headers: headers, responseType: "json"});
1176
+ }
1074
1177
  }
1075
1178