Skip to content

Commit 74c2cfd

Browse files
authored
feat(conditions): add the bulkDelete and update the ConditionInterface (#969)
1 parent 355dd2c commit 74c2cfd

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

src/resources/Pipelines/Conditions/Condition.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,19 @@ export default class Condition extends Resource {
7575
},
7676
);
7777
}
78+
79+
/**
80+
* Bulk delete of condition statements
81+
* @param conditionIds A list of resource identifiers to delete. A maximum of 100 can be sent.
82+
*/
83+
bulkDelete(conditionIds: string[]) {
84+
return this.api.post(
85+
this.buildPath(`${Condition.baseUrl}/bulkDelete`, {
86+
organizationId: this.api.organizationId,
87+
}),
88+
{
89+
ids: conditionIds,
90+
},
91+
);
92+
}
7893
}

src/resources/Pipelines/Conditions/ConditionInterfaces.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ export interface ConditionModel {
2323
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2424
detailed: any;
2525

26+
/**
27+
* The identifier of the Coveo Cloud platform user who last modified this.
28+
*/
29+
modifiedBy?: string;
30+
31+
/**
32+
* The last time this was modified. (ISO 8601)
33+
*/
34+
modifiedAt?: string;
35+
2636
/**
2737
* @deprecated
2838
* This property is exposed for backward compatibility reasons.

src/resources/Pipelines/Conditions/tests/Condition.spec.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,21 @@ describe('Condition', () => {
105105
});
106106
});
107107
});
108+
describe('bulkDelete', () => {
109+
it('make a POST call to the conditions bulkDelete url', async () => {
110+
await conditions.bulkDelete([]);
111+
expect(api.post).toHaveBeenCalledTimes(1);
112+
expect(api.post).toHaveBeenCalledWith('/rest/search/v1/admin/pipelines/statements/bulkDelete', {
113+
ids: [],
114+
});
115+
});
116+
117+
it('include the conditionIds on the request body', async () => {
118+
await conditions.bulkDelete(['hello', 'bonjour']);
119+
expect(api.post).toHaveBeenCalledTimes(1);
120+
expect(api.post).toHaveBeenCalledWith('/rest/search/v1/admin/pipelines/statements/bulkDelete', {
121+
ids: ['hello', 'bonjour'],
122+
});
123+
});
124+
});
108125
});

0 commit comments

Comments
 (0)