Skip to content

Commit f71b7c7

Browse files
committed
Use mergedOptions for query params
1 parent 71e9bca commit f71b7c7

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
@@ -68,8 +68,11 @@ export type FetchFeedOptions = {
6868
__fetchSource?: "socket" | "http";
6969
} & Omit<FeedClientOptions, "__experimentalCrossBrowserUpdates">;
7070

71-
// The final data shape that is sent to the API
72-
// Should match types here: https://docs.knock.app/reference#get-feed
71+
/**
72+
* The final data shape that is sent to the the list feed items endpoint of the Knock API.
73+
*
74+
* @see https://docs.knock.app/api-reference/users/feeds/list_items
75+
*/
7376
export type FetchFeedOptionsForRequest = Omit<
7477
FeedClientOptions,
7578
"trigger_data" | "exclude"
@@ -78,6 +81,10 @@ export type FetchFeedOptionsForRequest = Omit<
7881
trigger_data?: string;
7982
/** Fields to exclude from the response, joined by commas. */
8083
exclude?: string;
84+
"inserted_at.gte"?: string;
85+
"inserted_at.lte"?: string;
86+
"inserted_at.gt"?: string;
87+
"inserted_at.lt"?: string;
8188
// Unset options that should not be sent to the API
8289
__loadingType: undefined;
8390
__fetchSource: undefined;

0 commit comments

Comments
 (0)