@flashbacktech/flashbackclient 0.0.37 → 0.0.39
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/dist/api/client.d.ts +4 -4
- package/dist/api/client.js +3 -4
- package/dist/api/interfaces.d.ts +4 -4
- package/dist/api/types.d.ts +12 -0
- package/package.json +1 -1
package/dist/api/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateUnitRequest, CreateUnitResponse, CreateRepoRequest, CreateRepoResponse,
|
|
1
|
+
import { CreateUnitRequest, CreateUnitResponse, CreateRepoRequest, CreateRepoResponse, CreateRepoKeyRequest, CreateRepoKeyResponse, GetUnitsResponse, GetReposResponse, GetRepoKeysResponse } from './types';
|
|
2
2
|
import { IApiClient, ProviderType } from './interfaces';
|
|
3
3
|
export declare class ApiClient implements IApiClient {
|
|
4
4
|
private baseURL;
|
|
@@ -10,9 +10,9 @@ export declare class ApiClient implements IApiClient {
|
|
|
10
10
|
private authenticateGoogle;
|
|
11
11
|
private authenticateGithub;
|
|
12
12
|
createStorageUnit: (data: CreateUnitRequest) => Promise<CreateUnitResponse>;
|
|
13
|
-
getStorageUnits: () => Promise<
|
|
13
|
+
getStorageUnits: () => Promise<GetUnitsResponse>;
|
|
14
14
|
createRepo: (data: CreateRepoRequest) => Promise<CreateRepoResponse>;
|
|
15
|
-
getRepos: () => Promise<
|
|
15
|
+
getRepos: () => Promise<GetReposResponse>;
|
|
16
16
|
createRepoKey: (data: CreateRepoKeyRequest) => Promise<CreateRepoKeyResponse>;
|
|
17
|
-
getRepoKeys: (repoId: string) => Promise<
|
|
17
|
+
getRepoKeys: (repoId: string) => Promise<GetRepoKeysResponse>;
|
|
18
18
|
}
|
package/dist/api/client.js
CHANGED
|
@@ -76,12 +76,11 @@ class ApiClient {
|
|
|
76
76
|
method: 'GET',
|
|
77
77
|
headers: this.headers,
|
|
78
78
|
});
|
|
79
|
-
console.log('Response status:', response.status, response.ok, response.body);
|
|
80
79
|
if (!response.ok) {
|
|
81
80
|
throw new Error(`HTTP error! status: ${response.status}`);
|
|
82
81
|
}
|
|
83
82
|
const ret = await response.json();
|
|
84
|
-
return ret;
|
|
83
|
+
return { success: true, units: ret };
|
|
85
84
|
};
|
|
86
85
|
this.createRepo = async (data) => {
|
|
87
86
|
const response = await fetch(`${this.baseURL}/repo`, {
|
|
@@ -104,7 +103,7 @@ class ApiClient {
|
|
|
104
103
|
throw new Error(`HTTP error! status: ${response.status}`);
|
|
105
104
|
}
|
|
106
105
|
const ret = await response.json();
|
|
107
|
-
return ret;
|
|
106
|
+
return { success: true, repos: ret };
|
|
108
107
|
};
|
|
109
108
|
this.createRepoKey = async (data) => {
|
|
110
109
|
const response = await fetch(`${this.baseURL}/repo/${data.repoId}/apikey`, {
|
|
@@ -127,7 +126,7 @@ class ApiClient {
|
|
|
127
126
|
throw new Error(`HTTP error! status: ${response.status}`);
|
|
128
127
|
}
|
|
129
128
|
const ret = await response.json();
|
|
130
|
-
return ret;
|
|
129
|
+
return { success: true, keys: ret };
|
|
131
130
|
};
|
|
132
131
|
this.baseURL = baseURL;
|
|
133
132
|
this.headers = {
|
package/dist/api/interfaces.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CreateUnitRequest, CreateUnitResponse, CreateRepoRequest, CreateRepoResponse, CreateRepoKeyRequest, CreateRepoKeyResponse, GetUnitsResponse, GetReposResponse, GetRepoKeysResponse } from "./types";
|
|
2
2
|
export declare enum ProviderType {
|
|
3
3
|
GOOGLE = "GOOGLE",
|
|
4
4
|
GITHUB = "GITHUB",
|
|
@@ -7,9 +7,9 @@ export declare enum ProviderType {
|
|
|
7
7
|
export interface IApiClient {
|
|
8
8
|
authenticate(token: string, provider: ProviderType): Promise<any>;
|
|
9
9
|
createStorageUnit(data: CreateUnitRequest): Promise<CreateUnitResponse>;
|
|
10
|
-
getStorageUnits(): Promise<
|
|
10
|
+
getStorageUnits(): Promise<GetUnitsResponse>;
|
|
11
11
|
createRepo(data: CreateRepoRequest): Promise<CreateRepoResponse>;
|
|
12
|
-
getRepos(): Promise<
|
|
12
|
+
getRepos(): Promise<GetReposResponse>;
|
|
13
13
|
createRepoKey(data: CreateRepoKeyRequest): Promise<CreateRepoKeyResponse>;
|
|
14
|
-
getRepoKeys(repoId: string): Promise<
|
|
14
|
+
getRepoKeys(repoId: string): Promise<GetRepoKeysResponse>;
|
|
15
15
|
}
|
package/dist/api/types.d.ts
CHANGED
|
@@ -75,3 +75,15 @@ export interface StorageUnit {
|
|
|
75
75
|
endpoint?: string;
|
|
76
76
|
regionId?: string;
|
|
77
77
|
}
|
|
78
|
+
export interface GetUnitsResponse {
|
|
79
|
+
success: boolean;
|
|
80
|
+
units: StorageUnit[];
|
|
81
|
+
}
|
|
82
|
+
export interface GetReposResponse {
|
|
83
|
+
success: boolean;
|
|
84
|
+
repos: StorageRepo[];
|
|
85
|
+
}
|
|
86
|
+
export interface GetRepoKeysResponse {
|
|
87
|
+
success: boolean;
|
|
88
|
+
keys: ApiKey[];
|
|
89
|
+
}
|