@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 CHANGED
@@ -52,7 +52,7 @@ var Theme = /* @__PURE__ */ ((Theme2) => {
52
52
  return Theme2;
53
53
  })(Theme || {});
54
54
 
55
- // src/api/v1.api.ts
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 V1Api = {
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 = V1Api;
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/v1.api.ts
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 V1Api = {
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 = V1Api;
153
+ var AiCats = AiCatsAPI;
153
154
  export {
154
155
  AiCats,
155
156
  Size,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aicats/sdk",
3
- "version": "1.0.3",
3
+ "version": "1.1.0",
4
4
  "description": "Official JavaScript SDK for the ai-cats.net API",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",