nozzlegear / ShopifySharp

ShopifySharp is a .NET library that helps developers easily authenticate with and manage Shopify stores.
https://nozzlegear.com/shopify-development-handbook
MIT License
742 stars 309 forks source link

Listing products in English #962

Closed jakenuts closed 9 months ago

jakenuts commented 9 months ago

I tried adding /en to my shopify url but it gets stripped out in BuildShopUri. Is there any way to pass the language path to ShopifySharp such that calls like ListAsync use the /en path in the request?

nozzlegear commented 9 months ago

Hey! That behavior is expected based on how I wrote the base ShopifyService class. I might be wrong, but I don't think the REST API can be localized using those language paths like the storefront API can. Happy to be wrong about that though, I'll give it a test and see what happens.

jakenuts commented 9 months ago

Oh, that would make sense. Thanks!

jakenuts commented 9 months ago

Sorry to bother you again, but I was wondering how you generated the graphql entities? When I learned that I would need to switch apis to get translations I went looking for a graphql schema for products/variants/related to feed into various tools and all my attempts at introspection produce massive files with some special (non-standard?) bits that break each tool in their own way (ZeroQL, Apollo, etc).

Thanks!

nozzlegear commented 9 months ago

Ah actually all of the generated schemas are handled by Clement. @clement911 would you mind giving a brief overview on how you generate those schemas? I think you explained it somewhere here in the repo but I haven't been able to find it back, and I've been meaning to ask you just for my own curiousity.

clement911 commented 9 months ago

The generation of graphql entities can be triggered from https://github.com/nozzlegear/ShopifySharp/blob/a0f5051dedebd2fe1b3fd0d6cc7d06305d7b488a/ShopifySharp.Tests/GenerateGraphQLSchema_Test.cs#L18

The generation is handled by another package I wrote, https://github.com/Wish-Org/Wish.GraphQLSchemaGenerator

It's a small and simple library (less than 500 lines of code). Basically it fires an introspection graphql query and then generate c# code based on the results. It should work with any GraphQL API, although I've only tested with Shopify and Square.

nozzlegear commented 9 months ago

Ah that’s awesome, thanks! I could definitely use that in other projects. I’ll set up a Github Action so you and I can trigger the regeneration from the actions page, so you don’t have to run the test manually to get the changes.

-- Joshua Harms

On Dec 5, 2023, at 13:53, Clement Gutel @.***> wrote:

The generation of graphql entities can be triggered from https://github.com/nozzlegear/ShopifySharp/blob/a0f5051dedebd2fe1b3fd0d6cc7d06305d7b488a/ShopifySharp.Tests/GenerateGraphQLSchema_Test.cs#L18 The generation is handled by another package I wrote, https://github.com/Wish-Org/Wish.GraphQLSchemaGenerator It's a small and simple library (less than 500 lines of code). Basically it fires an introspection graphql query and then generate c# code based on the results. It should work with any GraphQL API, although I've only tested with Shopify and Square. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

clement911 commented 9 months ago

Oh ok, I'm not too sure how you will set this action but honestly using the unit test to trigger the regeneration has been working quite well. All you need to do is remove the Skip attribute and run it. Then add the Skip attribute again so that it doesn't run on each CI build.

nozzlegear commented 9 months ago

I think I can do it if I mess around with the test category, like we use to exclude/include dotnet framework tests. I'll give it a shot tonight and create a pull request for it.

@jakenuts Let us know if you have any questions about the schema generation!

jakenuts commented 9 months ago

That absolutely does, thank you @clement911 & @nozzlegear 😊