@myapihq/sdk 1.0.14 → 1.0.16
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/hq.d.ts +1 -0
- package/dist/image.d.ts +4 -3
- package/dist/image.js +10 -6
- package/dist/pixel.d.ts +4 -4
- package/dist/pixel.js +8 -8
- package/package.json +1 -1
- package/src/hq.d.ts +1 -0
- package/src/hq.ts +1 -0
- package/src/image.ts +10 -6
- package/src/pixel.ts +8 -8
package/dist/hq.d.ts
CHANGED
package/dist/image.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export interface ImageJob {
|
|
|
7
7
|
aspect_ratio: string;
|
|
8
8
|
created_at: string;
|
|
9
9
|
}
|
|
10
|
-
export declare function generateImage(apiKey: string, payload: {
|
|
10
|
+
export declare function generateImage(apiKey: string, orgId: string, payload: {
|
|
11
11
|
prompt: string;
|
|
12
12
|
aspect_ratio?: '1:1' | '16:9' | '9:16' | '4:3' | '3:4';
|
|
13
13
|
style?: string;
|
|
@@ -17,5 +17,6 @@ export declare function generateImage(apiKey: string, payload: {
|
|
|
17
17
|
job_id: string;
|
|
18
18
|
status: string;
|
|
19
19
|
}>;
|
|
20
|
-
export declare function getImageJob(apiKey: string, jobId: string): Promise<ImageJob>;
|
|
21
|
-
export declare function listImages(apiKey: string): Promise<ImageJob[]>;
|
|
20
|
+
export declare function getImageJob(apiKey: string, orgId: string, jobId: string): Promise<ImageJob>;
|
|
21
|
+
export declare function listImages(apiKey: string, orgId: string): Promise<ImageJob[]>;
|
|
22
|
+
export declare function deleteImage(apiKey: string, orgId: string, jobId: string): Promise<void>;
|
package/dist/image.js
CHANGED
|
@@ -3,14 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.generateImage = generateImage;
|
|
4
4
|
exports.getImageJob = getImageJob;
|
|
5
5
|
exports.listImages = listImages;
|
|
6
|
+
exports.deleteImage = deleteImage;
|
|
6
7
|
const client_1 = require("./client");
|
|
7
8
|
const BASE_URL = 'https://api.myimageapi.com';
|
|
8
|
-
async function generateImage(apiKey, payload) {
|
|
9
|
-
return (0, client_1.request)('POST', `${BASE_URL}/image/generate`, apiKey, payload);
|
|
9
|
+
async function generateImage(apiKey, orgId, payload) {
|
|
10
|
+
return (0, client_1.request)('POST', `${BASE_URL}/image/orgs/${encodeURIComponent(orgId)}/generate`, apiKey, payload);
|
|
10
11
|
}
|
|
11
|
-
async function getImageJob(apiKey, jobId) {
|
|
12
|
-
return (0, client_1.request)('GET', `${BASE_URL}/image/jobs/${encodeURIComponent(jobId)}`, apiKey);
|
|
12
|
+
async function getImageJob(apiKey, orgId, jobId) {
|
|
13
|
+
return (0, client_1.request)('GET', `${BASE_URL}/image/orgs/${encodeURIComponent(orgId)}/jobs/${encodeURIComponent(jobId)}`, apiKey);
|
|
13
14
|
}
|
|
14
|
-
async function listImages(apiKey) {
|
|
15
|
-
return (0, client_1.request)('GET', `${BASE_URL}/image/list`, apiKey);
|
|
15
|
+
async function listImages(apiKey, orgId) {
|
|
16
|
+
return (0, client_1.request)('GET', `${BASE_URL}/image/orgs/${encodeURIComponent(orgId)}/list`, apiKey);
|
|
17
|
+
}
|
|
18
|
+
async function deleteImage(apiKey, orgId, jobId) {
|
|
19
|
+
return (0, client_1.request)('DELETE', `${BASE_URL}/image/orgs/${encodeURIComponent(orgId)}/images/${encodeURIComponent(jobId)}`, apiKey);
|
|
16
20
|
}
|
package/dist/pixel.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export interface PixelEvent {
|
|
|
20
20
|
campaign_id?: string;
|
|
21
21
|
ts: string;
|
|
22
22
|
}
|
|
23
|
-
export declare function getInteractions(apiKey: string, params: {
|
|
23
|
+
export declare function getInteractions(apiKey: string, orgId: string, params: {
|
|
24
24
|
website?: string;
|
|
25
25
|
domain?: string;
|
|
26
26
|
campaign_id?: string;
|
|
@@ -29,7 +29,7 @@ export declare function getInteractions(apiKey: string, params: {
|
|
|
29
29
|
limit?: number;
|
|
30
30
|
offset?: number;
|
|
31
31
|
}): Promise<InteractionsResponse>;
|
|
32
|
-
export declare function getVisits(apiKey: string, params: {
|
|
32
|
+
export declare function getVisits(apiKey: string, orgId: string, params: {
|
|
33
33
|
website: string;
|
|
34
34
|
from?: string;
|
|
35
35
|
to?: string;
|
|
@@ -41,7 +41,7 @@ export declare function getVisits(apiKey: string, params: {
|
|
|
41
41
|
limit: number;
|
|
42
42
|
offset: number;
|
|
43
43
|
}>;
|
|
44
|
-
export declare function getEvents(apiKey: string, params: {
|
|
44
|
+
export declare function getEvents(apiKey: string, orgId: string, params: {
|
|
45
45
|
campaign_id?: string;
|
|
46
46
|
domain?: string;
|
|
47
47
|
from?: string;
|
|
@@ -54,7 +54,7 @@ export declare function getEvents(apiKey: string, params: {
|
|
|
54
54
|
limit: number;
|
|
55
55
|
offset: number;
|
|
56
56
|
}>;
|
|
57
|
-
export declare function getIdentity(apiKey: string, pixelId: string): Promise<{
|
|
57
|
+
export declare function getIdentity(apiKey: string, orgId: string, pixelId: string): Promise<{
|
|
58
58
|
uuid: string;
|
|
59
59
|
is_resolved: boolean;
|
|
60
60
|
nodes: Record<string, {
|
package/dist/pixel.js
CHANGED
|
@@ -6,7 +6,7 @@ exports.getEvents = getEvents;
|
|
|
6
6
|
exports.getIdentity = getIdentity;
|
|
7
7
|
const client_1 = require("./client");
|
|
8
8
|
const BASE_URL = 'https://api.mypixelapi.com';
|
|
9
|
-
async function getInteractions(apiKey, params) {
|
|
9
|
+
async function getInteractions(apiKey, orgId, params) {
|
|
10
10
|
const qs = new URLSearchParams();
|
|
11
11
|
for (const [key, val] of Object.entries(params)) {
|
|
12
12
|
if (val !== undefined && val !== null) {
|
|
@@ -14,10 +14,10 @@ async function getInteractions(apiKey, params) {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
const queryString = qs.toString();
|
|
17
|
-
const url = `${BASE_URL}/pixel/interactions${queryString ? `?${queryString}` : ''}`;
|
|
17
|
+
const url = `${BASE_URL}/pixel/orgs/${encodeURIComponent(orgId)}/interactions${queryString ? `?${queryString}` : ''}`;
|
|
18
18
|
return (0, client_1.request)('GET', url, apiKey);
|
|
19
19
|
}
|
|
20
|
-
async function getVisits(apiKey, params) {
|
|
20
|
+
async function getVisits(apiKey, orgId, params) {
|
|
21
21
|
const qs = new URLSearchParams();
|
|
22
22
|
for (const [key, val] of Object.entries(params)) {
|
|
23
23
|
if (val !== undefined && val !== null) {
|
|
@@ -25,10 +25,10 @@ async function getVisits(apiKey, params) {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
const queryString = qs.toString();
|
|
28
|
-
const url = `${BASE_URL}/pixel/visits${queryString ? `?${queryString}` : ''}`;
|
|
28
|
+
const url = `${BASE_URL}/pixel/orgs/${encodeURIComponent(orgId)}/visits${queryString ? `?${queryString}` : ''}`;
|
|
29
29
|
return (0, client_1.request)('GET', url, apiKey);
|
|
30
30
|
}
|
|
31
|
-
async function getEvents(apiKey, params) {
|
|
31
|
+
async function getEvents(apiKey, orgId, params) {
|
|
32
32
|
const qs = new URLSearchParams();
|
|
33
33
|
for (const [key, val] of Object.entries(params)) {
|
|
34
34
|
if (val !== undefined && val !== null) {
|
|
@@ -36,9 +36,9 @@ async function getEvents(apiKey, params) {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
const queryString = qs.toString();
|
|
39
|
-
const url = `${BASE_URL}/pixel/events${queryString ? `?${queryString}` : ''}`;
|
|
39
|
+
const url = `${BASE_URL}/pixel/orgs/${encodeURIComponent(orgId)}/events${queryString ? `?${queryString}` : ''}`;
|
|
40
40
|
return (0, client_1.request)('GET', url, apiKey);
|
|
41
41
|
}
|
|
42
|
-
async function getIdentity(apiKey, pixelId) {
|
|
43
|
-
return (0, client_1.request)('GET', `${BASE_URL}/pixel/identity/${encodeURIComponent(pixelId)}`, apiKey);
|
|
42
|
+
async function getIdentity(apiKey, orgId, pixelId) {
|
|
43
|
+
return (0, client_1.request)('GET', `${BASE_URL}/pixel/orgs/${encodeURIComponent(orgId)}/identity/${encodeURIComponent(pixelId)}`, apiKey);
|
|
44
44
|
}
|
package/package.json
CHANGED
package/src/hq.d.ts
CHANGED
package/src/hq.ts
CHANGED
package/src/image.ts
CHANGED
|
@@ -12,20 +12,24 @@ export interface ImageJob {
|
|
|
12
12
|
created_at: string;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export async function generateImage(apiKey: string, payload: {
|
|
15
|
+
export async function generateImage(apiKey: string, orgId: string, payload: {
|
|
16
16
|
prompt: string;
|
|
17
17
|
aspect_ratio?: '1:1' | '16:9' | '9:16' | '4:3' | '3:4';
|
|
18
18
|
style?: string;
|
|
19
19
|
colors?: string;
|
|
20
20
|
has_text?: boolean;
|
|
21
21
|
}): Promise<{ job_id: string; status: string }> {
|
|
22
|
-
return request('POST', `${BASE_URL}/image/generate`, apiKey, payload);
|
|
22
|
+
return request('POST', `${BASE_URL}/image/orgs/${encodeURIComponent(orgId)}/generate`, apiKey, payload);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export async function getImageJob(apiKey: string, jobId: string): Promise<ImageJob> {
|
|
26
|
-
return request('GET', `${BASE_URL}/image/jobs/${encodeURIComponent(jobId)}`, apiKey);
|
|
25
|
+
export async function getImageJob(apiKey: string, orgId: string, jobId: string): Promise<ImageJob> {
|
|
26
|
+
return request('GET', `${BASE_URL}/image/orgs/${encodeURIComponent(orgId)}/jobs/${encodeURIComponent(jobId)}`, apiKey);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
export async function listImages(apiKey: string): Promise<ImageJob[]> {
|
|
30
|
-
return request('GET', `${BASE_URL}/image/list`, apiKey);
|
|
29
|
+
export async function listImages(apiKey: string, orgId: string): Promise<ImageJob[]> {
|
|
30
|
+
return request('GET', `${BASE_URL}/image/orgs/${encodeURIComponent(orgId)}/list`, apiKey);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export async function deleteImage(apiKey: string, orgId: string, jobId: string): Promise<void> {
|
|
34
|
+
return request('DELETE', `${BASE_URL}/image/orgs/${encodeURIComponent(orgId)}/images/${encodeURIComponent(jobId)}`, apiKey);
|
|
31
35
|
}
|
package/src/pixel.ts
CHANGED
|
@@ -12,7 +12,7 @@ export interface InteractionsResponse {
|
|
|
12
12
|
export interface Visit { type: 'visit'; pixel_id: string; from_url: string; to_url: string; ts: string }
|
|
13
13
|
export interface PixelEvent { type: 'event'; pixel_id: string; event_type: 'sent' | 'open' | 'click' | 'page_visit'; url?: string; campaign_id?: string; ts: string }
|
|
14
14
|
|
|
15
|
-
export async function getInteractions(apiKey: string, params: {
|
|
15
|
+
export async function getInteractions(apiKey: string, orgId: string, params: {
|
|
16
16
|
website?: string;
|
|
17
17
|
domain?: string;
|
|
18
18
|
campaign_id?: string;
|
|
@@ -28,11 +28,11 @@ export async function getInteractions(apiKey: string, params: {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
const queryString = qs.toString();
|
|
31
|
-
const url = `${BASE_URL}/pixel/interactions${queryString ? `?${queryString}` : ''}`;
|
|
31
|
+
const url = `${BASE_URL}/pixel/orgs/${encodeURIComponent(orgId)}/interactions${queryString ? `?${queryString}` : ''}`;
|
|
32
32
|
return request('GET', url, apiKey);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
export async function getVisits(apiKey: string, params: { website: string; from?: string; to?: string; limit?: number; offset?: number }): Promise<{ visits: Visit[]; total: number; limit: number; offset: number }> {
|
|
35
|
+
export async function getVisits(apiKey: string, orgId: string, params: { website: string; from?: string; to?: string; limit?: number; offset?: number }): Promise<{ visits: Visit[]; total: number; limit: number; offset: number }> {
|
|
36
36
|
const qs = new URLSearchParams();
|
|
37
37
|
for (const [key, val] of Object.entries(params)) {
|
|
38
38
|
if (val !== undefined && val !== null) {
|
|
@@ -40,11 +40,11 @@ export async function getVisits(apiKey: string, params: { website: string; from?
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
const queryString = qs.toString();
|
|
43
|
-
const url = `${BASE_URL}/pixel/visits${queryString ? `?${queryString}` : ''}`;
|
|
43
|
+
const url = `${BASE_URL}/pixel/orgs/${encodeURIComponent(orgId)}/visits${queryString ? `?${queryString}` : ''}`;
|
|
44
44
|
return request('GET', url, apiKey);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
export async function getEvents(apiKey: string, params: { campaign_id?: string; domain?: string; from?: string; to?: string; limit?: number; offset?: number }): Promise<{ events: PixelEvent[]; total: number; limit: number; offset: number }> {
|
|
47
|
+
export async function getEvents(apiKey: string, orgId: string, params: { campaign_id?: string; domain?: string; from?: string; to?: string; limit?: number; offset?: number }): Promise<{ events: PixelEvent[]; total: number; limit: number; offset: number }> {
|
|
48
48
|
const qs = new URLSearchParams();
|
|
49
49
|
for (const [key, val] of Object.entries(params)) {
|
|
50
50
|
if (val !== undefined && val !== null) {
|
|
@@ -52,10 +52,10 @@ export async function getEvents(apiKey: string, params: { campaign_id?: string;
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
const queryString = qs.toString();
|
|
55
|
-
const url = `${BASE_URL}/pixel/events${queryString ? `?${queryString}` : ''}`;
|
|
55
|
+
const url = `${BASE_URL}/pixel/orgs/${encodeURIComponent(orgId)}/events${queryString ? `?${queryString}` : ''}`;
|
|
56
56
|
return request('GET', url, apiKey);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
export async function getIdentity(apiKey: string, pixelId: string): Promise<{ uuid: string; is_resolved: boolean; nodes: Record<string, { type: string; probability: number }>; latency_ms: number }> {
|
|
60
|
-
return request('GET', `${BASE_URL}/pixel/identity/${encodeURIComponent(pixelId)}`, apiKey);
|
|
59
|
+
export async function getIdentity(apiKey: string, orgId: string, pixelId: string): Promise<{ uuid: string; is_resolved: boolean; nodes: Record<string, { type: string; probability: number }>; latency_ms: number }> {
|
|
60
|
+
return request('GET', `${BASE_URL}/pixel/orgs/${encodeURIComponent(orgId)}/identity/${encodeURIComponent(pixelId)}`, apiKey);
|
|
61
61
|
}
|