当前位置: 首页>>代码示例>>Golang>>正文


Golang stripe-go.GetIter函数代码示例

本文整理汇总了Golang中github.com/stripe/stripe-go.GetIter函数的典型用法代码示例。如果您正苦于以下问题:Golang GetIter函数的具体用法?Golang GetIter怎么用?Golang GetIter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetIter函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: List

func (s Client) List(params *stripe.SourceListParams) *Iter {
	body := &stripe.RequestValues{}
	var lp *stripe.ListParams
	var p *stripe.Params

	params.AppendTo(body)
	lp = &params.ListParams
	p = params.ToParams()

	return &Iter{stripe.GetIter(lp, body, func(b *stripe.RequestValues) ([]interface{}, stripe.ListMeta, error) {
		list := &stripe.SourceList{}
		var err error

		if len(params.Customer) > 0 {
			err = s.B.Call("GET", fmt.Sprintf("/customers/%v/sources", params.Customer), s.Key, b, p, list)
		} else {
			err = errors.New("Invalid source params: customer needs to be set")
		}

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

		return ret, list.ListMeta, err
	})}
}
开发者ID:captain401,项目名称:stripe-go,代码行数:27,代码来源:client.go

示例2: List

func (c Client) List(params *stripe.BitcoinReceiverListParams) *Iter {
	type receiverList struct {
		stripe.ListMeta
		Values []*stripe.BitcoinReceiver `json:"data"`
	}

	var body *url.Values
	var lp *stripe.ListParams

	if params != nil {
		body = &url.Values{}

		body.Add("filled", strconv.FormatBool(!params.NotFilled))
		body.Add("active", strconv.FormatBool(!params.NotActive))
		body.Add("uncaptured_funds", strconv.FormatBool(params.Uncaptured))

		params.AppendTo(body)
		lp = &params.ListParams
	}

	return &Iter{stripe.GetIter(lp, body, func(b url.Values) ([]interface{}, stripe.ListMeta, error) {
		list := &receiverList{}
		err := c.B.Call("GET", "/bitcoin/receivers", 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
	})}
}
开发者ID:mousadialo,项目名称:stripe-go,代码行数:32,代码来源:client.go

示例3: List

func (c Client) List(params *stripe.CustomerListParams) *Iter {
	type customerList struct {
		stripe.ListMeta
		Values []*stripe.Customer `json:"data"`
	}

	var body *url.Values
	var lp *stripe.ListParams
	var p *stripe.Params

	if params != nil {
		body = &url.Values{}

		if params.Created > 0 {
			body.Add("created", strconv.FormatInt(params.Created, 10))
		}

		params.AppendTo(body)
		lp = &params.ListParams
		p = params.ToParams()
	}

	return &Iter{stripe.GetIter(lp, body, func(b url.Values) ([]interface{}, stripe.ListMeta, error) {
		list := &customerList{}
		err := c.B.Call("GET", "/customers", 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
	})}
}
开发者ID:outdoorsy,项目名称:stripe-go,代码行数:34,代码来源:client.go

示例4: ListLines

func (c Client) ListLines(params *stripe.InvoiceLineListParams) *LineIter {
	body := &url.Values{}
	var lp *stripe.ListParams

	if len(params.Customer) > 0 {
		body.Add("customer", params.Customer)
	}

	if len(params.Sub) > 0 {
		body.Add("subscription", params.Sub)
	}

	params.AppendTo(body)
	lp = &params.ListParams

	return &LineIter{stripe.GetIter(lp, body, func(b url.Values) ([]interface{}, stripe.ListMeta, error) {
		list := &stripe.InvoiceLineList{}
		err := c.B.Call("GET", fmt.Sprintf("/invoices/%v/lines", params.ID), 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
	})}
}
开发者ID:mousadialo,项目名称:stripe-go,代码行数:27,代码来源:client.go

示例5: List

func (c Client) List(params *stripe.SubListParams) *Iter {
	var body *stripe.RequestValues
	var lp *stripe.ListParams
	var p *stripe.Params

	if params != nil {
		body = &stripe.RequestValues{}

		if len(params.Customer) > 0 {
			body.Add("customer", params.Customer)
		}

		if len(params.Plan) > 0 {
			body.Add("plan", params.Plan)
		}

		params.AppendTo(body)

		lp = &params.ListParams
		p = params.ToParams()
	}

	return &Iter{stripe.GetIter(lp, body, func(b *stripe.RequestValues) ([]interface{}, stripe.ListMeta, error) {
		list := &stripe.SubList{}
		err := c.B.Call("GET", "/subscriptions", 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
	})}
}
开发者ID:carriercomm,项目名称:stripe-go,代码行数:34,代码来源:client.go

示例6: List

func (c Client) List(params *stripe.RefundListParams) *Iter {
	body := &url.Values{}
	var lp *stripe.ListParams

	params.AppendTo(body)
	lp = &params.ListParams

	return &Iter{stripe.GetIter(lp, body, func(b url.Values) ([]interface{}, stripe.ListMeta, error) {
		list := &stripe.RefundList{}
		err := c.B.Call("GET", fmt.Sprintf("/charges/%v/refunds", params.Charge), 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
	})}
}
开发者ID:zkirill,项目名称:stripe-go,代码行数:19,代码来源:client.go

示例7: List

func (c Client) List(params *stripe.OrderListParams) *Iter {
	type orderList struct {
		stripe.ListMeta
		Values []*stripe.Order `json:"data"`
	}

	var body *url.Values
	var lp *stripe.ListParams

	if params != nil {
		body = &url.Values{}

		for _, id := range params.IDs {
			params.Filters.AddFilter("ids[]", "", id)
		}

		if params.Status != "" {
			params.Filters.AddFilter("status", "", string(params.Status))
		}

		params.AppendTo(body)
		lp = &params.ListParams
	}

	return &Iter{stripe.GetIter(lp, body, func(b url.Values) ([]interface{}, stripe.ListMeta, error) {
		list := &orderList{}
		err := c.B.Call("GET", "/orders", 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
	})}
}
开发者ID:Teamwork,项目名称:stripehooks,代码行数:36,代码来源:client.go


注:本文中的github.com/stripe/stripe-go.GetIter函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。