Update a file.
Scopes: files:write
files:write
Go
package main import( "context" "os" polargo "github.com/polarsource/polar-go" "github.com/polarsource/polar-go/models/components" "log" "github.com/polarsource/polar-go/models/operations" ) func main() { ctx := context.Background() s := polargo.New( polargo.WithSecurity(os.Getenv("POLAR_ACCESS_TOKEN")), ) res, err := s.Files.Update(ctx, "<value>", components.FilePatch{}) if err != nil { log.Fatal(err) } if res.ResponseFilesUpdate != nil { switch res.ResponseFilesUpdate.Type { case operations.FilesUpdateResponseFilesUpdateTypeDownloadable: // res.ResponseFilesUpdate.DownloadableFileRead is populated case operations.FilesUpdateResponseFilesUpdateTypeProductMedia: // res.ResponseFilesUpdate.ProductMediaFileRead is populated case operations.FilesUpdateResponseFilesUpdateTypeOrganizationAvatar: // res.ResponseFilesUpdate.OrganizationAvatarFileRead is populated } } }
{ "id": "<string>", "organization_id": "<string>", "name": "<string>", "path": "<string>", "mime_type": "<string>", "size": 123, "storage_version": "<string>", "checksum_etag": "<string>", "checksum_sha256_base64": "<string>", "checksum_sha256_hex": "<string>", "last_modified_at": "2023-11-07T05:31:56Z", "version": "<string>", "service": "<string>", "is_uploaded": true, "created_at": "2023-11-07T05:31:56Z", "size_readable": "<string>" }
You can generate an Organization Access Token from your organization's settings.
The file ID.
File updated.
File to be associated with the downloadables benefit.
The ID of the object.
"downloadable"