#elBR

1 messages · Page 1 of 1 (latest)

latent hillBOT
jagged bobcat
#

then take the coupon value from the PromoCode object and pass that to the Subscription directly for example

shut orchid
#

yes. I was doing that till now until I realized that that the PromotionCode.list has a limit by default

#

or I should provide my custom limit

#

but I want to make a search

#

and there is no search API call

jagged bobcat
#

you use pagination

#

the limit doesn't matter, it just means you get 100 at a time, doesn't mean you somehow can't get all the results. You simply use pagination.

lucid fulcrum
#

is not the case. I will receive a promotion_code code from frontend and I want to search to find the promotion_code_id in my backend

#

using pagination and limit does not solve the problem of finding the id of the promotion_code code

#

or auto-pagination returns you the full list

#

?

jagged bobcat
#

no idea what you mean

#

a user types SALE22 on your page

#

you pass that to your server

#

that will return a list of promo_code_xxxx PromoCode objects that match(usually there's only one). You use that list to get the corresponding coupon and apply it.

#

does that make sense? What am I missing?

jagged bobcat
lucid fulcrum
#

I was saysing that I cannot use just list, but I am obligated to also use auto-pagination to be able to get all results

#

because if I use only "list" there will always be a limit

#

default or (defined by me), but I cannot get results without limit

#

let take the example that I have 500 records

#

using this you can see that the max limit is 100

#

if you see the limit parameter

#

So I will always get max 100 items, eventhought I have 500

jagged bobcat
#

answered you above

#

for example if you are listing something in the API and there are 356 results, auto-pagination will make multiple API requests and return all 356 to the iterator in your code

#

you're not understanding what limit means. limit is the amount of results returned in a single 'page' (the one API response to one API request). If there are more results in our database than can fit in the limit, we return a has_more:true boolean, and you can make more requests to get the next 'page'. If you use auto-pagination in our libraries, they automatically handle all that and make the required extra requests and give you all the results from our database. Makes sense @lucid fulcrum ?

lucid fulcrum
#

so in this example here in the right, that limit: 3 that is passed does not have any sense

#

because, anyway auto_paging_each will pass all records

#

the example there confused me

#

limit: 3, limit: 5 or without limit I will get the same result

#

since auto_paging_each will loop through all items in database

#

and not just those 3 or 5 items