Skip to content

Commit

Permalink
refactor(pipelines): removing deprecated endpoint
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Removal of /rest/search/v2/admin/pipelines/ml/version due to deprecation
  • Loading branch information
lprovost-coveo committed Oct 11, 2023
1 parent 0e2c328 commit 312a390
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 30 deletions.
24 changes: 7 additions & 17 deletions src/resources/Pipelines/Pipelines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
ListPipelinesOptions,
ListPipelinesReturnVariant,
NewPipelineModel,
PipelineBackendVersion,
PipelineModel,
UpdatePipelineModel,
} from './PipelinesInterfaces.js';
Expand All @@ -27,10 +26,7 @@ export default class Pipelines extends Resource {
groups: StatementGroups;
facetRules: FacetStateRules;

constructor(
protected api: API,
protected serverlessApi: API,
) {
constructor(protected api: API, protected serverlessApi: API) {
super(api, serverlessApi);

this.associations = new MLAssociations(api, serverlessApi);
Expand All @@ -41,31 +37,25 @@ export default class Pipelines extends Resource {
this.facetRules = new FacetStateRules(api, serverlessApi);
}

getMLVersion() {
return this.api.get<PipelineBackendVersion>(
this.buildPath(`${Pipelines.searchUrlVersion2}/ml/version`, {organizationId: this.api.organizationId}),
);
}

list<ListPipelinesVariant extends ListPipelinesOptions>(options?: ListPipelinesVariant) {
return this.api.get<ListPipelinesReturnVariant<ListPipelinesVariant>>(
this.buildPath(Pipelines.searchUrlVersion1, {organizationId: this.api.organizationId, ...options}),
this.buildPath(Pipelines.searchUrlVersion1, {organizationId: this.api.organizationId, ...options})
);
}

get(pipelineId: string) {
return this.api.get<PipelineModel>(
this.buildPath(`${Pipelines.searchUrlVersion1}/${pipelineId}`, {
organizationId: this.api.organizationId,
}),
})
);
}

delete(pipelineId: string) {
return this.api.delete(
this.buildPath(`${Pipelines.searchUrlVersion1}/${pipelineId}`, {
organizationId: this.api.organizationId,
}),
})
);
}

Expand All @@ -74,7 +64,7 @@ export default class Pipelines extends Resource {
this.buildPath(`${Pipelines.searchUrlVersion1}/${pipeline.id}`, {
organizationId: this.api.organizationId,
}),
pipeline,
pipeline
);
}

Expand All @@ -83,7 +73,7 @@ export default class Pipelines extends Resource {
this.buildPath(`${Pipelines.searchUrlVersion1}/${pipelineId}/duplicate`, {
organizationId: this.api.organizationId,
}),
granularResource,
granularResource
);
}

Expand All @@ -92,7 +82,7 @@ export default class Pipelines extends Resource {
this.buildPath(Pipelines.searchUrlVersion1, {
organizationId: this.api.organizationId,
}),
pipeline,
pipeline
);
}
}
5 changes: 0 additions & 5 deletions src/resources/Pipelines/PipelinesInterfaces.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import {GranularResource, PageModel, Paginated} from '../BaseInterfaces.js';
import {ConditionModel} from './Conditions/index.js';

export interface PipelineBackendVersion {
version: '1' | '2';
}

interface PipelineInterfaceUrl {
/**
* Url of the pages affected by this query pipeline.
Expand Down
8 changes: 0 additions & 8 deletions src/resources/Pipelines/tests/Pipelines.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ describe('Pipelines', () => {
});
});

describe('getBackendVersion', () => {
it('should make a GET call to the specific Pipelines url', () => {
pipelines.getMLVersion();
expect(api.get).toHaveBeenCalledTimes(1);
expect(api.get).toHaveBeenCalledWith(`${Pipelines.searchUrlVersion2}/ml/version`);
});
});

describe('get', () => {
it('should make a GET call to /rest/search/v1/admin/pipelines/:id', () => {
pipelines.get('🔥');
Expand Down

0 comments on commit 312a390

Please sign in to comment.