@crosspost/sdk 0.2.9 → 0.2.10

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.cjs CHANGED
@@ -369,30 +369,6 @@ async function makeRequest(method, path, options, data, query) {
369
369
  }
370
370
 
371
371
  // src/api/activity.ts
372
- function createFilterQuery(query) {
373
- if (!query) return {};
374
- const result = {};
375
- if (query.limit !== void 0) {
376
- result.limit = query.limit;
377
- }
378
- if (query.offset !== void 0) {
379
- result.offset = query.offset;
380
- }
381
- if (query.filter) {
382
- const filterParams = query.filter;
383
- for (const filterKey in filterParams) {
384
- if (Object.prototype.hasOwnProperty.call(filterParams, filterKey) && filterParams[filterKey] !== void 0) {
385
- const value = filterParams[filterKey];
386
- if (Array.isArray(value)) {
387
- result[`filter[${filterKey}]`] = value.join(",");
388
- } else {
389
- result[`filter[${filterKey}]`] = String(value);
390
- }
391
- }
392
- }
393
- }
394
- return result;
395
- }
396
372
  var ActivityApi = class {
397
373
  /**
398
374
  * Creates an instance of ActivityApi
@@ -412,7 +388,7 @@ var ActivityApi = class {
412
388
  "/api/activity",
413
389
  this.options,
414
390
  void 0,
415
- createFilterQuery(query)
391
+ query
416
392
  );
417
393
  }
418
394
  /**
@@ -427,7 +403,7 @@ var ActivityApi = class {
427
403
  `/api/activity/${signerId}`,
428
404
  this.options,
429
405
  void 0,
430
- createFilterQuery(query)
406
+ query
431
407
  );
432
408
  }
433
409
  /**
@@ -442,7 +418,7 @@ var ActivityApi = class {
442
418
  `/api/activity/${signerId}/posts`,
443
419
  this.options,
444
420
  void 0,
445
- createFilterQuery(query)
421
+ query
446
422
  );
447
423
  }
448
424
  };
package/dist/index.js CHANGED
@@ -326,30 +326,6 @@ async function makeRequest(method, path, options, data, query) {
326
326
  }
327
327
 
328
328
  // src/api/activity.ts
329
- function createFilterQuery(query) {
330
- if (!query) return {};
331
- const result = {};
332
- if (query.limit !== void 0) {
333
- result.limit = query.limit;
334
- }
335
- if (query.offset !== void 0) {
336
- result.offset = query.offset;
337
- }
338
- if (query.filter) {
339
- const filterParams = query.filter;
340
- for (const filterKey in filterParams) {
341
- if (Object.prototype.hasOwnProperty.call(filterParams, filterKey) && filterParams[filterKey] !== void 0) {
342
- const value = filterParams[filterKey];
343
- if (Array.isArray(value)) {
344
- result[`filter[${filterKey}]`] = value.join(",");
345
- } else {
346
- result[`filter[${filterKey}]`] = String(value);
347
- }
348
- }
349
- }
350
- }
351
- return result;
352
- }
353
329
  var ActivityApi = class {
354
330
  /**
355
331
  * Creates an instance of ActivityApi
@@ -369,7 +345,7 @@ var ActivityApi = class {
369
345
  "/api/activity",
370
346
  this.options,
371
347
  void 0,
372
- createFilterQuery(query)
348
+ query
373
349
  );
374
350
  }
375
351
  /**
@@ -384,7 +360,7 @@ var ActivityApi = class {
384
360
  `/api/activity/${signerId}`,
385
361
  this.options,
386
362
  void 0,
387
- createFilterQuery(query)
363
+ query
388
364
  );
389
365
  }
390
366
  /**
@@ -399,7 +375,7 @@ var ActivityApi = class {
399
375
  `/api/activity/${signerId}/posts`,
400
376
  this.options,
401
377
  void 0,
402
- createFilterQuery(query)
378
+ query
403
379
  );
404
380
  }
405
381
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crosspost/sdk",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
4
4
  "description": "SDK for interacting with the Crosspost API",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -9,48 +9,6 @@ import type {
9
9
  } from '@crosspost/types';
10
10
  import { makeRequest, type RequestOptions } from '../core/request.ts';
11
11
 
12
- /**
13
- * Creates a modified query object with filter properties
14
- * @param query The original query object
15
- * @returns A new query object with filter properties formatted as filter[key]=value.
16
- */
17
- function createFilterQuery<
18
- T extends { filter?: Record<string, any>; limit?: number; offset?: number },
19
- >(
20
- query?: T,
21
- ): Record<string, string | number | boolean> {
22
- if (!query) return {};
23
-
24
- const result: Record<string, string | number | boolean> = {};
25
-
26
- if (query.limit !== undefined) {
27
- result.limit = query.limit;
28
- }
29
- if (query.offset !== undefined) {
30
- result.offset = query.offset;
31
- }
32
-
33
- // e.g., query.filter = { timeframe: 'month', platforms: ['twitter'] }
34
- // becomes result['filter[timeframe]'] = 'month', result['filter[platforms]'] = 'twitter'
35
- if (query.filter) {
36
- const filterParams = query.filter;
37
- for (const filterKey in filterParams) {
38
- if (
39
- Object.prototype.hasOwnProperty.call(filterParams, filterKey) &&
40
- filterParams[filterKey] !== undefined
41
- ) {
42
- const value = filterParams[filterKey];
43
- if (Array.isArray(value)) {
44
- result[`filter[${filterKey}]`] = value.join(',');
45
- } else {
46
- result[`filter[${filterKey}]`] = String(value);
47
- }
48
- }
49
- }
50
- }
51
- return result;
52
- }
53
-
54
12
  /**
55
13
  * Activity-related API operations
56
14
  */
@@ -78,7 +36,7 @@ export class ActivityApi {
78
36
  '/api/activity',
79
37
  this.options,
80
38
  undefined,
81
- createFilterQuery(query),
39
+ query,
82
40
  );
83
41
  }
84
42
 
@@ -97,7 +55,7 @@ export class ActivityApi {
97
55
  `/api/activity/${signerId}`,
98
56
  this.options,
99
57
  undefined,
100
- createFilterQuery(query),
58
+ query,
101
59
  );
102
60
  }
103
61
 
@@ -116,7 +74,7 @@ export class ActivityApi {
116
74
  `/api/activity/${signerId}/posts`,
117
75
  this.options,
118
76
  undefined,
119
- createFilterQuery(query),
77
+ query,
120
78
  );
121
79
  }
122
80
  }