@flashbacktech/flashbackclient 0.1.13 → 0.1.15

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.
@@ -3,6 +3,8 @@ import { IApiClient, ProviderType } from './interfaces';
3
3
  import { ActivateResponse, DeactivateResponse, LoginBody, LoginResponse, LogoutResponse, OAuth2ResponseDTO, RefreshTokenErrorResponse, RefreshTokenResponse, RegisterBody, RegisterResponse } from './types/auth';
4
4
  import { StatsQueryParams, StatsResponse, NodeStatsMinuteResponse, NodeStatsDailyResponse, NodeStatsQueryParams, UnitStatsResponse, RepoStatsResponse, NodeStatsDailyQueryParams } from './types/stats';
5
5
  import { NodeInfo } from './types/bridge';
6
+ import { FeedbackEmailBody } from './types/email';
7
+ import { QuotaResponse } from './types/quota';
6
8
  interface ErrorResponse {
7
9
  message?: string;
8
10
  [key: string]: any;
@@ -61,6 +63,7 @@ export declare class ApiClient implements IApiClient {
61
63
  userLogout: (refreshToken: string) => Promise<LogoutResponse>;
62
64
  userActivate: () => Promise<ActivateResponse>;
63
65
  userDeactivate: () => Promise<DeactivateResponse>;
66
+ getUserQuota: () => Promise<QuotaResponse>;
64
67
  private validateDateRange;
65
68
  getDailyStats: (params: StatsQueryParams) => Promise<StatsResponse>;
66
69
  getMinuteStats: (params: StatsQueryParams) => Promise<StatsResponse>;
@@ -73,5 +76,6 @@ export declare class ApiClient implements IApiClient {
73
76
  unitId?: string[];
74
77
  }) => Promise<UnitStatsResponse>;
75
78
  getNodeInfo: () => Promise<NodeInfo[]>;
79
+ sendFeedbackEmail: (data: FeedbackEmailBody) => Promise<ActionResponse>;
76
80
  }
77
81
  export {};
@@ -220,6 +220,9 @@ class ApiClient {
220
220
  this.userDeactivate = async () => {
221
221
  return this.makeRequest('user/deactivate', 'POST', null);
222
222
  };
223
+ this.getUserQuota = async () => {
224
+ return this.makeRequest('user/quota', 'GET', null);
225
+ };
223
226
  this.getDailyStats = async (params) => {
224
227
  this.validateDateRange(params.startDate, params.endDate);
225
228
  const queryParams = new URLSearchParams();
@@ -296,6 +299,9 @@ class ApiClient {
296
299
  this.getNodeInfo = async () => {
297
300
  return this.makeRequest('node', 'GET', null);
298
301
  };
302
+ this.sendFeedbackEmail = async (data) => {
303
+ return this.makeRequest('email/feedback', 'POST', data);
304
+ };
299
305
  this.baseURL = baseURL;
300
306
  this.headers = {};
301
307
  this.debug = false;
@@ -0,0 +1,33 @@
1
+ export declare enum PeriodType {
2
+ ALL_TIME = "ALL_TIME",
3
+ DAILY = "DAILY",
4
+ WEEKLY = "WEEKLY",
5
+ MONTHLY = "MONTHLY",
6
+ YEARLY = "YEARLY"
7
+ }
8
+ export interface SubscriptionInfo {
9
+ id: string;
10
+ name: string;
11
+ description: string;
12
+ }
13
+ export interface CapabilityInfo {
14
+ id: string;
15
+ code: string;
16
+ description: string;
17
+ type: string;
18
+ periodType: PeriodType;
19
+ }
20
+ export interface QuotaUsageInfo {
21
+ current: number;
22
+ max: number;
23
+ percentage: number;
24
+ }
25
+ export interface QuotaUsageItem {
26
+ capability: CapabilityInfo;
27
+ usage: QuotaUsageInfo;
28
+ }
29
+ export interface QuotaResponse {
30
+ success: boolean;
31
+ subscription: SubscriptionInfo;
32
+ quotaUsage: QuotaUsageItem[];
33
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PeriodType = void 0;
4
+ var PeriodType;
5
+ (function (PeriodType) {
6
+ PeriodType["ALL_TIME"] = "ALL_TIME";
7
+ PeriodType["DAILY"] = "DAILY";
8
+ PeriodType["WEEKLY"] = "WEEKLY";
9
+ PeriodType["MONTHLY"] = "MONTHLY";
10
+ PeriodType["YEARLY"] = "YEARLY";
11
+ })(PeriodType || (exports.PeriodType = PeriodType = {}));
@@ -15,7 +15,7 @@ class FlashbackGCSStorage extends storage_1.Storage {
15
15
  const { credentials, apiEndpoint = 'https://gcs-us-east-1-gcp.flashback.tech', tokenScopes = ['READ', 'WRITE'], ...rest } = opts;
16
16
  // Ensure the endpoint doesn't have a trailing slash
17
17
  const cleanEndpoint = apiEndpoint.replace(/\/$/, '');
18
- const authClient = new oauth2_1.FlashbackAuthClient(cleanEndpoint + '/token', tokenScopes, credentials);
18
+ const authClient = new oauth2_1.FlashbackAuthClient(cleanEndpoint + '/token', credentials, tokenScopes);
19
19
  super({
20
20
  ...rest,
21
21
  apiEndpoint: cleanEndpoint,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flashbacktech/flashbackclient",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "type": "commonjs",
5
5
  "publishConfig": {
6
6
  "access": "public"