Skip to content

Commit

Permalink
Merge pull request #57 from Relewise/feat--allow-null-in-selected-pro…
Browse files Browse the repository at this point in the history
…perties

feat: allow null to be parsed in the selected properties functions
  • Loading branch information
mzanoni authored Apr 30, 2024
2 parents 103cc79 + a2af16a commit 3fb3028
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ export class BrandSettingsRecommendationBuilder extends RecommendationRequestBui
super(settings);
}

public setSelectedBrandProperties(brandProperties: Partial<SelectedBrandPropertiesSettings>): this {
this.recommendationSettings.selectedBrandProperties = brandProperties as SelectedBrandPropertiesSettings;
/**
* Select the properties of the brand to be returned, by default only the brand id is returned.
* @param brandProperties
*/
public setSelectedBrandProperties(brandProperties: Partial<SelectedBrandPropertiesSettings> | null): this {
this.recommendationSettings.selectedBrandProperties = brandProperties as SelectedBrandPropertiesSettings | null;

return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@ export class ContentCategorySettingsRecommendationBuilder extends Recommendation
super(settings);
}

public setSelectedContentCategoryProperties(ContentCategoryProperties: Partial<SelectedContentCategoryPropertiesSettings>): this {
this.recommendationSettings.selectedContentCategoryProperties = ContentCategoryProperties as SelectedContentCategoryPropertiesSettings;
/**
* Select the properties of the content category to be returned, by default only the content category id is returned.
* @param contentCategoryProperties
*/
public setSelectedContentCategoryProperties(contentCategoryProperties: Partial<SelectedContentCategoryPropertiesSettings> | null): this {
this.recommendationSettings.selectedContentCategoryProperties = contentCategoryProperties as SelectedContentCategoryPropertiesSettings | null;

return this;
}

public setNumberOfRecommendations(count: number): this {
this.recommendationSettings.numberOfRecommendations = count;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ export class ContentSettingsRecommendationBuilder extends RecommendationRequestB
super(settings);
}

public setSelectedContentProperties(contentProperties: Partial<SelectedContentPropertiesSettings>): this {
this.recommendationSettings.selectedContentProperties = contentProperties as SelectedContentPropertiesSettings;
/**
* Select the properties of the content to be returned, by default only the content id is returned.
* @param contentProperties
*/
public setSelectedContentProperties(contentProperties: Partial<SelectedContentPropertiesSettings> | null): this {
this.recommendationSettings.selectedContentProperties = contentProperties as SelectedContentPropertiesSettings | null;

return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,32 @@ export class ProductSettingsRecommendationBuilder extends RecommendationRequestB
super(settings);
}

public setSelectedProductProperties(productProperties: Partial<SelectedProductPropertiesSettings>): this {
this.recommendationSettings.selectedProductProperties = productProperties as SelectedProductPropertiesSettings;
/**
* Select the properties of the product to be returned, by default only the product id is returned.
* @param productProperties
*/
public setSelectedProductProperties(productProperties: Partial<SelectedProductPropertiesSettings> | null): this {
this.recommendationSettings.selectedProductProperties = productProperties as SelectedProductPropertiesSettings | null;

return this;
}

public setSelectedVariantProperties(variantProperties: Partial<SelectedVariantPropertiesSettings>): this {
this.recommendationSettings.selectedVariantProperties = variantProperties as SelectedVariantPropertiesSettings;
/**
* Select the properties of the variant to be returned, by default only the variant id is returned.
* @param variantProperties
*/
public setSelectedVariantProperties(variantProperties: Partial<SelectedVariantPropertiesSettings> | null): this {
this.recommendationSettings.selectedVariantProperties = variantProperties as SelectedVariantPropertiesSettings | null;

return this;
}

public setSelectedBrandProperties(brandProperties: Partial<SelectedBrandPropertiesSettings>): this {
this.recommendationSettings.selectedBrandProperties = brandProperties as SelectedBrandPropertiesSettings;
/**
* Select the properties of the brand to be returned, by default only the brand id is returned.
* @param brandProperties
*/
public setSelectedBrandProperties(brandProperties: Partial<SelectedBrandPropertiesSettings> | null): this {
this.recommendationSettings.selectedBrandProperties = brandProperties as SelectedBrandPropertiesSettings | null;

return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@ export class ProductCategorySearchBuilder extends SearchRequestBuilder implement
super(settings)
}

public setSelectedCategoryProperties(productCategoryProperties: Partial<SelectedProductCategoryPropertiesSettings>): this {
this.searchSettings.selectedCategoryProperties = productCategoryProperties as SelectedProductCategoryPropertiesSettings;
/**
* Select the properties of the product category to be returned, by default only the product category id is returned.
* @param productCategoryProperties
*/
public setSelectedCategoryProperties(productCategoryProperties: Partial<SelectedProductCategoryPropertiesSettings> | null): this {
this.searchSettings.selectedCategoryProperties = productCategoryProperties as SelectedProductCategoryPropertiesSettings | null;

return this;
}
Expand Down
24 changes: 18 additions & 6 deletions packages/client/src/builders/search/productSearchBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,32 @@ export class ProductSearchBuilder extends SearchRequestBuilder implements Search
super(settings)
}

public setSelectedProductProperties(productProperties: Partial<SelectedProductPropertiesSettings>): this {
this.searchSettings.selectedProductProperties = productProperties as SelectedProductPropertiesSettings;
/**
* Select the properties of the product to be returned, by default only the product id is returned.
* @param productProperties
*/
public setSelectedProductProperties(productProperties: Partial<SelectedProductPropertiesSettings> | null): this {
this.searchSettings.selectedProductProperties = productProperties as SelectedProductPropertiesSettings | null;

return this;
}

public setSelectedVariantProperties(variantProperties: Partial<SelectedVariantPropertiesSettings>): this {
this.searchSettings.selectedVariantProperties = variantProperties as SelectedVariantPropertiesSettings;
/**
* Select the properties of the variant to be returned, by default only the variant id is returned.
* @param variantProperties
*/
public setSelectedVariantProperties(variantProperties: Partial<SelectedVariantPropertiesSettings> | null): this {
this.searchSettings.selectedVariantProperties = variantProperties as SelectedVariantPropertiesSettings | null;

return this;
}

public setSelectedBrandProperties(brandProperties: Partial<SelectedBrandPropertiesSettings>): this {
this.searchSettings.selectedBrandProperties = brandProperties as SelectedBrandPropertiesSettings;
/**
* Select the properties of the brand to be returned, by default only the brand id is returned.
* @param brandProperties
*/
public setSelectedBrandProperties(brandProperties: Partial<SelectedBrandPropertiesSettings> | null): this {
this.searchSettings.selectedBrandProperties = brandProperties as SelectedBrandPropertiesSettings | null;

return this;
}
Expand Down

0 comments on commit 3fb3028

Please sign in to comment.