curtain-web-api 1.0.65 → 1.0.66

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,22 @@ 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
+ }
53
69
  export declare class CurtainWebAPI {
54
70
  loginURL: string;
55
71
  logoutURL: string;
@@ -129,4 +145,8 @@ export declare class CurtainWebAPI {
129
145
  upload_session_id?: string;
130
146
  onProgress?: (progress: number) => void;
131
147
  }): Promise<CurtainChunkedUploadCompletionResponse>;
148
+ getAnnouncements(limit?: number, offset?: number): Promise<import("axios").AxiosResponse<{
149
+ count: number;
150
+ results: Announcement[];
151
+ }, any, {}>>;
132
152
  }
@@ -798,4 +798,12 @@ 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
+ }
801
809
  }
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 } 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, 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.66",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./build/index.js",
@@ -84,6 +84,23 @@ 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
+
87
104
  export class CurtainWebAPI {
88
105
  loginURL: string = "";
89
106
  logoutURL: string = "";
@@ -954,5 +971,14 @@ export class CurtainWebAPI {
954
971
  uploadNextChunk();
955
972
  });
956
973
  }
974
+
975
+ getAnnouncements(limit: number = 10, offset: number = 0) {
976
+ let headers = new AxiosHeaders();
977
+ headers["Accept"] = "application/json";
978
+ let params = new URLSearchParams();
979
+ params.append("limit", limit.toString());
980
+ params.append("offset", offset.toString());
981
+ return this.axiosInstance.get<{count: number, results: Announcement[]}>(this.baseURL + "announcements/", {headers: headers, params: params, responseType: "json"});
982
+ }
957
983
  }
958
984
 
package/src/index.ts CHANGED
@@ -7,7 +7,8 @@ import {
7
7
  CurtainChunkedUploadRequest,
8
8
  CurtainChunkedUploadResponse,
9
9
  CurtainChunkedUploadCompletionRequest,
10
- CurtainChunkedUploadCompletionResponse
10
+ CurtainChunkedUploadCompletionResponse,
11
+ Announcement
11
12
  } from "./classes/curtain-api";
12
13
  import {User} from "./classes/curtain-user";
13
14
  import {getProteomicsData, getPrideData, getEBIAlpha, getInteractomeAtlas, getStringDBInteractions} from "./utilities";
@@ -53,6 +54,7 @@ export {
53
54
  CurtainChunkedUploadResponse,
54
55
  CurtainChunkedUploadCompletionRequest,
55
56
  CurtainChunkedUploadCompletionResponse,
57
+ Announcement,
56
58
  importKey,
57
59
  importPrivateKey,
58
60
  exportPrivateKey,