@aicats/sdk 1.0.3 → 1.1.0
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.js +5 -4
- package/dist/index.mjs +5 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -52,7 +52,7 @@ var Theme = /* @__PURE__ */ ((Theme2) => {
|
|
|
52
52
|
return Theme2;
|
|
53
53
|
})(Theme || {});
|
|
54
54
|
|
|
55
|
-
// src/api/
|
|
55
|
+
// src/api/ai-cats-api.ts
|
|
56
56
|
var ApiUrl = "https://api.ai-cats.net/v1";
|
|
57
57
|
async function toResponseType(buffer, type = "blob") {
|
|
58
58
|
switch (type) {
|
|
@@ -83,6 +83,7 @@ async function random(options) {
|
|
|
83
83
|
const params = new URLSearchParams();
|
|
84
84
|
if (options?.size) params.set("size", options.size);
|
|
85
85
|
if (options?.theme) params.set("theme", options.theme);
|
|
86
|
+
params.set("rnd", Math.random().toString());
|
|
86
87
|
const query = params.toString() ? `?${params}` : "";
|
|
87
88
|
const response = await fetch(`${ApiUrl}/cat${query}`);
|
|
88
89
|
if (!response.ok) {
|
|
@@ -93,7 +94,7 @@ async function random(options) {
|
|
|
93
94
|
}
|
|
94
95
|
async function getById(id, options) {
|
|
95
96
|
const size = options?.size ?? "1024" /* Large */;
|
|
96
|
-
const response = await fetch(`${ApiUrl}/cat/${id}?size=${size}`);
|
|
97
|
+
const response = await fetch(`${ApiUrl}/cat/${id}.jpg?size=${size}`);
|
|
97
98
|
if (!response.ok) {
|
|
98
99
|
throw new Error(`Error fetching cat image: ${response.statusText}`);
|
|
99
100
|
}
|
|
@@ -165,7 +166,7 @@ async function getCount(theme) {
|
|
|
165
166
|
const data = await response.json();
|
|
166
167
|
return data.count;
|
|
167
168
|
}
|
|
168
|
-
var
|
|
169
|
+
var AiCatsAPI = {
|
|
169
170
|
random,
|
|
170
171
|
getById,
|
|
171
172
|
getInfo,
|
|
@@ -177,7 +178,7 @@ var V1Api = {
|
|
|
177
178
|
};
|
|
178
179
|
|
|
179
180
|
// src/index.ts
|
|
180
|
-
var AiCats =
|
|
181
|
+
var AiCats = AiCatsAPI;
|
|
181
182
|
// Annotate the CommonJS export names for ESM import in node:
|
|
182
183
|
0 && (module.exports = {
|
|
183
184
|
AiCats,
|
package/dist/index.mjs
CHANGED
|
@@ -24,7 +24,7 @@ var Theme = /* @__PURE__ */ ((Theme2) => {
|
|
|
24
24
|
return Theme2;
|
|
25
25
|
})(Theme || {});
|
|
26
26
|
|
|
27
|
-
// src/api/
|
|
27
|
+
// src/api/ai-cats-api.ts
|
|
28
28
|
var ApiUrl = "https://api.ai-cats.net/v1";
|
|
29
29
|
async function toResponseType(buffer, type = "blob") {
|
|
30
30
|
switch (type) {
|
|
@@ -55,6 +55,7 @@ async function random(options) {
|
|
|
55
55
|
const params = new URLSearchParams();
|
|
56
56
|
if (options?.size) params.set("size", options.size);
|
|
57
57
|
if (options?.theme) params.set("theme", options.theme);
|
|
58
|
+
params.set("rnd", Math.random().toString());
|
|
58
59
|
const query = params.toString() ? `?${params}` : "";
|
|
59
60
|
const response = await fetch(`${ApiUrl}/cat${query}`);
|
|
60
61
|
if (!response.ok) {
|
|
@@ -65,7 +66,7 @@ async function random(options) {
|
|
|
65
66
|
}
|
|
66
67
|
async function getById(id, options) {
|
|
67
68
|
const size = options?.size ?? "1024" /* Large */;
|
|
68
|
-
const response = await fetch(`${ApiUrl}/cat/${id}?size=${size}`);
|
|
69
|
+
const response = await fetch(`${ApiUrl}/cat/${id}.jpg?size=${size}`);
|
|
69
70
|
if (!response.ok) {
|
|
70
71
|
throw new Error(`Error fetching cat image: ${response.statusText}`);
|
|
71
72
|
}
|
|
@@ -137,7 +138,7 @@ async function getCount(theme) {
|
|
|
137
138
|
const data = await response.json();
|
|
138
139
|
return data.count;
|
|
139
140
|
}
|
|
140
|
-
var
|
|
141
|
+
var AiCatsAPI = {
|
|
141
142
|
random,
|
|
142
143
|
getById,
|
|
143
144
|
getInfo,
|
|
@@ -149,7 +150,7 @@ var V1Api = {
|
|
|
149
150
|
};
|
|
150
151
|
|
|
151
152
|
// src/index.ts
|
|
152
|
-
var AiCats =
|
|
153
|
+
var AiCats = AiCatsAPI;
|
|
153
154
|
export {
|
|
154
155
|
AiCats,
|
|
155
156
|
Size,
|