github.com/stripe/stripe-go/v76@v76.25.0/filelink.go (about) 1 // 2 // 3 // File generated from our OpenAPI spec 4 // 5 // 6 7 package stripe 8 9 import "github.com/stripe/stripe-go/v76/form" 10 11 // Returns a list of file links. 12 type FileLinkListParams struct { 13 ListParams `form:"*"` 14 // Only return links that were created during the given date interval. 15 Created *int64 `form:"created"` 16 // Only return links that were created during the given date interval. 17 CreatedRange *RangeQueryParams `form:"created"` 18 // Specifies which fields in the response should be expanded. 19 Expand []*string `form:"expand"` 20 // Filter links by their expiration status. By default, Stripe returns all links. 21 Expired *bool `form:"expired"` 22 // Only return links for the given file. 23 File *string `form:"file"` 24 } 25 26 // AddExpand appends a new field to expand. 27 func (p *FileLinkListParams) AddExpand(f string) { 28 p.Expand = append(p.Expand, &f) 29 } 30 31 // Creates a new file link object. 32 type FileLinkParams struct { 33 Params `form:"*"` 34 // Specifies which fields in the response should be expanded. 35 Expand []*string `form:"expand"` 36 // A future timestamp after which the link will no longer be usable, or `now` to expire the link immediately. 37 ExpiresAt *int64 `form:"expires_at"` 38 ExpiresAtNow *bool `form:"-"` // See custom AppendTo 39 // The ID of the file. The file's `purpose` must be one of the following: `business_icon`, `business_logo`, `customer_signature`, `dispute_evidence`, `finance_report_run`, `identity_document_downloadable`, `pci_document`, `selfie`, `sigma_scheduled_query`, `tax_document_user_upload`, or `terminal_reader_splashscreen`. 40 File *string `form:"file"` 41 // 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. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. 42 Metadata map[string]string `form:"metadata"` 43 } 44 45 // AddExpand appends a new field to expand. 46 func (p *FileLinkParams) AddExpand(f string) { 47 p.Expand = append(p.Expand, &f) 48 } 49 50 // AddMetadata adds a new key-value pair to the Metadata. 51 func (p *FileLinkParams) AddMetadata(key string, value string) { 52 if p.Metadata == nil { 53 p.Metadata = make(map[string]string) 54 } 55 56 p.Metadata[key] = value 57 } 58 59 // AppendTo implements custom encoding logic for FileLinkParams. 60 func (p *FileLinkParams) AppendTo(body *form.Values, keyParts []string) { 61 if BoolValue(p.ExpiresAtNow) { 62 body.Add(form.FormatKey(append(keyParts, "expires_at")), "now") 63 } 64 } 65 66 // To share the contents of a `File` object with non-Stripe users, you can 67 // create a `FileLink`. `FileLink`s contain a URL that you can use to 68 // retrieve the contents of the file without authentication. 69 type FileLink struct { 70 APIResource 71 // Time at which the object was created. Measured in seconds since the Unix epoch. 72 Created int64 `json:"created"` 73 // Returns if the link is already expired. 74 Expired bool `json:"expired"` 75 // Time that the link expires. 76 ExpiresAt int64 `json:"expires_at"` 77 // The file object this link points to. 78 File *File `json:"file"` 79 // Unique identifier for the object. 80 ID string `json:"id"` 81 // Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. 82 Livemode bool `json:"livemode"` 83 // 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. 84 Metadata map[string]string `json:"metadata"` 85 // String representing the object's type. Objects of the same type share the same value. 86 Object string `json:"object"` 87 // The publicly accessible URL to download the file. 88 URL string `json:"url"` 89 } 90 91 // FileLinkList is a list of FileLinks as retrieved from a list endpoint. 92 type FileLinkList struct { 93 APIResource 94 ListMeta 95 Data []*FileLink `json:"data"` 96 }