curtain-web-api 1.0.65 → 1.0.67

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.
@@ -50,6 +50,44 @@ export interface CurtainChunkedUploadCompletionResponse {
50
50
  message?: string;
51
51
  error?: string;
52
52
  }
53
+ export interface Announcement {
54
+ id: number;
55
+ title: string;
56
+ content: string;
57
+ announcement_type: 'info' | 'warning' | 'success' | 'error' | 'maintenance';
58
+ priority: 'low' | 'medium' | 'high' | 'critical';
59
+ is_active: boolean;
60
+ created: string;
61
+ updated: string;
62
+ starts_at?: string;
63
+ expires_at?: string;
64
+ created_by_username?: string;
65
+ show_on_login: boolean;
66
+ dismissible: boolean;
67
+ is_visible: boolean;
68
+ }
69
+ export interface PermanentLinkRequest {
70
+ id: number;
71
+ curtain: number;
72
+ curtain_link_id: string;
73
+ requested_by: number;
74
+ requested_by_username: string;
75
+ request_type: 'permanent' | 'extend';
76
+ requested_expiry_months?: number;
77
+ status: 'pending' | 'approved' | 'rejected';
78
+ reason?: string;
79
+ requested_at: string;
80
+ reviewed_at?: string;
81
+ reviewed_by?: number;
82
+ reviewed_by_username?: string;
83
+ admin_notes?: string;
84
+ }
85
+ export interface CreatePermanentLinkRequest {
86
+ curtain: number;
87
+ request_type: 'permanent' | 'extend';
88
+ requested_expiry_months?: number;
89
+ reason?: string;
90
+ }
53
91
  export declare class CurtainWebAPI {
54
92
  loginURL: string;
55
93
  logoutURL: string;
@@ -129,4 +167,20 @@ export declare class CurtainWebAPI {
129
167
  upload_session_id?: string;
130
168
  onProgress?: (progress: number) => void;
131
169
  }): Promise<CurtainChunkedUploadCompletionResponse>;
170
+ getAnnouncements(limit?: number, offset?: number): Promise<import("axios").AxiosResponse<{
171
+ count: number;
172
+ results: Announcement[];
173
+ }, any, {}>>;
174
+ createPermanentLinkRequest(request: CreatePermanentLinkRequest): Promise<import("axios").AxiosResponse<PermanentLinkRequest, any, {}>>;
175
+ getPermanentLinkRequests(limit?: number, offset?: number, status?: string, curtain?: number): Promise<import("axios").AxiosResponse<{
176
+ count: number;
177
+ results: PermanentLinkRequest[];
178
+ }, any, {}>>;
179
+ getPermanentLinkRequest(id: number): Promise<import("axios").AxiosResponse<PermanentLinkRequest, any, {}>>;
180
+ approvePermanentLinkRequest(id: number): Promise<import("axios").AxiosResponse<{
181
+ message: string;
182
+ }, any, {}>>;
183
+ rejectPermanentLinkRequest(id: number, admin_notes?: string): Promise<import("axios").AxiosResponse<{
184
+ message: string;
185
+ }, any, {}>>;
132
186
  }
@@ -798,4 +798,50 @@ export class CurtainWebAPI {
798
798
  uploadNextChunk();
799
799
  });
800
800
  }
801
+ getAnnouncements(limit = 10, offset = 0) {
802
+ let headers = new AxiosHeaders();
803
+ headers["Accept"] = "application/json";
804
+ let params = new URLSearchParams();
805
+ params.append("limit", limit.toString());
806
+ params.append("offset", offset.toString());
807
+ return this.axiosInstance.get(this.baseURL + "announcements/", { headers: headers, params: params, responseType: "json" });
808
+ }
809
+ createPermanentLinkRequest(request) {
810
+ let headers = new AxiosHeaders();
811
+ headers["Accept"] = "application/json";
812
+ headers["Content-Type"] = "application/json";
813
+ return this.axiosInstance.post(this.baseURL + "permanent-link-requests/", request, { headers: headers, responseType: "json" });
814
+ }
815
+ getPermanentLinkRequests(limit = 10, offset = 0, status, curtain) {
816
+ let headers = new AxiosHeaders();
817
+ headers["Accept"] = "application/json";
818
+ let params = new URLSearchParams();
819
+ params.append("limit", limit.toString());
820
+ params.append("offset", offset.toString());
821
+ if (status) {
822
+ params.append("status", status);
823
+ }
824
+ if (curtain) {
825
+ params.append("curtain", curtain.toString());
826
+ }
827
+ return this.axiosInstance.get(this.baseURL + "permanent-link-requests/", { headers: headers, params: params, responseType: "json" });
828
+ }
829
+ getPermanentLinkRequest(id) {
830
+ let headers = new AxiosHeaders();
831
+ headers["Accept"] = "application/json";
832
+ return this.axiosInstance.get(this.baseURL + "permanent-link-requests/" + id + "/", { headers: headers, responseType: "json" });
833
+ }
834
+ approvePermanentLinkRequest(id) {
835
+ let headers = new AxiosHeaders();
836
+ headers["Accept"] = "application/json";
837
+ headers["Content-Type"] = "application/json";
838
+ return this.axiosInstance.post(this.baseURL + "permanent-link-requests/" + id + "/approve/", {}, { headers: headers, responseType: "json" });
839
+ }
840
+ rejectPermanentLinkRequest(id, admin_notes) {
841
+ let headers = new AxiosHeaders();
842
+ headers["Accept"] = "application/json";
843
+ headers["Content-Type"] = "application/json";
844
+ const data = admin_notes ? { admin_notes } : {};
845
+ return this.axiosInstance.post(this.baseURL + "permanent-link-requests/" + id + "/reject/", data, { headers: headers, responseType: "json" });
846
+ }
801
847
  }
package/build/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { CurtainWebAPI, replacer, reviver, SiteProperties, CurtainChunkedUploadStatus, CurtainChunkedUploadRequest, CurtainChunkedUploadResponse, CurtainChunkedUploadCompletionRequest, CurtainChunkedUploadCompletionResponse } from "./classes/curtain-api";
1
+ import { CurtainWebAPI, replacer, reviver, SiteProperties, CurtainChunkedUploadStatus, CurtainChunkedUploadRequest, CurtainChunkedUploadResponse, CurtainChunkedUploadCompletionRequest, CurtainChunkedUploadCompletionResponse, Announcement, PermanentLinkRequest, CreatePermanentLinkRequest } from "./classes/curtain-api";
2
2
  import { User } from "./classes/curtain-user";
3
3
  import { getProteomicsData, getPrideData, getEBIAlpha, getInteractomeAtlas, getStringDBInteractions } from "./utilities";
4
4
  import { importKey, importPrivateKey, exportPrivateKey, exportKeyString, exportPublicKey, importPublicKey, CurtainEncryption, generateKeyPair, encryptDataRSA, decryptDataRSA, loadFromLocalStorage, saveToLocalStorage, pemToArrayBuffer, base64ToArrayBuffer, arrayBufferToBase64String, removeLines, encryptAESData, decryptAESData, encryptAESKey, decryptAESKey, generateAESKey, exportAESKey, importAESKey } from "./classes/curtain-encryption";
5
5
  import PouchDB from "pouchdb";
6
- export { CurtainWebAPI, User, getProteomicsData, getPrideData, getEBIAlpha, getInteractomeAtlas, getStringDBInteractions, replacer, reviver, SiteProperties, CurtainChunkedUploadStatus, CurtainChunkedUploadRequest, CurtainChunkedUploadResponse, CurtainChunkedUploadCompletionRequest, CurtainChunkedUploadCompletionResponse, importKey, importPrivateKey, exportPrivateKey, exportKeyString, exportPublicKey, importPublicKey, CurtainEncryption, generateKeyPair, encryptDataRSA, decryptDataRSA, loadFromLocalStorage, saveToLocalStorage, pemToArrayBuffer, base64ToArrayBuffer, arrayBufferToBase64String, removeLines, encryptAESData, decryptAESData, encryptAESKey, decryptAESKey, generateAESKey, exportAESKey, importAESKey, PouchDB };
6
+ export { CurtainWebAPI, User, getProteomicsData, getPrideData, getEBIAlpha, getInteractomeAtlas, getStringDBInteractions, replacer, reviver, SiteProperties, CurtainChunkedUploadStatus, CurtainChunkedUploadRequest, CurtainChunkedUploadResponse, CurtainChunkedUploadCompletionRequest, CurtainChunkedUploadCompletionResponse, Announcement, PermanentLinkRequest, CreatePermanentLinkRequest, importKey, importPrivateKey, exportPrivateKey, exportKeyString, exportPublicKey, importPublicKey, CurtainEncryption, generateKeyPair, encryptDataRSA, decryptDataRSA, loadFromLocalStorage, saveToLocalStorage, pemToArrayBuffer, base64ToArrayBuffer, arrayBufferToBase64String, removeLines, encryptAESData, decryptAESData, encryptAESKey, decryptAESKey, generateAESKey, exportAESKey, importAESKey, PouchDB };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "curtain-web-api",
3
- "version": "1.0.65",
3
+ "version": "1.0.67",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./build/index.js",
@@ -84,6 +84,47 @@ export interface CurtainChunkedUploadCompletionResponse {
84
84
  error?: string;
85
85
  }
86
86
 
87
+ export interface Announcement {
88
+ id: number;
89
+ title: string;
90
+ content: string;
91
+ announcement_type: 'info' | 'warning' | 'success' | 'error' | 'maintenance';
92
+ priority: 'low' | 'medium' | 'high' | 'critical';
93
+ is_active: boolean;
94
+ created: string;
95
+ updated: string;
96
+ starts_at?: string;
97
+ expires_at?: string;
98
+ created_by_username?: string;
99
+ show_on_login: boolean;
100
+ dismissible: boolean;
101
+ is_visible: boolean;
102
+ }
103
+
104
+ export interface PermanentLinkRequest {
105
+ id: number;
106
+ curtain: number;
107
+ curtain_link_id: string;
108
+ requested_by: number;
109
+ requested_by_username: string;
110
+ request_type: 'permanent' | 'extend';
111
+ requested_expiry_months?: number;
112
+ status: 'pending' | 'approved' | 'rejected';
113
+ reason?: string;
114
+ requested_at: string;
115
+ reviewed_at?: string;
116
+ reviewed_by?: number;
117
+ reviewed_by_username?: string;
118
+ admin_notes?: string;
119
+ }
120
+
121
+ export interface CreatePermanentLinkRequest {
122
+ curtain: number;
123
+ request_type: 'permanent' | 'extend';
124
+ requested_expiry_months?: number;
125
+ reason?: string;
126
+ }
127
+
87
128
  export class CurtainWebAPI {
88
129
  loginURL: string = "";
89
130
  logoutURL: string = "";
@@ -954,5 +995,57 @@ export class CurtainWebAPI {
954
995
  uploadNextChunk();
955
996
  });
956
997
  }
998
+
999
+ getAnnouncements(limit: number = 10, offset: number = 0) {
1000
+ let headers = new AxiosHeaders();
1001
+ headers["Accept"] = "application/json";
1002
+ let params = new URLSearchParams();
1003
+ params.append("limit", limit.toString());
1004
+ params.append("offset", offset.toString());
1005
+ return this.axiosInstance.get<{count: number, results: Announcement[]}>(this.baseURL + "announcements/", {headers: headers, params: params, responseType: "json"});
1006
+ }
1007
+
1008
+ createPermanentLinkRequest(request: CreatePermanentLinkRequest) {
1009
+ let headers = new AxiosHeaders();
1010
+ headers["Accept"] = "application/json";
1011
+ headers["Content-Type"] = "application/json";
1012
+ return this.axiosInstance.post<PermanentLinkRequest>(this.baseURL + "permanent-link-requests/", request, {headers: headers, responseType: "json"});
1013
+ }
1014
+
1015
+ getPermanentLinkRequests(limit: number = 10, offset: number = 0, status?: string, curtain?: number) {
1016
+ let headers = new AxiosHeaders();
1017
+ headers["Accept"] = "application/json";
1018
+ let params = new URLSearchParams();
1019
+ params.append("limit", limit.toString());
1020
+ params.append("offset", offset.toString());
1021
+ if (status) {
1022
+ params.append("status", status);
1023
+ }
1024
+ if (curtain) {
1025
+ params.append("curtain", curtain.toString());
1026
+ }
1027
+ return this.axiosInstance.get<{count: number, results: PermanentLinkRequest[]}>(this.baseURL + "permanent-link-requests/", {headers: headers, params: params, responseType: "json"});
1028
+ }
1029
+
1030
+ getPermanentLinkRequest(id: number) {
1031
+ let headers = new AxiosHeaders();
1032
+ headers["Accept"] = "application/json";
1033
+ return this.axiosInstance.get<PermanentLinkRequest>(this.baseURL + "permanent-link-requests/" + id + "/", {headers: headers, responseType: "json"});
1034
+ }
1035
+
1036
+ approvePermanentLinkRequest(id: number) {
1037
+ let headers = new AxiosHeaders();
1038
+ headers["Accept"] = "application/json";
1039
+ headers["Content-Type"] = "application/json";
1040
+ return this.axiosInstance.post<{message: string}>(this.baseURL + "permanent-link-requests/" + id + "/approve/", {}, {headers: headers, responseType: "json"});
1041
+ }
1042
+
1043
+ rejectPermanentLinkRequest(id: number, admin_notes?: string) {
1044
+ let headers = new AxiosHeaders();
1045
+ headers["Accept"] = "application/json";
1046
+ headers["Content-Type"] = "application/json";
1047
+ const data = admin_notes ? {admin_notes} : {};
1048
+ return this.axiosInstance.post<{message: string}>(this.baseURL + "permanent-link-requests/" + id + "/reject/", data, {headers: headers, responseType: "json"});
1049
+ }
957
1050
  }
958
1051
 
package/src/index.ts CHANGED
@@ -7,7 +7,10 @@ import {
7
7
  CurtainChunkedUploadRequest,
8
8
  CurtainChunkedUploadResponse,
9
9
  CurtainChunkedUploadCompletionRequest,
10
- CurtainChunkedUploadCompletionResponse
10
+ CurtainChunkedUploadCompletionResponse,
11
+ Announcement,
12
+ PermanentLinkRequest,
13
+ CreatePermanentLinkRequest
11
14
  } from "./classes/curtain-api";
12
15
  import {User} from "./classes/curtain-user";
13
16
  import {getProteomicsData, getPrideData, getEBIAlpha, getInteractomeAtlas, getStringDBInteractions} from "./utilities";
@@ -53,6 +56,9 @@ export {
53
56
  CurtainChunkedUploadResponse,
54
57
  CurtainChunkedUploadCompletionRequest,
55
58
  CurtainChunkedUploadCompletionResponse,
59
+ Announcement,
60
+ PermanentLinkRequest,
61
+ CreatePermanentLinkRequest,
56
62
  importKey,
57
63
  importPrivateKey,
58
64
  exportPrivateKey,