@cords/sdk 0.1.10 → 0.1.11

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 CHANGED
@@ -124,6 +124,12 @@ type ReportOptions = {
124
124
  country?: string;
125
125
  /** 25 results are included per page */
126
126
  page?: PageOptions["page"];
127
+ /** Type of report */
128
+ type?: "view" | "search";
129
+ dates?: {
130
+ start: Date;
131
+ end: Date;
132
+ };
127
133
  };
128
134
  type ReportRecordType = {
129
135
  ip: string;
package/dist/index.d.ts CHANGED
@@ -124,6 +124,12 @@ type ReportOptions = {
124
124
  country?: string;
125
125
  /** 25 results are included per page */
126
126
  page?: PageOptions["page"];
127
+ /** Type of report */
128
+ type?: "view" | "search";
129
+ dates?: {
130
+ start: Date;
131
+ end: Date;
132
+ };
127
133
  };
128
134
  type ReportRecordType = {
129
135
  ip: string;
package/dist/index.js CHANGED
@@ -219,17 +219,31 @@ var CordsPartnerAPI = ({
219
219
  const report = async (options) => {
220
220
  const url = formatUrl("/partner/approved/report");
221
221
  const params = new URLSearchParams();
222
- if (options == null ? void 0 : options.email) params.append("email", options.email);
222
+ if (options == null ? void 0 : options.email) params.append("filters[email]", options.email);
223
223
  if (options == null ? void 0 : options.searchTerm)
224
- params.append("searchTerm", options.searchTerm);
225
- if (options == null ? void 0 : options.keyType) params.append("keyType", options.keyType);
226
- if (options == null ? void 0 : options.apiKey) params.append("apiKey", options.apiKey);
227
- if (options == null ? void 0 : options.province) params.append("province", options.province);
224
+ params.append("filters[search-term]", options.searchTerm);
225
+ if (options == null ? void 0 : options.keyType)
226
+ params.append("filters[key-type]", options.keyType);
227
+ if (options == null ? void 0 : options.apiKey) params.append("filters[api-key]", options.apiKey);
228
+ if (options == null ? void 0 : options.type) params.append("filters[type]", options.type);
229
+ if (options == null ? void 0 : options.province)
230
+ params.append("filters[province]", options.province);
228
231
  if (options == null ? void 0 : options.postalCode)
229
- params.append("postalCode", options.postalCode);
230
- if (options == null ? void 0 : options.country) params.append("country", options.country);
232
+ params.append("filters[postal-code]", options.postalCode);
233
+ if (options == null ? void 0 : options.country)
234
+ params.append("filters[country]", options.country);
231
235
  if (options == null ? void 0 : options.page) params.append("page", options.page.toString());
232
- const res = await request(requestOptions, url.toString());
236
+ if (options == null ? void 0 : options.dates) {
237
+ params.append(
238
+ "filters[dates]",
239
+ options.dates.start.getTime() + "|" + options.dates.end.getTime()
240
+ );
241
+ }
242
+ console.log(decodeURIComponent(url.toString() + "?" + params));
243
+ const res = await request(
244
+ requestOptions,
245
+ url.toString() + "?" + params
246
+ );
233
247
  const data = await res.json();
234
248
  return data;
235
249
  };
package/dist/index.mjs CHANGED
@@ -196,17 +196,31 @@ var CordsPartnerAPI = ({
196
196
  const report = async (options) => {
197
197
  const url = formatUrl("/partner/approved/report");
198
198
  const params = new URLSearchParams();
199
- if (options == null ? void 0 : options.email) params.append("email", options.email);
199
+ if (options == null ? void 0 : options.email) params.append("filters[email]", options.email);
200
200
  if (options == null ? void 0 : options.searchTerm)
201
- params.append("searchTerm", options.searchTerm);
202
- if (options == null ? void 0 : options.keyType) params.append("keyType", options.keyType);
203
- if (options == null ? void 0 : options.apiKey) params.append("apiKey", options.apiKey);
204
- if (options == null ? void 0 : options.province) params.append("province", options.province);
201
+ params.append("filters[search-term]", options.searchTerm);
202
+ if (options == null ? void 0 : options.keyType)
203
+ params.append("filters[key-type]", options.keyType);
204
+ if (options == null ? void 0 : options.apiKey) params.append("filters[api-key]", options.apiKey);
205
+ if (options == null ? void 0 : options.type) params.append("filters[type]", options.type);
206
+ if (options == null ? void 0 : options.province)
207
+ params.append("filters[province]", options.province);
205
208
  if (options == null ? void 0 : options.postalCode)
206
- params.append("postalCode", options.postalCode);
207
- if (options == null ? void 0 : options.country) params.append("country", options.country);
209
+ params.append("filters[postal-code]", options.postalCode);
210
+ if (options == null ? void 0 : options.country)
211
+ params.append("filters[country]", options.country);
208
212
  if (options == null ? void 0 : options.page) params.append("page", options.page.toString());
209
- const res = await request(requestOptions, url.toString());
213
+ if (options == null ? void 0 : options.dates) {
214
+ params.append(
215
+ "filters[dates]",
216
+ options.dates.start.getTime() + "|" + options.dates.end.getTime()
217
+ );
218
+ }
219
+ console.log(decodeURIComponent(url.toString() + "?" + params));
220
+ const res = await request(
221
+ requestOptions,
222
+ url.toString() + "?" + params
223
+ );
210
224
  const data = await res.json();
211
225
  return data;
212
226
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "main": "./dist/index.js",
4
4
  "module": "./dist/index.mjs",
5
5
  "types": "./dist/index.d.ts",
6
- "version": "0.1.10",
6
+ "version": "0.1.11",
7
7
  "private": false,
8
8
  "publishConfig": {
9
9
  "access": "public"