Skip to content

Commit

Permalink
Refine SingleFilterSearchRequest interface to permit array values f…
Browse files Browse the repository at this point in the history
…or the `IN` and `NIN` operators
  • Loading branch information
kang8 committed Dec 23, 2024
1 parent 56655c1 commit 49f4faf
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 7 deletions.
24 changes: 18 additions & 6 deletions src/api/types/SingleFilterSearchRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,30 @@
* This file was auto-generated by Fern from our API Definition.
*/

/**
* Search using Intercoms Search APIs with a single filter.
*/
export interface SingleFilterSearchRequest {
interface SingleFilterSearchRequestWithStringValue {
/** The accepted field that you want to search on. */
field?: string;
/** The accepted operators you can use to define how you want to search for the value. */
operator?: SingleFilterSearchRequest.Operator;
/** The operator for single value types */
operator?: "=" | "!=" | "<" | ">" | "~" | "!~" | "^" | "$";
/** The value that you want to search on. */
value?: string;
}

interface SingleFilterSearchRequestWithArrayValue {
/** The accepted field that you want to search on. */
field?: string;
/** The operator specifically for array value types */
operator?: "IN" | "NIN";
/** The value that you want to search on. */
value?: string[];
}
/**
* Search using Intercoms Search APIs with a single filter.
*/
export type SingleFilterSearchRequest =
SingleFilterSearchRequestWithStringValue |
SingleFilterSearchRequestWithArrayValue;

export namespace SingleFilterSearchRequest {
/**
* The accepted operators you can use to define how you want to search for the value.
Expand Down
21 changes: 20 additions & 1 deletion tests/integration/conversations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ describe("Conversations", () => {
expect(response).toBeDefined();
});

it("search", async () => {
it("search with string value", async () => {
// act
const response = await client.conversations.search({
query: {
Expand All @@ -283,4 +283,23 @@ describe("Conversations", () => {
// assert
expect(response).toBeDefined();
});

it("search with array value", async () => {
// act
const response = await client.conversations.search({
query: {
operator: "AND",
value: [
{
field: "id",
operator: "IN",
value: ["123", '321'],
},
],
},
});

// assert
expect(response).toBeDefined();
});
});

0 comments on commit 49f4faf

Please sign in to comment.