Skip to content

Commit

Permalink
feat(core): Use query param to specify language
Browse files Browse the repository at this point in the history
Relates to #128

BREAKING CHANGE: All `languageCode` GraphQL arguments have been removed from queries and instead, a "languageCode" query param may be attached to the API URL to specify the language of any translatable entities.
  • Loading branch information
michaelbromley committed Jul 18, 2019
1 parent ac6e14e commit 2035003
Show file tree
Hide file tree
Showing 18 changed files with 430 additions and 236 deletions.
60 changes: 26 additions & 34 deletions packages/common/src/generated-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ export type Channel = Node & {

export type Collection = Node & {
__typename?: 'Collection',
isPrivate: Scalars['Boolean'],
id: Scalars['ID'],
createdAt: Scalars['DateTime'],
updatedAt: Scalars['DateTime'],
Expand All @@ -220,7 +221,6 @@ export type Collection = Node & {
filters: Array<ConfigurableOperation>,
translations: Array<CollectionTranslation>,
productVariants: ProductVariantList,
isPrivate: Scalars['Boolean'],
customFields?: Maybe<Scalars['JSON']>,
};

Expand All @@ -236,13 +236,13 @@ export type CollectionBreadcrumb = {
};

export type CollectionFilterParameter = {
isPrivate?: Maybe<BooleanOperators>,
createdAt?: Maybe<DateOperators>,
updatedAt?: Maybe<DateOperators>,
languageCode?: Maybe<StringOperators>,
name?: Maybe<StringOperators>,
position?: Maybe<NumberOperators>,
description?: Maybe<StringOperators>,
isPrivate?: Maybe<BooleanOperators>,
};

export type CollectionList = PaginatedList & {
Expand Down Expand Up @@ -1008,6 +1008,7 @@ export enum DeletionResult {

export type Facet = Node & {
__typename?: 'Facet',
isPrivate: Scalars['Boolean'],
id: Scalars['ID'],
createdAt: Scalars['DateTime'],
updatedAt: Scalars['DateTime'],
Expand All @@ -1016,17 +1017,16 @@ export type Facet = Node & {
code: Scalars['String'],
values: Array<FacetValue>,
translations: Array<FacetTranslation>,
isPrivate: Scalars['Boolean'],
customFields?: Maybe<Scalars['JSON']>,
};

export type FacetFilterParameter = {
isPrivate?: Maybe<BooleanOperators>,
createdAt?: Maybe<DateOperators>,
updatedAt?: Maybe<DateOperators>,
languageCode?: Maybe<StringOperators>,
name?: Maybe<StringOperators>,
code?: Maybe<StringOperators>,
isPrivate?: Maybe<BooleanOperators>,
};

export type FacetList = PaginatedList & {
Expand Down Expand Up @@ -1699,7 +1699,6 @@ export type Mutation = {
addNoteToOrder: Order,
/** Update an existing PaymentMethod */
updatePaymentMethod: PaymentMethod,
reindex: JobInfo,
/** Create a new ProductOptionGroup */
createProductOptionGroup: ProductOptionGroup,
/** Update an existing ProductOptionGroup */
Expand All @@ -1708,6 +1707,7 @@ export type Mutation = {
createProductOption: ProductOption,
/** Create a new ProductOption within a ProductOptionGroup */
updateProductOption: ProductOption,
reindex: JobInfo,
/** Create a new Product */
createProduct: Product,
/** Update an existing Product */
Expand Down Expand Up @@ -2343,6 +2343,7 @@ export type PriceRange = {

export type Product = Node & {
__typename?: 'Product',
enabled: Scalars['Boolean'],
id: Scalars['ID'],
createdAt: Scalars['DateTime'],
updatedAt: Scalars['DateTime'],
Expand All @@ -2357,18 +2358,17 @@ export type Product = Node & {
facetValues: Array<FacetValue>,
translations: Array<ProductTranslation>,
collections: Array<Collection>,
enabled: Scalars['Boolean'],
customFields?: Maybe<Scalars['JSON']>,
};

export type ProductFilterParameter = {
enabled?: Maybe<BooleanOperators>,
createdAt?: Maybe<DateOperators>,
updatedAt?: Maybe<DateOperators>,
languageCode?: Maybe<StringOperators>,
name?: Maybe<StringOperators>,
slug?: Maybe<StringOperators>,
description?: Maybe<StringOperators>,
enabled?: Maybe<BooleanOperators>,
};

export type ProductList = PaginatedList & {
Expand Down Expand Up @@ -2473,6 +2473,10 @@ export type ProductTranslationInput = {

export type ProductVariant = Node & {
__typename?: 'ProductVariant',
enabled: Scalars['Boolean'],
stockOnHand: Scalars['Int'],
trackInventory: Scalars['Boolean'],
stockMovements: StockMovementList,
id: Scalars['ID'],
productId: Scalars['ID'],
createdAt: Scalars['DateTime'],
Expand All @@ -2491,10 +2495,6 @@ export type ProductVariant = Node & {
options: Array<ProductOption>,
facetValues: Array<FacetValue>,
translations: Array<ProductVariantTranslation>,
enabled: Scalars['Boolean'],
stockOnHand: Scalars['Int'],
trackInventory: Scalars['Boolean'],
stockMovements: StockMovementList,
customFields?: Maybe<Scalars['JSON']>,
};

Expand All @@ -2504,6 +2504,9 @@ export type ProductVariantStockMovementsArgs = {
};

export type ProductVariantFilterParameter = {
enabled?: Maybe<BooleanOperators>,
stockOnHand?: Maybe<NumberOperators>,
trackInventory?: Maybe<BooleanOperators>,
createdAt?: Maybe<DateOperators>,
updatedAt?: Maybe<DateOperators>,
languageCode?: Maybe<StringOperators>,
Expand All @@ -2513,9 +2516,6 @@ export type ProductVariantFilterParameter = {
currencyCode?: Maybe<StringOperators>,
priceIncludesTax?: Maybe<BooleanOperators>,
priceWithTax?: Maybe<NumberOperators>,
enabled?: Maybe<BooleanOperators>,
stockOnHand?: Maybe<NumberOperators>,
trackInventory?: Maybe<BooleanOperators>,
};

export type ProductVariantList = PaginatedList & {
Expand All @@ -2532,6 +2532,7 @@ export type ProductVariantListOptions = {
};

export type ProductVariantSortParameter = {
stockOnHand?: Maybe<SortOrder>,
id?: Maybe<SortOrder>,
productId?: Maybe<SortOrder>,
createdAt?: Maybe<SortOrder>,
Expand All @@ -2540,7 +2541,6 @@ export type ProductVariantSortParameter = {
name?: Maybe<SortOrder>,
price?: Maybe<SortOrder>,
priceWithTax?: Maybe<SortOrder>,
stockOnHand?: Maybe<SortOrder>,
};

export type ProductVariantTranslation = {
Expand Down Expand Up @@ -2625,9 +2625,9 @@ export type Query = {
orders: OrderList,
paymentMethods: PaymentMethodList,
paymentMethod?: Maybe<PaymentMethod>,
search: SearchResponse,
productOptionGroups: Array<ProductOptionGroup>,
productOptionGroup?: Maybe<ProductOptionGroup>,
search: SearchResponse,
products: ProductList,
/** Get a Product either by id or slug. If neither id nor slug is speicified, an error will result. */
product?: Maybe<Product>,
Expand Down Expand Up @@ -2675,14 +2675,12 @@ export type QueryChannelArgs = {


export type QueryCollectionsArgs = {
languageCode?: Maybe<LanguageCode>,
options?: Maybe<CollectionListOptions>
};


export type QueryCollectionArgs = {
id: Scalars['ID'],
languageCode?: Maybe<LanguageCode>
id: Scalars['ID']
};


Expand Down Expand Up @@ -2712,14 +2710,12 @@ export type QueryCustomerArgs = {


export type QueryFacetsArgs = {
languageCode?: Maybe<LanguageCode>,
options?: Maybe<FacetListOptions>
};


export type QueryFacetArgs = {
id: Scalars['ID'],
languageCode?: Maybe<LanguageCode>
id: Scalars['ID']
};


Expand Down Expand Up @@ -2753,33 +2749,29 @@ export type QueryPaymentMethodArgs = {
};


export type QuerySearchArgs = {
input: SearchInput
};


export type QueryProductOptionGroupsArgs = {
languageCode?: Maybe<LanguageCode>,
filterTerm?: Maybe<Scalars['String']>
};


export type QueryProductOptionGroupArgs = {
id: Scalars['ID'],
languageCode?: Maybe<LanguageCode>
id: Scalars['ID']
};


export type QuerySearchArgs = {
input: SearchInput
};


export type QueryProductsArgs = {
languageCode?: Maybe<LanguageCode>,
options?: Maybe<ProductListOptions>
};


export type QueryProductArgs = {
id?: Maybe<Scalars['ID']>,
slug?: Maybe<Scalars['String']>,
languageCode?: Maybe<LanguageCode>
slug?: Maybe<Scalars['String']>
};


Expand Down Expand Up @@ -2945,6 +2937,7 @@ export type SearchResponse = {

export type SearchResult = {
__typename?: 'SearchResult',
enabled: Scalars['Boolean'],
sku: Scalars['String'],
slug: Scalars['String'],
productId: Scalars['ID'],
Expand All @@ -2963,7 +2956,6 @@ export type SearchResult = {
collectionIds: Array<Scalars['String']>,
/** A relevence score for the result. Differs between database implementations */
score: Scalars['Float'],
enabled: Scalars['Boolean'],
};

/** The price of a search result product, either as a range or as a single price */
Expand Down
Loading

0 comments on commit 2035003

Please sign in to comment.