-
Notifications
You must be signed in to change notification settings - Fork 391
upcoming: [M3-9225] - Add API queries for MarketplaceV2 #13255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
140aac1
1bbbcf1
56d813e
5e38907
83185f4
68a6772
ffaed0c
c147bab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@linode/queries": Upcoming Features | ||
| --- | ||
|
|
||
| Add API queries for MarketplaceV2 ([#13255](https://github.com/linode/manager/pull/13255)) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| export * from './keys'; | ||
| export * from './marketplace'; | ||
| export * from './requests'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| import { | ||
| getMarketplaceCategories, | ||
| getMarketplacePartners, | ||
| getMarketplaceProduct, | ||
| getMarketplaceProducts, | ||
| getMarketplaceTypes, | ||
| } from '@linode/api-v4'; | ||
| import { createQueryKeys } from '@lukemorales/query-key-factory'; | ||
|
|
||
| import { | ||
| getAllMarketplaceCategories, | ||
| getAllMarketplacePartners, | ||
| getAllMarketplaceProducts, | ||
| getAllMarketplaceTypes, | ||
| } from './requests'; | ||
|
|
||
| import type { Filter, Params } from '@linode/api-v4'; | ||
|
|
||
| export const marketplaceQueries = createQueryKeys('marketplace', { | ||
| product: (productId: number) => ({ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. now the api has changed from /marketplace/products/{id} to /marketplace/products/{id}/details |
||
| queryFn: () => getMarketplaceProduct(productId), | ||
| queryKey: [productId], | ||
| }), | ||
| products: { | ||
| contextQueries: { | ||
| all: (params: Params = {}, filter: Filter = {}) => ({ | ||
| queryFn: () => getAllMarketplaceProducts(params, filter), | ||
| queryKey: [params, filter], | ||
| }), | ||
| infinite: (filter: Filter = {}) => ({ | ||
| queryFn: ({ pageParam }) => | ||
| getMarketplaceProducts( | ||
| { page: pageParam as number, page_size: 25 }, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should page size be 25 for products api also?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minimum size for a page is 25 |
||
| filter, | ||
| ), | ||
| queryKey: [filter], | ||
| }), | ||
| paginated: (params: Params = {}, filter: Filter = {}) => ({ | ||
| queryFn: () => getMarketplaceProducts(params, filter), | ||
| queryKey: [params, filter], | ||
| }), | ||
| }, | ||
| queryKey: null, | ||
| }, | ||
| categories: { | ||
| contextQueries: { | ||
| all: (params: Params = {}, filter: Filter = {}) => ({ | ||
| queryFn: () => getAllMarketplaceCategories(params, filter), | ||
| queryKey: [params, filter], | ||
| }), | ||
| infinite: (filter: Filter = {}) => ({ | ||
| queryFn: ({ pageParam }) => | ||
| getMarketplaceCategories( | ||
| { page: pageParam as number, page_size: 25 }, | ||
| filter, | ||
| ), | ||
| queryKey: [filter], | ||
| }), | ||
| paginated: (params: Params = {}, filter: Filter = {}) => ({ | ||
| queryFn: () => getMarketplaceCategories(params, filter), | ||
| queryKey: [params, filter], | ||
| }), | ||
| }, | ||
| queryKey: null, | ||
| }, | ||
| types: { | ||
| contextQueries: { | ||
| all: (params: Params = {}, filter: Filter = {}) => ({ | ||
| queryFn: () => getAllMarketplaceTypes(params, filter), | ||
| queryKey: [params, filter], | ||
| }), | ||
| infinite: (filter: Filter = {}) => ({ | ||
| queryFn: ({ pageParam }) => | ||
| getMarketplaceTypes( | ||
| { page: pageParam as number, page_size: 25 }, | ||
| filter, | ||
| ), | ||
| queryKey: [filter], | ||
| }), | ||
| paginated: (params: Params = {}, filter: Filter = {}) => ({ | ||
| queryFn: () => getMarketplaceTypes(params, filter), | ||
| queryKey: [params, filter], | ||
| }), | ||
| }, | ||
| queryKey: null, | ||
| }, | ||
| partners: { | ||
| contextQueries: { | ||
| all: (params: Params = {}, filter: Filter = {}) => ({ | ||
| queryFn: () => getAllMarketplacePartners(params, filter), | ||
| queryKey: [params, filter], | ||
| }), | ||
| infinite: (filter: Filter = {}) => ({ | ||
| queryFn: ({ pageParam }) => | ||
| getMarketplacePartners( | ||
| { page: pageParam as number, page_size: 25 }, | ||
| filter, | ||
| ), | ||
| queryKey: [filter], | ||
| }), | ||
| paginated: (params: Params = {}, filter: Filter = {}) => ({ | ||
| queryFn: () => getMarketplacePartners(params, filter), | ||
| queryKey: [params, filter], | ||
| }), | ||
| }, | ||
| queryKey: null, | ||
| }, | ||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a blocker, but I don't see
detailsmarked as optional anywhere. Still it's worth checkingThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Details is the part of the
/products/{id}/detailsAPI only. Every other field is returned from both/productsand/products/{id}/details