@chirpie/sdk 1.0.7 → 1.0.9
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.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +18 -6
- package/dist/index.mjs +18 -6
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -96,7 +96,7 @@ interface ApiKeyInfo {
|
|
|
96
96
|
key_prefix: string;
|
|
97
97
|
last_used_at: string | null;
|
|
98
98
|
created_at: string;
|
|
99
|
-
|
|
99
|
+
expires_at: string | null;
|
|
100
100
|
}
|
|
101
101
|
interface CreatePostInput {
|
|
102
102
|
account_id: string;
|
|
@@ -183,6 +183,8 @@ declare class ChirpieClient {
|
|
|
183
183
|
key: string;
|
|
184
184
|
prefix: string;
|
|
185
185
|
name: string;
|
|
186
|
+
expires_at: string;
|
|
187
|
+
message: string;
|
|
186
188
|
}>;
|
|
187
189
|
listKeys(): Promise<ApiKeyInfo[]>;
|
|
188
190
|
revokeKey(id: string): Promise<{
|
package/dist/index.d.ts
CHANGED
|
@@ -96,7 +96,7 @@ interface ApiKeyInfo {
|
|
|
96
96
|
key_prefix: string;
|
|
97
97
|
last_used_at: string | null;
|
|
98
98
|
created_at: string;
|
|
99
|
-
|
|
99
|
+
expires_at: string | null;
|
|
100
100
|
}
|
|
101
101
|
interface CreatePostInput {
|
|
102
102
|
account_id: string;
|
|
@@ -183,6 +183,8 @@ declare class ChirpieClient {
|
|
|
183
183
|
key: string;
|
|
184
184
|
prefix: string;
|
|
185
185
|
name: string;
|
|
186
|
+
expires_at: string;
|
|
187
|
+
message: string;
|
|
186
188
|
}>;
|
|
187
189
|
listKeys(): Promise<ApiKeyInfo[]>;
|
|
188
190
|
revokeKey(id: string): Promise<{
|
package/dist/index.js
CHANGED
|
@@ -65,12 +65,24 @@ var ChirpieClient = class {
|
|
|
65
65
|
Authorization: `Bearer ${this.apiKey}`,
|
|
66
66
|
"Content-Type": "application/json"
|
|
67
67
|
};
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
68
|
+
let res;
|
|
69
|
+
try {
|
|
70
|
+
res = await fetch(url, {
|
|
71
|
+
method,
|
|
72
|
+
headers,
|
|
73
|
+
body: body ? JSON.stringify(body) : void 0
|
|
74
|
+
});
|
|
75
|
+
} catch (err) {
|
|
76
|
+
throw new ChirpieError(
|
|
77
|
+
err instanceof Error ? `Network error: ${err.message}` : "Network error"
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
let json;
|
|
81
|
+
try {
|
|
82
|
+
json = await res.json();
|
|
83
|
+
} catch {
|
|
84
|
+
throw new ChirpieApiError("parse_error", "Invalid response from server", res.status);
|
|
85
|
+
}
|
|
74
86
|
if (!res.ok) {
|
|
75
87
|
const err = json.error ?? { code: "unknown", message: "Request failed" };
|
|
76
88
|
throw new ChirpieApiError(err.code, err.message, res.status);
|
package/dist/index.mjs
CHANGED
|
@@ -33,12 +33,24 @@ var ChirpieClient = class {
|
|
|
33
33
|
Authorization: `Bearer ${this.apiKey}`,
|
|
34
34
|
"Content-Type": "application/json"
|
|
35
35
|
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
let res;
|
|
37
|
+
try {
|
|
38
|
+
res = await fetch(url, {
|
|
39
|
+
method,
|
|
40
|
+
headers,
|
|
41
|
+
body: body ? JSON.stringify(body) : void 0
|
|
42
|
+
});
|
|
43
|
+
} catch (err) {
|
|
44
|
+
throw new ChirpieError(
|
|
45
|
+
err instanceof Error ? `Network error: ${err.message}` : "Network error"
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
let json;
|
|
49
|
+
try {
|
|
50
|
+
json = await res.json();
|
|
51
|
+
} catch {
|
|
52
|
+
throw new ChirpieApiError("parse_error", "Invalid response from server", res.status);
|
|
53
|
+
}
|
|
42
54
|
if (!res.ok) {
|
|
43
55
|
const err = json.error ?? { code: "unknown", message: "Request failed" };
|
|
44
56
|
throw new ChirpieApiError(err.code, err.message, res.status);
|