@myapihq/sdk 1.0.1 → 1.0.3
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/index.d.ts +8 -0
- package/dist/index.js +9 -1
- package/dist/storage.d.ts +4 -4
- package/dist/storage.js +8 -8
- package/package.json +1 -1
- package/src/index.ts +8 -0
- package/src/storage.ts +8 -8
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
export * from './types';
|
|
2
2
|
export * from './client';
|
|
3
3
|
export * as hq from './hq';
|
|
4
|
+
export * as domain from './domain';
|
|
5
|
+
export * as email from './email';
|
|
6
|
+
export * as funnel from './funnel';
|
|
7
|
+
export * as image from './image';
|
|
8
|
+
export * as pixel from './pixel';
|
|
9
|
+
export * as storage from './storage';
|
|
10
|
+
export * as webhook from './webhook';
|
|
11
|
+
export * as workflow from './workflow';
|
package/dist/index.js
CHANGED
|
@@ -36,8 +36,16 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
};
|
|
37
37
|
})();
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.hq = void 0;
|
|
39
|
+
exports.workflow = exports.webhook = exports.storage = exports.pixel = exports.image = exports.funnel = exports.email = exports.domain = exports.hq = void 0;
|
|
40
40
|
// AUTO-GENERATED by scripts/generate-indexes.js — do not edit manually
|
|
41
41
|
__exportStar(require("./types"), exports);
|
|
42
42
|
__exportStar(require("./client"), exports);
|
|
43
43
|
exports.hq = __importStar(require("./hq"));
|
|
44
|
+
exports.domain = __importStar(require("./domain"));
|
|
45
|
+
exports.email = __importStar(require("./email"));
|
|
46
|
+
exports.funnel = __importStar(require("./funnel"));
|
|
47
|
+
exports.image = __importStar(require("./image"));
|
|
48
|
+
exports.pixel = __importStar(require("./pixel"));
|
|
49
|
+
exports.storage = __importStar(require("./storage"));
|
|
50
|
+
exports.webhook = __importStar(require("./webhook"));
|
|
51
|
+
exports.workflow = __importStar(require("./workflow"));
|
package/dist/storage.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export interface Asset {
|
|
|
4
4
|
name: string;
|
|
5
5
|
created_at: string;
|
|
6
6
|
}
|
|
7
|
-
export declare function ingestAsset(apiKey: string, url: string, name?: string): Promise<Asset>;
|
|
8
|
-
export declare function uploadAsset(apiKey: string, file: Blob | Buffer, contentType: 'image/jpeg' | 'image/png', name?: string): Promise<Asset>;
|
|
9
|
-
export declare function listAssets(apiKey: string): Promise<Asset[]>;
|
|
10
|
-
export declare function deleteAsset(apiKey: string, assetId: string): Promise<void>;
|
|
7
|
+
export declare function ingestAsset(apiKey: string, orgId: string, url: string, name?: string): Promise<Asset>;
|
|
8
|
+
export declare function uploadAsset(apiKey: string, orgId: string, file: Blob | Buffer, contentType: 'image/jpeg' | 'image/png', name?: string): Promise<Asset>;
|
|
9
|
+
export declare function listAssets(apiKey: string, orgId: string): Promise<Asset[]>;
|
|
10
|
+
export declare function deleteAsset(apiKey: string, orgId: string, assetId: string): Promise<void>;
|
package/dist/storage.js
CHANGED
|
@@ -6,10 +6,10 @@ exports.listAssets = listAssets;
|
|
|
6
6
|
exports.deleteAsset = deleteAsset;
|
|
7
7
|
const client_1 = require("./client");
|
|
8
8
|
const BASE_URL = 'https://api.mystorageapi.com';
|
|
9
|
-
async function ingestAsset(apiKey, url, name) {
|
|
10
|
-
return (0, client_1.request)('POST', `${BASE_URL}/
|
|
9
|
+
async function ingestAsset(apiKey, orgId, url, name) {
|
|
10
|
+
return (0, client_1.request)('POST', `${BASE_URL}/storage/orgs/${encodeURIComponent(orgId)}/assets/ingest`, apiKey, { url, name });
|
|
11
11
|
}
|
|
12
|
-
async function uploadAsset(apiKey, file, contentType, name) {
|
|
12
|
+
async function uploadAsset(apiKey, orgId, file, contentType, name) {
|
|
13
13
|
const headers = {
|
|
14
14
|
'Authorization': `Bearer ${apiKey}`
|
|
15
15
|
};
|
|
@@ -18,7 +18,7 @@ async function uploadAsset(apiKey, file, contentType, name) {
|
|
|
18
18
|
if (name) {
|
|
19
19
|
formData.append('name', name);
|
|
20
20
|
}
|
|
21
|
-
const response = await fetch(`${BASE_URL}/
|
|
21
|
+
const response = await fetch(`${BASE_URL}/storage/orgs/${encodeURIComponent(orgId)}/assets/upload`, {
|
|
22
22
|
method: 'POST',
|
|
23
23
|
headers,
|
|
24
24
|
body: formData
|
|
@@ -40,9 +40,9 @@ async function uploadAsset(apiKey, file, contentType, name) {
|
|
|
40
40
|
}
|
|
41
41
|
return apiResponse.data;
|
|
42
42
|
}
|
|
43
|
-
async function listAssets(apiKey) {
|
|
44
|
-
return (0, client_1.request)('GET', `${BASE_URL}/
|
|
43
|
+
async function listAssets(apiKey, orgId) {
|
|
44
|
+
return (0, client_1.request)('GET', `${BASE_URL}/storage/orgs/${encodeURIComponent(orgId)}/assets`, apiKey);
|
|
45
45
|
}
|
|
46
|
-
async function deleteAsset(apiKey, assetId) {
|
|
47
|
-
return (0, client_1.request)('DELETE', `${BASE_URL}/
|
|
46
|
+
async function deleteAsset(apiKey, orgId, assetId) {
|
|
47
|
+
return (0, client_1.request)('DELETE', `${BASE_URL}/storage/orgs/${encodeURIComponent(orgId)}/assets/${encodeURIComponent(assetId)}`, apiKey);
|
|
48
48
|
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -2,3 +2,11 @@
|
|
|
2
2
|
export * from './types';
|
|
3
3
|
export * from './client';
|
|
4
4
|
export * as hq from './hq';
|
|
5
|
+
export * as domain from './domain';
|
|
6
|
+
export * as email from './email';
|
|
7
|
+
export * as funnel from './funnel';
|
|
8
|
+
export * as image from './image';
|
|
9
|
+
export * as pixel from './pixel';
|
|
10
|
+
export * as storage from './storage';
|
|
11
|
+
export * as webhook from './webhook';
|
|
12
|
+
export * as workflow from './workflow';
|
package/src/storage.ts
CHANGED
|
@@ -5,11 +5,11 @@ const BASE_URL = 'https://api.mystorageapi.com';
|
|
|
5
5
|
|
|
6
6
|
export interface Asset { asset_id: string; url: string; name: string; created_at: string }
|
|
7
7
|
|
|
8
|
-
export async function ingestAsset(apiKey: string, url: string, name?: string): Promise<Asset> {
|
|
9
|
-
return request('POST', `${BASE_URL}/
|
|
8
|
+
export async function ingestAsset(apiKey: string, orgId: string, url: string, name?: string): Promise<Asset> {
|
|
9
|
+
return request('POST', `${BASE_URL}/storage/orgs/${encodeURIComponent(orgId)}/assets/ingest`, apiKey, { url, name });
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export async function uploadAsset(apiKey: string, file: Blob | Buffer, contentType: 'image/jpeg' | 'image/png', name?: string): Promise<Asset> {
|
|
12
|
+
export async function uploadAsset(apiKey: string, orgId: string, file: Blob | Buffer, contentType: 'image/jpeg' | 'image/png', name?: string): Promise<Asset> {
|
|
13
13
|
const headers: Record<string, string> = {
|
|
14
14
|
'Authorization': `Bearer ${apiKey}`
|
|
15
15
|
};
|
|
@@ -20,7 +20,7 @@ export async function uploadAsset(apiKey: string, file: Blob | Buffer, contentTy
|
|
|
20
20
|
formData.append('name', name);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
const response = await fetch(`${BASE_URL}/
|
|
23
|
+
const response = await fetch(`${BASE_URL}/storage/orgs/${encodeURIComponent(orgId)}/assets/upload`, {
|
|
24
24
|
method: 'POST',
|
|
25
25
|
headers,
|
|
26
26
|
body: formData as any
|
|
@@ -46,10 +46,10 @@ export async function uploadAsset(apiKey: string, file: Blob | Buffer, contentTy
|
|
|
46
46
|
return apiResponse.data as Asset;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
export async function listAssets(apiKey: string): Promise<Asset[]> {
|
|
50
|
-
return request('GET', `${BASE_URL}/
|
|
49
|
+
export async function listAssets(apiKey: string, orgId: string): Promise<Asset[]> {
|
|
50
|
+
return request('GET', `${BASE_URL}/storage/orgs/${encodeURIComponent(orgId)}/assets`, apiKey);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
export async function deleteAsset(apiKey: string, assetId: string): Promise<void> {
|
|
54
|
-
return request('DELETE', `${BASE_URL}/
|
|
53
|
+
export async function deleteAsset(apiKey: string, orgId: string, assetId: string): Promise<void> {
|
|
54
|
+
return request('DELETE', `${BASE_URL}/storage/orgs/${encodeURIComponent(orgId)}/assets/${encodeURIComponent(assetId)}`, apiKey);
|
|
55
55
|
}
|