func (c Client) List(params *stripe.ChargeListParams) *Iter { var body *stripe.RequestValues var lp *stripe.ListParams var p *stripe.Params if params != nil { body = &stripe.RequestValues{} if params.Created > 0 { body.Add("created", strconv.FormatInt(params.Created, 10)) } if len(params.Customer) > 0 { body.Add("customer", params.Customer) } params.AppendTo(body) lp = ¶ms.ListParams p = params.ToParams() } return &Iter{stripe.GetIter(lp, body, func(b *stripe.RequestValues) ([]interface{}, stripe.ListMeta, error) { list := &stripe.ChargeList{} err := c.B.Call("GET", "/charges", c.Key, b, p, list) ret := make([]interface{}, len(list.Values)) for i, v := range list.Values { ret[i] = v } return ret, list.ListMeta, err })} }
func (c Client) List(params *stripe.ChargeListParams) *Iter { type chargeList struct { stripe.ListMeta Values []*stripe.Charge `json:"data"` } var body *url.Values var lp *stripe.ListParams if params != nil { body = &url.Values{} if params.Created > 0 { body.Add("created", strconv.FormatInt(params.Created, 10)) } if len(params.Customer) > 0 { body.Add("customer", params.Customer) } params.AppendTo(body) lp = ¶ms.ListParams } return &Iter{stripe.GetIter(lp, body, func(b url.Values) ([]interface{}, stripe.ListMeta, error) { list := &chargeList{} err := c.B.Call("GET", "/charges", c.Key, &b, nil, list) ret := make([]interface{}, len(list.Values)) for i, v := range list.Values { ret[i] = v } return ret, list.ListMeta, err })} }