-
Notifications
You must be signed in to change notification settings - Fork 460
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update generated code for v1249 * Update generated code for v1250 * Update generated code for v1255 * Update generated code for v1257 * Update generated code for v1259 --------- Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Co-authored-by: jar-stripe <[email protected]>
- Loading branch information
1 parent
db9aa38
commit 0196e53
Showing
12 changed files
with
265 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v1246 | ||
v1259 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
// | ||
// | ||
// File generated from our OpenAPI spec | ||
// | ||
// | ||
|
||
package stripe | ||
|
||
// The status of the template, one of `active` or `archived`. | ||
type InvoiceRenderingTemplateStatus string | ||
|
||
// List of values that InvoiceRenderingTemplateStatus can take | ||
const ( | ||
InvoiceRenderingTemplateStatusActive InvoiceRenderingTemplateStatus = "active" | ||
InvoiceRenderingTemplateStatusArchived InvoiceRenderingTemplateStatus = "archived" | ||
) | ||
|
||
// List all templates, ordered by creation date, with the most recently created template appearing first. | ||
type InvoiceRenderingTemplateListParams struct { | ||
ListParams `form:"*"` | ||
// Specifies which fields in the response should be expanded. | ||
Expand []*string `form:"expand"` | ||
Status *string `form:"status"` | ||
} | ||
|
||
// AddExpand appends a new field to expand. | ||
func (p *InvoiceRenderingTemplateListParams) AddExpand(f string) { | ||
p.Expand = append(p.Expand, &f) | ||
} | ||
|
||
// Retrieves an invoice rendering template with the given ID. It by default returns the latest version of the template. Optionally, specify a version to see previous versions. | ||
type InvoiceRenderingTemplateParams struct { | ||
Params `form:"*"` | ||
// Specifies which fields in the response should be expanded. | ||
Expand []*string `form:"expand"` | ||
Version *int64 `form:"version"` | ||
} | ||
|
||
// AddExpand appends a new field to expand. | ||
func (p *InvoiceRenderingTemplateParams) AddExpand(f string) { | ||
p.Expand = append(p.Expand, &f) | ||
} | ||
|
||
// Updates the status of an invoice rendering template to ‘archived' so no new Stripe objects (customers, invoices, etc.) can reference it. The template can also no longer be updated. However, if the template is already set on a Stripe object, it will continue to be applied on invoices generated by it. | ||
type InvoiceRenderingTemplateArchiveParams struct { | ||
Params `form:"*"` | ||
// Specifies which fields in the response should be expanded. | ||
Expand []*string `form:"expand"` | ||
} | ||
|
||
// AddExpand appends a new field to expand. | ||
func (p *InvoiceRenderingTemplateArchiveParams) AddExpand(f string) { | ||
p.Expand = append(p.Expand, &f) | ||
} | ||
|
||
// Unarchive an invoice rendering template so it can be used on new Stripe objects again. | ||
type InvoiceRenderingTemplateUnarchiveParams struct { | ||
Params `form:"*"` | ||
// Specifies which fields in the response should be expanded. | ||
Expand []*string `form:"expand"` | ||
} | ||
|
||
// AddExpand appends a new field to expand. | ||
func (p *InvoiceRenderingTemplateUnarchiveParams) AddExpand(f string) { | ||
p.Expand = append(p.Expand, &f) | ||
} | ||
|
||
type InvoiceRenderingTemplate struct { | ||
APIResource | ||
// Time at which the object was created. Measured in seconds since the Unix epoch. | ||
Created int64 `json:"created"` | ||
// Unique identifier for the object. | ||
ID string `json:"id"` | ||
// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. | ||
Livemode bool `json:"livemode"` | ||
// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. | ||
Metadata map[string]string `json:"metadata"` | ||
// A brief description of the template, hidden from customers | ||
Nickname string `json:"nickname"` | ||
// String representing the object's type. Objects of the same type share the same value. | ||
Object string `json:"object"` | ||
// The status of the template, one of `active` or `archived`. | ||
Status InvoiceRenderingTemplateStatus `json:"status"` | ||
// Version of this template; version increases by one when an update on the template changes any field that controls invoice rendering | ||
Version int64 `json:"version"` | ||
} | ||
|
||
// InvoiceRenderingTemplateList is a list of InvoiceRenderingTemplates as retrieved from a list endpoint. | ||
type InvoiceRenderingTemplateList struct { | ||
APIResource | ||
ListMeta | ||
Data []*InvoiceRenderingTemplate `json:"data"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
// | ||
// | ||
// File generated from our OpenAPI spec | ||
// | ||
// | ||
|
||
// Package invoicerenderingtemplate provides the /invoice_rendering_templates APIs | ||
package invoicerenderingtemplate | ||
|
||
import ( | ||
"net/http" | ||
|
||
stripe "github.com/stripe/stripe-go/v79" | ||
"github.com/stripe/stripe-go/v79/form" | ||
) | ||
|
||
// Client is used to invoke /invoice_rendering_templates APIs. | ||
type Client struct { | ||
B stripe.Backend | ||
Key string | ||
} | ||
|
||
// Retrieves an invoice rendering template with the given ID. It by default returns the latest version of the template. Optionally, specify a version to see previous versions. | ||
func Get(id string, params *stripe.InvoiceRenderingTemplateParams) (*stripe.InvoiceRenderingTemplate, error) { | ||
return getC().Get(id, params) | ||
} | ||
|
||
// Retrieves an invoice rendering template with the given ID. It by default returns the latest version of the template. Optionally, specify a version to see previous versions. | ||
func (c Client) Get(id string, params *stripe.InvoiceRenderingTemplateParams) (*stripe.InvoiceRenderingTemplate, error) { | ||
path := stripe.FormatURLPath("/v1/invoice_rendering_templates/%s", id) | ||
invoicerenderingtemplate := &stripe.InvoiceRenderingTemplate{} | ||
err := c.B.Call(http.MethodGet, path, c.Key, params, invoicerenderingtemplate) | ||
return invoicerenderingtemplate, err | ||
} | ||
|
||
// Updates the status of an invoice rendering template to ‘archived' so no new Stripe objects (customers, invoices, etc.) can reference it. The template can also no longer be updated. However, if the template is already set on a Stripe object, it will continue to be applied on invoices generated by it. | ||
func Archive(id string, params *stripe.InvoiceRenderingTemplateArchiveParams) (*stripe.InvoiceRenderingTemplate, error) { | ||
return getC().Archive(id, params) | ||
} | ||
|
||
// Updates the status of an invoice rendering template to ‘archived' so no new Stripe objects (customers, invoices, etc.) can reference it. The template can also no longer be updated. However, if the template is already set on a Stripe object, it will continue to be applied on invoices generated by it. | ||
func (c Client) Archive(id string, params *stripe.InvoiceRenderingTemplateArchiveParams) (*stripe.InvoiceRenderingTemplate, error) { | ||
path := stripe.FormatURLPath("/v1/invoice_rendering_templates/%s/archive", id) | ||
invoicerenderingtemplate := &stripe.InvoiceRenderingTemplate{} | ||
err := c.B.Call( | ||
http.MethodPost, | ||
path, | ||
c.Key, | ||
params, | ||
invoicerenderingtemplate, | ||
) | ||
return invoicerenderingtemplate, err | ||
} | ||
|
||
// Unarchive an invoice rendering template so it can be used on new Stripe objects again. | ||
func Unarchive(id string, params *stripe.InvoiceRenderingTemplateUnarchiveParams) (*stripe.InvoiceRenderingTemplate, error) { | ||
return getC().Unarchive(id, params) | ||
} | ||
|
||
// Unarchive an invoice rendering template so it can be used on new Stripe objects again. | ||
func (c Client) Unarchive(id string, params *stripe.InvoiceRenderingTemplateUnarchiveParams) (*stripe.InvoiceRenderingTemplate, error) { | ||
path := stripe.FormatURLPath( | ||
"/v1/invoice_rendering_templates/%s/unarchive", | ||
id, | ||
) | ||
invoicerenderingtemplate := &stripe.InvoiceRenderingTemplate{} | ||
err := c.B.Call( | ||
http.MethodPost, | ||
path, | ||
c.Key, | ||
params, | ||
invoicerenderingtemplate, | ||
) | ||
return invoicerenderingtemplate, err | ||
} | ||
|
||
// List all templates, ordered by creation date, with the most recently created template appearing first. | ||
func List(params *stripe.InvoiceRenderingTemplateListParams) *Iter { | ||
return getC().List(params) | ||
} | ||
|
||
// List all templates, ordered by creation date, with the most recently created template appearing first. | ||
func (c Client) List(listParams *stripe.InvoiceRenderingTemplateListParams) *Iter { | ||
return &Iter{ | ||
Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { | ||
list := &stripe.InvoiceRenderingTemplateList{} | ||
err := c.B.CallRaw(http.MethodGet, "/v1/invoice_rendering_templates", c.Key, b, p, list) | ||
|
||
ret := make([]interface{}, len(list.Data)) | ||
for i, v := range list.Data { | ||
ret[i] = v | ||
} | ||
|
||
return ret, list, err | ||
}), | ||
} | ||
} | ||
|
||
// Iter is an iterator for invoice rendering templates. | ||
type Iter struct { | ||
*stripe.Iter | ||
} | ||
|
||
// InvoiceRenderingTemplate returns the invoice rendering template which the iterator is currently pointing to. | ||
func (i *Iter) InvoiceRenderingTemplate() *stripe.InvoiceRenderingTemplate { | ||
return i.Current().(*stripe.InvoiceRenderingTemplate) | ||
} | ||
|
||
// InvoiceRenderingTemplateList returns the current list object which the iterator is | ||
// currently using. List objects will change as new API calls are made to | ||
// continue pagination. | ||
func (i *Iter) InvoiceRenderingTemplateList() *stripe.InvoiceRenderingTemplateList { | ||
return i.List().(*stripe.InvoiceRenderingTemplateList) | ||
} | ||
|
||
func getC() Client { | ||
return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.