Skip to content

Commit b67f436

Browse files
committed
Use mergedOptions for query params
1 parent 0bd81d8 commit b67f436

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

packages/client/src/clients/feed/feed.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ class Feed {
543543

544544
const mergedOptions = {
545545
...this.defaultOptions,
546-
...options,
546+
...mergeDateRangeParams(options),
547547
exclude: mergeAndDedupeArrays(
548548
this.defaultOptions.exclude,
549549
options.exclude,
@@ -552,15 +552,14 @@ class Feed {
552552

553553
// trigger_data should be a JSON string for the API
554554
// this function will format the trigger data if it's an object
555-
// https://docs.knock.app/reference#get-feed
555+
// https://docs.knock.app/api-reference/users/feeds/list_items
556556
const formattedTriggerData = getFormattedTriggerData(mergedOptions);
557557

558558
const formattedExclude = getFormattedExclude(mergedOptions);
559559

560560
// Always include the default params, if they have been set
561561
const queryParams: FetchFeedOptionsForRequest = {
562-
...this.defaultOptions,
563-
...mergeDateRangeParams(options),
562+
...mergedOptions,
564563
trigger_data: formattedTriggerData,
565564
exclude: formattedExclude,
566565
// Unset options that should not be sent to the API

packages/client/src/clients/feed/interfaces.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,11 @@ export type FetchFeedOptions = {
7070
__fetchSource?: "socket" | "http";
7171
} & Omit<FeedClientOptions, "__experimentalCrossBrowserUpdates">;
7272

73-
// The final data shape that is sent to the API
74-
// Should match types here: https://docs.knock.app/reference#get-feed
73+
/**
74+
* The final data shape that is sent to the the list feed items endpoint of the Knock API.
75+
*
76+
* @see https://docs.knock.app/api-reference/users/feeds/list_items
77+
*/
7578
export type FetchFeedOptionsForRequest = Omit<
7679
FeedClientOptions,
7780
"trigger_data" | "exclude"
@@ -80,6 +83,10 @@ export type FetchFeedOptionsForRequest = Omit<
8083
trigger_data?: string;
8184
/** Fields to exclude from the response, joined by commas. */
8285
exclude?: string;
86+
"inserted_at.gte"?: string;
87+
"inserted_at.lte"?: string;
88+
"inserted_at.gt"?: string;
89+
"inserted_at.lt"?: string;
8390
// Unset options that should not be sent to the API
8491
__loadingType: undefined;
8592
__fetchSource: undefined;

0 commit comments

Comments
 (0)