ShopifySharp icon indicating copy to clipboard operation
ShopifySharp copied to clipboard

code errors in wiki sample code

Open foxandrewj opened this issue 8 months ago • 4 comments

Walking through GraphQL wiki for the first time (Thank you for all your work!) and find some minor errors I had to fix after grabbing the code.

  1. This iterates through "nodes" (which matches the GraphQL query)
// Iterate over each product node
foreach (var node in graphResult.Data.Products.Nodes)

But ProductInfo defines it as QueriedProduct

public record ProductsInfo
{
    public required ProductsPageInfo PageInfo { get; set; }
    public required IReadOnlyList<QueriedProduct> QueriedProduct { get; set; }
}

Changed QueriedProduct to Nodes

var request = new GraphRequest
{
    // Same as above
};
var graphResult = await graphService.PostAsync<ListProductsResult>(graphRequest);

defining "request" in line 1. passing graphRequest in line 2

foxandrewj avatar Feb 28 '25 19:02 foxandrewj