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

Support Storefront-Access-Token for GraphQL #954

Open KSemenenko opened 10 months ago

KSemenenko commented 10 months ago

Hello,

I have to use 'X-Shopify-Storefront-Access-Token' for GraphQL to perform some reqest but there is no support for it, is there any plans?

I can help with it

nozzlegear commented 10 months ago

Hey @KSemenenko! I actually do plan to add that very soon as I need it myself. I'll probably add an overload to the GraphService that will accept some kind of object where you can set a storefront access token.

clement911 commented 10 months ago

I think it would be best to implement it as a new StorefrontGraphService rather than expanding the existing GraphService, which is for the Admin GraphQL API.

You will also have to add a new APIType member and augment the LeakyBucketExecutionPolicy. It looks like there Storefront GraphQL API has no rate limits. It should be pretty easy to bypass any rate limits.

I had done something similar to implement the PartnerService for the Partner GraphQL api. Although, I would strongly suggest that you model it after the GraphService instead of the PartnerService. That is because the GraphService has a new SendAsync method, which can be used to query graphQL with strongly typed results.

While I don't plan on using the Storefront API myself, if you like I can generate the strongly typed GraphQL classes for easier querying.

KSemenenko commented 9 months ago

I play around GraphQL service and this didn’t work properly