Skip to content
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

type issue in products.list productQuery type #95

Open
vettloffah opened this issue Mar 28, 2023 · 3 comments
Open

type issue in products.list productQuery type #95

vettloffah opened this issue Mar 28, 2023 · 3 comments

Comments

@vettloffah
Copy link

This is shown as a type error, however it is a valid API call:

// returns matching product results
const productResponse = await swell.products.list({
	id: { $in: productIds } // productIds is an array of IDs
})

image

And trying to do this same thing with the "where" flag actually doesn't properly return any products.

// this doesn't work even though it seems like it should (returns no results)
const productResponse = await swell.products.list({
	where: { id: { $in: productIds } }
})
@awwit
Copy link
Contributor

awwit commented Apr 3, 2023

@vettloffah I see that you are facing a type mismatch. We have not yet fully developed the type system, as you have already noticed.

Try wrapping your query condition in where:

const productResponse = await swell.products.list({
  where: {
    id: { $in: productIds } // productIds is an array of IDs
  }
})

@vettloffah
Copy link
Author

vettloffah commented Apr 24, 2023

Hi @awwit as I said in the original post here, the "where" flag returns no results, even though it should. That is why I created this issue.

@awwit
Copy link
Contributor

awwit commented Jul 11, 2023

Hi @vettloffah I checked that the where statement works fine for products.list. But only active products are returned, you may be trying to request inactive ones.

It looks like there is no way to query inactive products via products.list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants