// Returns a list of your Charges with the given Customer ID and range.
//
// see https://stripe.com/docs/api#list_charges
760050
func (self *ChargeClient) CustomerListN(id string, count int, offset int) ([]*Charge, error) {
	return self.list(id, count, offset)
}
904710
func (list *ChargeList) Find(id string) *Charge {
	for _, item := range list.Data {
		if item.ID == id {
			return item
		}
	}

	return nil
}
1082524
func (c Client) Get(id string, params *stripe.TaxIDParams) (*stripe.TaxID, error) {
	if params == nil {
		return nil, fmt.Errorf("params cannot be nil, and params.Customer must be set")
	}

	path := stripe.FormatURLPath("/v1/customers/%s/tax_ids/%s", stripe.StringValue(params.Customer), id)
	taxid := &stripe.TaxID{}
	err := c.B.Call(http.MethodGet, path, c.Key, params, taxid)
	return taxid, err
}
1122105
func (s *Service) InvoiceList(ctx context.Context, lr *ListRange) (InvoiceListResult, error) {
	var invoice InvoiceListResult
	return invoice, s.Get(ctx, &invoice, fmt.Sprintf("/account/invoices"), nil, lr)
}
1309783
func (c *PlansClient) List(ctx context.Context, productID []ID, opts *PlansListOpts) *PlanIter {
	iter := PlanIter{
		first: true,
		i:     -1,
	}

	p := "/plans/"

	q := make(url.Values)
	for _, v := range productID {
		b, err := v.MarshalText()
		if err != nil {
			return &iter
		}
		q.Add("product_id", string(b))
	}

	if opts != nil {

		if opts.Label != nil {
			q.Set("label", *opts.Label)
		}
	}

	var req *http.Request
	req, iter.err = c.backend.NewRequest(http.MethodGet, p, q, nil)
	if iter.err != nil {
		return &iter
	}

	_, iter.err = c.backend.Do(ctx, req, &iter.page, func(code int) error {
		switch code {
		case 400, 404, 500:
			return &Error{}
		default:
			return nil
		}
	})
	return &iter
}
1000645
func (self *CustomerClient) ListN(count int, offset int) ([]*Customer, error) {
	// define a wrapper function for the Customer List, so that we can
	// cleanly parse the JSON
	type listCustomerResp struct{ Data []*Customer }
	resp := listCustomerResp{}

	// add the count and offset to the list of url values
	values := url.Values{
		"count":  {strconv.Itoa(count)},
		"offset": {strconv.Itoa(offset)},
	}

	err := query("GET", "/v1/customers", values, &resp)
	if err != nil {
		return nil, err
	}
	return resp.Data, nil
}
204671
func (idx *ListIndex) Range(min []byte, max []byte, opts *Options) ([][]byte, error) {
	var list [][]byte

	c := internal.RangeCursor{
		C:       idx.IndexBucket.Cursor(),
		Reverse: opts != nil && opts.Reverse,
		Min:     min,
		Max:     max,
		CompareFn: func(val, limit []byte) int {
			pos := bytes.LastIndex(val, []byte("__"))
			return bytes.Compare(val[:pos], limit)
		},
	}

	for k, id := c.First(); c.Continue(k); k, id = c.Next() {
		if id == nil || bytes.Equal(k, []byte("storm__ids")) {
			continue
		}

		if opts != nil && opts.Skip > 0 {
			opts.Skip--
			continue
		}

		if opts != nil && opts.Limit == 0 {
			break
		}

		if opts != nil && opts.Limit > 0 {
			opts.Limit--
		}

		list = append(list, id)
	}

	return list, nil
}
906301
func New(params *stripe.ChargeParams) (*stripe.Charge, error) {
	return getC().New(params)
}
572814
func (c Client) Del(customerID string, params *stripe.DiscountParams) (*stripe.Discount, error) {
	path := stripe.FormatURLPath("/v1/customers/%s/discount", customerID)
	discount := &stripe.Discount{}
	err := c.B.Call(http.MethodDelete, path, c.Key, params, discount)
	return discount, err
}
686501
func (r Account) GetPriceRestrictions() (resp []datatypes.Product_Item_Price_Account_Restriction, err error) {
	err = r.Session.DoRequest("SoftLayer_Account", "getPriceRestrictions", nil, &r.Options, &resp)
	return
}
1094027
func (a Account) ListRequest() (ListCommand, error) {
	return &ListAccounts{
		ID:    a.ID,
		State: a.State,
	}, nil
}
842997
func (c *Client) GetCreditCards(ccf *CreditCardsFilter) (*CreditCards, error) {
	page := 1
	if ccf != nil && ccf.Page > 0 {
		page = ccf.Page
	}
	pageSize := 10
	if ccf != nil && ccf.PageSize > 0 {
		pageSize = ccf.PageSize
	}

	req, err := c.NewRequest("GET", fmt.Sprintf("%s/v1/vault/credit-cards?page=%d&page_size=%d", c.APIBase, page, pageSize), nil)
	if err != nil {
		return nil, err
	}

	response := CreditCards{}

	if err = c.SendWithAuth(req, &response); err != nil {
		return nil, err
	}

	return &response, nil
}
897529
func (c Client) List(listParams *stripe.SubscriptionScheduleRevisionListParams) *Iter {
	path := stripe.FormatURLPath("/v1/subscription_schedules/%s/revisions",
		stripe.StringValue(listParams.Schedule))

	return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {
		list := &stripe.SubscriptionScheduleRevisionList{}
		err := c.B.CallRaw(http.MethodGet, path, c.Key, b, p, list)

		ret := make([]interface{}, len(list.Data))
		for i, v := range list.Data {
			ret[i] = v
		}

		return ret, list.ListMeta, err
	})}
}
8339
func (p *paymentService) List(ctx context.Context, req *paymentpb.ListRequest) (*paymentpb.ChargeList, error) {

	if err := validation.Validate(req); err != nil {
		return nil, err
	}

	slice := &charges{}

	n, err := storage.Handler().List(slice, object.ListOpt{
		Limit: req.GetLimit(),
		Page:  req.GetPage(),
		Sort:  object.SortNatural,
	})

	if err != nil {
		return nil, err
	}

	return &paymentpb.ChargeList{Charges: *slice, Total: int32(n)}, nil

}
264324
func (c *Client) AppList(lr *ListRange) ([]App, error) {
	req, err := c.NewRequest("GET", "/apps", nil, nil)
	if err != nil {
		return nil, err
	}

	if lr != nil {
		lr.SetHeader(req)
	}

	var appsRes []App
	return appsRes, c.DoReq(req, &appsRes)
}
279592
func (list *CustomerList) Find(id string) *Customer {
	for _, item := range list.Data {
		if item.ID == id {
			return item
		}
	}

	return nil
}
1224738
func Get(id string, params *stripe.PaymentIntentParams) (*stripe.PaymentIntent, error) {
	return getC().Get(id, params)
}