ShopifySharp icon indicating copy to clipboard operation
ShopifySharp copied to clipboard

Support DiscountCodes lookup

Open KoanLeeroy opened this issue 4 years ago • 2 comments

Shopify supports a lookup of a discount code from the code: https://shopify.dev/docs/admin-api/rest/reference/discounts/discountcode#lookup-2020-10

Would be good to support this in this SDK.

KoanLeeroy avatar Dec 21 '20 11:12 KoanLeeroy

We did this ourselves, but would be great to get it baked in:

    public async Task<PriceRuleDiscountCode> LookupAsync(
        string discountCode,
        CancellationToken cancellationToken = default)
    {
        var uri = PrepareRequest("discount_codes/lookup.json");
        uri.QueryParams.Add("code", discountCode);

        var response = await ExecuteRequestAsync<PriceRuleDiscountCode>(uri, HttpMethod.Get, cancellationToken);
        return response.Result;
    }

KoanLeeroy avatar Dec 21 '20 12:12 KoanLeeroy

Thanks for the link! I didn't know they had added this feature, I'd be happy to add it to the package.

nozzlegear avatar Dec 29 '20 20:12 nozzlegear