Skip to content

Conversation

@harsh-akamai
Copy link
Contributor

Changes 🔄

Added queries for the following marketplace endpoints

  • GET /marketplace/products
  • GET /marketplace/products/{productId}
  • GET /marketplace/categories
  • GET /marketplace/types
  • POST /marketplace/referral

Scope 🚢

Upon production release, changes in this PR will be visible to:

  • All customers
  • Some customers (e.g. in Beta or Limited Availability)
  • No customers / Not applicable

How to test 🧪

Verification steps

  • Verify the queries call the right apis and keys.
Author Checklists

As an Author, to speed up the review process, I considered 🤔

👀 Doing a self review
❔ Our contribution guidelines
🤏 Splitting feature into small PRs
➕ Adding a changeset
🧪 Providing/improving test coverage
🔐 Removing all sensitive information from the code and PR description
🚩 Using a feature flag to protect the release
👣 Providing comprehensive reproduction steps
📑 Providing or updating our documentation
🕛 Scheduling a pair reviewing session
📱 Providing mobile support
♿ Providing accessibility support


  • I have read and considered all applicable items listed above.

As an Author, before moving this PR from Draft to Open, I confirmed ✅

  • All tests and CI checks are passing
  • TypeScript compilation succeeded without errors
  • Code passes all linting rules

@harsh-akamai harsh-akamai self-assigned this Jan 8, 2026
@harsh-akamai harsh-akamai marked this pull request as ready for review January 8, 2026 04:06
@harsh-akamai harsh-akamai requested a review from a team as a code owner January 8, 2026 04:06
Copy link
Contributor

@pmakode-akamai pmakode-akamai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unrelated to this PR, but it might be worth fixing here: I noticed the factory mocks & Types don't fully match the API doc

import type { Filter, Params } from '@linode/api-v4';

export const marketplaceQueries = createQueryKeys('marketplace', {
product: (productId: number) => ({
Copy link
Contributor

Choose a reason for hiding this comment

The 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

@tvijay-akamai
Copy link
Contributor

This is unrelated to this PR, but it might be worth fixing here: I noticed the factory mocks & Types don't fully match the API doc

Let's verify all the fields for all the apis as per this doc: https://docs.google.com/document/d/1Iw5nUpUwtofBz5pSnr7j5jXPMBlncFVdyfzLYfnN0NI/edit?tab=t.0

queryKey: [filter],
}),
paginated: (params: Params = {}, filter: Filter = {}) => ({
queryFn: () => getMarketplaceTypes(params, filter),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be getMarketplacePartners, instead of getMarketplaceTypes

infinite: (filter: Filter = {}) => ({
queryFn: ({ pageParam }) =>
getMarketplaceProducts(
{ page: pageParam as number, page_size: 25 },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should page size be 25 for products api also?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minimum size for a page is 25

filter: Filter,
enabled: boolean = false,
) => {
useQuery<ResourcePage<MarketplaceCategory>, APIError[]>({
Copy link
Contributor

@tvijay-akamai tvijay-akamai Jan 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This need to have a return statement before useQuery right if it's inside curly brace or remove the curly braces and use implicit return.

filter: Filter,
enabled: boolean = false,
) => {
useQuery<ResourcePage<MarketplacePartner>, APIError[]>({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to have a return statement before useQuery

filter: Filter,
enabled: boolean = false,
) => {
useQuery<ResourcePage<MarketplaceProduct>, APIError[]>({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to have a return statement before useQuery

MarketplaceCategory,
MarketplacePartner,
MarketplacePartnerReferralPayload,
MarketplaceProduct,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's separate types from value imports and use import type { way instead for importing the types

placeholderData: keepPreviousData,
});
};

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no types defined in here like (like useMarketplaceTypesQuery, useAllMarketplaceTypesQuery, etc.). In keys we have queries defined for types api though. Hook should be added here for types.

export const useMarketplaceProductsQuery = (
params: Params,
filter: Filter,
enabled: boolean = false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we defaulting enabled to false? it means queries won't run unless explicitly enabled.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I'd prefer to keep it this way until we have the feature flag. I'm open to changing the value if needed

@linode-gh-bot
Copy link
Collaborator

Cloud Manager UI test results

🎉 860 passing tests on test run #3 ↗︎

❌ Failing✅ Passing↪️ Skipped🕐 Duration
0 Failing860 Passing11 Skipped43m 2s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Review

Development

Successfully merging this pull request may close these issues.

4 participants