ShopifySharp
                                
                                 ShopifySharp copied to clipboard
                                
                                    ShopifySharp copied to clipboard
                            
                            
                            
                        What is the reason for removing properties from MetaFieldFilter, OrderListFilter?
https://github.com/nozzlegear/ShopifySharp/blob/e1a09d1544de3188ddd00caeb8ae15a636aaae64/ShopifySharp/Filters/MetaFieldFilter.cs#L10
we are using ListAsync end point with SinceId, since the property no longer exists any recommendation how to handle the existing logic depend on that property?
IEnumerable<MetaField> tempMetafields = await metaFieldService.ListAsync(new ShopifySharp.Filters.MetaFieldFilter() { SinceId = last_id, Limit = 250 });
OrderListFilter class does not have "Order" property any more, would you please let us know if there is another way to handle sorting?
Hey, in most cases where a property was present in v4 but is gone in v5, it's because Shopify no longer documents them for that specific endpoint. That means they're not officially supported, and if they work right now they may stop working at some point in the future. If you're sure these properties still work, you can easily extend the filter classes to add the property back in:
public class MetaFieldWithSinceIdFilter : MetaFieldFilter
{
    public long? SinceId { get; set; }
}
var result = await service.ListAsync(new MetaFieldWithSinceIdFilter
{
    SinceId = 123456
});
That said, if you notice that the docs do still document these properties, then they were removed on accident and should be added back in! Please let me know if you spot in where that's the case.
Thank you for the feedback, will get back soon.
I checked the shopify API document but didn't fine any future notice about the since_id property for depreciation or discontinuation, https://shopify.dev/docs/admin-api/rest/reference/metafield#since_id
@nozzlegear I am new to this library, so help me to understand your standard process. Did you meant by above comment to add new filter class to shopifysharp filters and use it through the library?
Good catch on the since_id property, you're right it's still documented and should not have been removed. A couple filter classes accidentally had valid properties removed, so it's good to point them out like you did! I'll publish an update within the next couple days to add that property back.
I am new to this library, so help me to understand your standard process. Did you meant by above comment to add new filter class to shopifysharp filters and use it through the library?
Yes, in cases where you want to add an extra property to the filter classes that the library does not officially support, you can create your own class that extends the base filter class. So this SinceId property, for example, you'd create a new class in your own project named MetaFieldWithSinceIdListFilter (or whatever you want to name it) that extends MetaFieldListFilter. You add whatever properties you want to your new class, and you use the new class when listing metafields with ShopifySharp's MetaFieldService:
public class MetaFieldWithSinceIdListFilter : ShopifySHarp.MetaFieldListFilter
{
    public long? since_id { get; set; }
}
Then when you want to list metafields, you'd use that class with ShopifySharp's MetaFieldServce.ListAsync method:
public async Task SomeMethodThatListsMetaFields()
{
    var service = new MetaFieldService(domain, accessToken);
    var filter = new MetaFieldWithSinceIdListFilter
    {
        SinceId = 123456
    };
    
    var listResult = await service.ListAsync(filter);
}
Two important things to note when you're extending a ShopifySharp class:
- The property names must match the names used by Shopify. So while we'd usually write SinceId, you actually need to usesince_idas that's what Shopify is looking for. The library itself is doing some fancy stuff in the background for its built-in classes to transform property names, but it won't do this for your custom classes.
- The properties should be nullable. If you used public long since_id, ShopifySharp would set that value to0by default if you don't explicitly set the property value.
@nozzlegear really appreciate your detail explanation and support. what is the procedure doing support fixes modifications to the library?
You can just submit a PR with the fix.