voucherifyio / voucherify-java-sdk

Java SDK for Voucherify - coupons, vouchers, promo codes
www.voucherify.io
MIT License
23 stars 12 forks source link

Filter vouches list #70

Closed imvanzen closed 6 years ago

imvanzen commented 6 years ago

Support for filtering in the vouchers method has been added.

Example of use:

VouchersFilter.VouchersFilterBuilder vouchersFilterBuilder = VouchersFilter.builder();

List<VouchersFilter.Filter> filters = new ArrayList<VouchersFilter.Filter>();        filters.add(VouchersFilter.Filter.builder().fieldName("active").condition("$disabled").value(true).build());
filters.add(VouchersFilter.Filter.builder().fieldName("metadata.seq_number").condition("$is").value(1).build());
filters.add(VouchersFilter.Filter.builder().fieldName("metadata.order-number").condition("$is").value("order-123").build());
filters.add(VouchersFilter.Filter.builder().fieldName("metadata.type").condition("$is_unknown").value(true).build());

VouchersFilter vouchersFilter = vouchersFilterBuilder
        .limit(10)
        .page(1)
        .filters(filters)
        .build();

Test included

tpindel commented 6 years ago

@lkulig Let's release. Looks good to me 👍