Skip to content

Commit

Permalink
feat(MHUB-1665): mark as deprecated product and product listing inter…
Browse files Browse the repository at this point in the history
…faces & methods (#847)

* feat: mark as deprecated product and product listing interfaces

* feat: deprecate products and product listing methods

* feat: add high level deprecation
  • Loading branch information
samuelfullerthomas authored Aug 15, 2024
1 parent 4d1b923 commit b3dc1bc
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/resources/Catalogs/ProductListing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,47 +8,71 @@ import {
CatalogProductListingsGroupModel,
} from './ProductListingInterfaces.js';

/**
* @deprecated
*/
export default class ProductListing extends Resource {
static baseCatalogsUrl = `/rest/organizations/${API.orgPlaceholder}/catalogs`;
static baseProductListingsUrl = `/rest/organizations/${API.orgPlaceholder}/productlistings`;

/**
* @deprecated
*/
list(catalogId: string, options?: ProductListingsListOptions) {
const normalizedOptions = normalizePaginatedOptions(options);
return this.api.get<PageModel<ProductListingModel>>(
this.buildPath(`${ProductListing.baseCatalogsUrl}/${catalogId}/productlistings`, normalizedOptions),
);
}

/**
* @deprecated
*/
create(catalogId: string, model: New<ProductListingModel>) {
return this.api.post<ProductListingModel>(
`${ProductListing.baseCatalogsUrl}/${catalogId}/productlistings`,
model,
);
}

/**
* @deprecated
*/
delete(catalogId: string, productListingId: string) {
return this.api.delete(`${ProductListing.baseCatalogsUrl}/${catalogId}/productlistings/${productListingId}`);
}

/**
* @deprecated
*/
get(catalogId: string, productListingId: string) {
return this.api.get<ProductListingModel>(
`${ProductListing.baseCatalogsUrl}/${catalogId}/productlistings/${productListingId}`,
);
}

/**
* @deprecated
*/
update(catalogId: string, model: ProductListingModel) {
return this.api.put<ProductListingModel>(
`${ProductListing.baseCatalogsUrl}/${catalogId}/productlistings/${model.id}`,
model,
);
}

/**
* @deprecated
*/
getByCatalog() {
return this.api.get<PageModel<CatalogProductListingsGroupModel>>(
`${ProductListing.baseProductListingsUrl}/catalogs`,
);
}

/**
* @deprecated
*/
getUrls() {
return this.api.get<string[]>(`${ProductListing.baseProductListingsUrl}/urls`);
}
Expand Down
19 changes: 19 additions & 0 deletions src/resources/Catalogs/ProductListingConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@ import {
ProductListingConfigurationOptions,
} from './ProductListingConfigurationInterfaces.js';

/**
* @deprecated
*/
export default class ProductListingConfiguration extends Resource {
static baseUrl = `/rest/organizations/${API.orgPlaceholder}/catalogs`;

/**
* @deprecated
*/
list(catalogId: string, productListingId: string, options?: ProductListingConfigurationOptions) {
const normalizedOptions = normalizePaginatedOptions(options);
return this.api.get<PageModel<ProductListingConfigurationModel>>(
Expand All @@ -19,25 +25,38 @@ export default class ProductListingConfiguration extends Resource {
),
);
}

/**
* @deprecated
*/
create(catalogId: string, productListingId: string, rankingConfiguration: New<ProductListingConfigurationModel>) {
return this.api.post(
`${ProductListingConfiguration.baseUrl}/${catalogId}/productlistings/${productListingId}/configurations`,
rankingConfiguration,
);
}

/**
* @deprecated
*/
delete(catalogId: string, productListingId: string, productListingConfigurationId: string) {
return this.api.delete(
`${ProductListingConfiguration.baseUrl}/${catalogId}/productlistings/${productListingId}/configurations/${productListingConfigurationId}`,
);
}

/**
* @deprecated
*/
get(catalogId: string, productListingId: string, productListingConfigurationId: string) {
return this.api.get<ProductListingConfigurationModel>(
`${ProductListingConfiguration.baseUrl}/${catalogId}/productlistings/${productListingId}/configurations/${productListingConfigurationId}`,
);
}

/**
* @deprecated
*/
update(
catalogId: string,
productListingId: string,
Expand Down
12 changes: 12 additions & 0 deletions src/resources/Catalogs/ProductListingConfigurationInterfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@ import {Paginated} from '../BaseInterfaces.js';
import {DeprecatedPaginated} from '../InternalBaseInterface.js';
import {QueryFilterModel} from './ProductListingInterfaces.js';

/**
* @deprecated
*/
export type ProductListingConfigurationOptions = Paginated | DeprecatedPaginated;

/**
* @deprecated
*/
export interface ProductListingConfigurationModel {
/**
* The id of the ProductListingConfiguration.
Expand All @@ -15,6 +21,9 @@ export interface ProductListingConfigurationModel {
rankingConfigurations: RankingConfiguration[];
}

/**
* @deprecated
*/
export interface RankingConfiguration {
/**
* The name of the RankingConfiguration.
Expand All @@ -38,6 +47,9 @@ export interface RankingConfiguration {
value: number;
}

/**
* @deprecated
*/
export enum RankingTypeEnum {
BOOST = 'BOOST',
BURY = 'BURY',
Expand Down
15 changes: 15 additions & 0 deletions src/resources/Catalogs/ProductListingInterfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import {Paginated} from '../BaseInterfaces.js';
import {FieldOperatorType, FieldValueType} from '../Enums.js';
import {DeprecatedPaginated} from '../InternalBaseInterface.js';

/**
* @deprecated
*/
export type ProductListingsListOptions = Paginated | DeprecatedPaginated;

interface FieldValueModelGeneric<T extends FieldValueType> {
Expand Down Expand Up @@ -30,6 +33,9 @@ type FieldValueModel =
| FieldValueModelGeneric<FieldValueType.ARRAY>
| FieldValueModelGeneric<FieldValueType.HIERARCHIC_MULTI_VALUE>;

/**
* @deprecated
*/
export interface QueryFilterModel {
/**
* The field name.
Expand All @@ -45,11 +51,17 @@ export interface QueryFilterModel {
value: FieldValueModel;
}

/**
* @deprecated
*/
export interface ProductListingMetricsModel {
lastNumberOfProducts?: number;
lastQueried: string;
}

/**
* @deprecated
*/
export interface ProductListingModel {
/**
* The list of exclusion filters.
Expand Down Expand Up @@ -77,6 +89,9 @@ export interface ProductListingModel {
metrics?: ProductListingMetricsModel;
}

/**
* @deprecated
*/
export interface CatalogProductListingsGroupModel {
/**
* The unique identifier of the catalog.
Expand Down
3 changes: 3 additions & 0 deletions src/resources/Products/Product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import {ProductsRequestModel, ProductsResultModel} from './ProductInterfaces.js'
export default class Products extends Resource {
static baseUrl = `/rest/organizations/${API.orgPlaceholder}/commerce/v1/products`;

/**
* @deprecated
*/
get(productsRequest: New<ProductsRequestModel>, refreshCache = false) {
return this.api.post<ProductsResultModel>(
this.buildPath(`${Products.baseUrl}/listing`, {refreshCache: refreshCache}),
Expand Down
46 changes: 46 additions & 0 deletions src/resources/Products/ProductInterfaces.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import {ProductsFacetRequestSortType, ProductsSortByType, SortingOrder} from '../Enums.js';

/**
* @deprecated
*/
export interface AdvancedFiltersModel {
queryFilter: string;
}

/**
* @deprecated
*/
export interface AdvancedParametersModel {
/**
* Used to retrieve debug information. Will have an impact on query performance.
Expand All @@ -15,6 +21,9 @@ export interface AdvancedParametersModel {
viewAllContent?: boolean;
}

/**
* @deprecated
*/
export interface FacetRequestOptions {
/**
* Whether to take into account the scores generated by the index when reordering facets.
Expand All @@ -26,6 +35,9 @@ export interface FacetRequestOptions {
freezeFacetOrder?: boolean;
}

/**
* @deprecated
*/
export interface FacetRequestItem {
/**
* The values displayed by the facet in the search interface at the moment of the request.
Expand Down Expand Up @@ -61,6 +73,9 @@ export interface FacetRequestItem {
sortCriteria?: ProductsFacetRequestSortType;
}

/**
* @deprecated
*/
export interface FacetsRequestModel {
/**
* The facet options to add to the request.
Expand All @@ -72,6 +87,9 @@ export interface FacetsRequestModel {
requests: FacetRequestItem[];
}

/**
* @deprecated
*/
export interface PaginatedModel {
/**
* The number of elements to list per page.
Expand All @@ -83,6 +101,9 @@ export interface PaginatedModel {
page?: number;
}

/**
* @deprecated
*/
export interface SortByFields {
/**
* The name of the field.
Expand All @@ -94,6 +115,9 @@ export interface SortByFields {
direction: SortingOrder;
}

/**
* @deprecated
*/
export interface SortModel {
/**
* The name of the field to sort by.
Expand All @@ -105,6 +129,10 @@ export interface SortModel {
fields?: SortByFields[];
}

/**
* @deprecated
*/

export interface ProductsRequestModel {
/**
* Additional fields allow you to collect additional information, besides the standard data.
Expand Down Expand Up @@ -140,6 +168,9 @@ export interface ProductsRequestModel {
url: string;
}

/**
* @deprecated
*/
export interface FacetResultModel {
facetId: string;
field: string;
Expand All @@ -150,20 +181,29 @@ export interface FacetResultModel {
values: any[];
}

/**
* @deprecated
*/
export interface FacetResponseModel {
/**
* A list of facet results.
*/
results: FacetResultModel[];
}

/**
* @deprecated
*/
export interface PaginationResultModel {
/**
* The number of elements.
*/
totalCount: number;
}

/**
* @deprecated
*/
export interface ProductListingIdentityModel {
/**
* Associated catalog id.
Expand All @@ -175,6 +215,9 @@ export interface ProductListingIdentityModel {
id: string;
}

/**
* @deprecated
*/
export interface ProductModel {
additionalFields: Map<string, any>;
childResults: ProductModel[];
Expand All @@ -196,6 +239,9 @@ export interface ProductModel {
totalNumberOfChildResults: number;
}

/**
* @deprecated
*/
export interface ProductsResultModel {
/**
* The execution report.
Expand Down

0 comments on commit b3dc1bc

Please sign in to comment.