#khorgnil

1 messages · Page 1 of 1 (latest)

nocturne acornBOT
ripe olive
#

For your second question I'm not sure what you mean. I'm not a Go developer, so I might not be understanding what you mean by "filter". Can you provide more details?

autumn bone
#

Thanks @ripe olive , that's perfect.

For my second question, I'm not sure if this problem is Go-specific or what, but all the list-based API calls have a Filter parameter. Look at this sample code in the same API you linked:

stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"

params := &stripe.PromotionCodeListParams{}
params.Filters.AddFilter("limit", "", "3")
i := promotioncode.List(params)
for i.Next() {
  pc := i.PromotionCode()
}

Note the line params.Filters.AddFilter(...) All other list-based APIs have something similar. Where is that documented?

ripe olive
#

That's likely also how you specify the code parameter.

autumn bone
#

I get that's what that particular exasmple is doing, but if you look at the code, it seems far more general than that. Besides, that's a opretty complicated mechanism to only lim,it the number of returns?

#

For example, there are three parameters, not two. The middle parameter is named 'op', anmd in the example it's blank. What are the other 'op's?

ripe olive
autumn bone
#

I was really looking for documentation about how to use filters. The example makes sense, but leaves more questions than answers. It doesnt sound like there is any documentation for how filters work in List-based APIs in the go API.

ripe olive
#

Sorry, I'm not following. Can you tell me why you're looking for that documentation? What would it enable you to do that you can't do now?

autumn bone
#

Don'

#

Don't sweat it, man. I don't think my question has an answer, and it's just a quirk of the documentation.

ripe olive
#

Okay. Sorry, don't have anyone around who's familiar with Go right now. 😅

autumn bone
#

That said, I will say that the documentation does appear to br wrong at least in this particular case.

Specifically, the documentation lists 'limit' as a direct member of the 'PromotionCodeListParams' type, but it is not. Also, the example code doesn't show 'limit' being set as a member of 'PromotionCodeListParams' -- it shows it being set using a completely different facility: some undocumented 'Filter' thingy

ripe olive
#

I can flag that internally, or you can post an issue on the GitHub Go library repo if you want a response from the team that maintains that library.