gumroad/files

Types

GumroadApiResponseFileAbort = object
  success*: bool
  status*: GumroadFileAbortStatus
GumroadApiResponseFileComplete = object
  success*: bool
  file_url*: string
GumroadApiResponseFilePresign = object
  success*: bool
  upload_id*: string
  key*: string
  file_url*: string
  parts*: seq[GumroadFilePresignPart]
GumroadFileAbortStatus = enum
  abortAccepted = "accepted", abortAlreadyGone = "already_gone"
GumroadFileCompletePart = object
  part_number*: int
  etag*: string
GumroadFilePresignPart = object
  part_number*: int
  presigned_url*: string

Consts

GumroadMaxFileSizeBytes = 21474836480'i64

Procs

proc isGone(res: GumroadApiResponseFileAbort): bool {....raises: [], tags: [],
    forbids: [].}
True when multipart session no longer exists on S3.
proc postAbortFileUpload(client: GumroadClient; uploadId, key: string): Future[
    GumroadApiResponseFileAbort] {....stackTrace: false, raises: [Exception,
    ValueError, GumroadClientError, KeyError, HttpRequestError, LibraryError,
    SslError, OSError, IOError, ProtocolError, JsonParsingError,
    OpenParserJsonError], tags: [RootEffect, ReadIOEffect, TimeEffect,
                                 WriteIOEffect], forbids: [].}
Cancels a multipart upload. Call repeatedly while status is "accepted"; stop on "already_gone".
proc postCompleteFileUpload(client: GumroadClient; uploadId, key: string;
                            parts: seq[GumroadFileCompletePart]): Future[
    GumroadApiResponseFileComplete] {....stackTrace: false, raises: [Exception,
    ValueError, GumroadClientError, KeyError, HttpRequestError, LibraryError,
    SslError, OSError, IOError, ProtocolError, JsonParsingError,
    OpenParserJsonError], tags: [RootEffect, ReadIOEffect, TimeEffect,
                                 WriteIOEffect], forbids: [].}
Finalizes a multipart upload. Do not retry this endpoint with the same upload_id.
proc postPresignFile(client: GumroadClient; filename: string; fileSize: int64): Future[
    GumroadApiResponseFilePresign] {....stackTrace: false, raises: [Exception,
    ValueError, GumroadClientError, KeyError, HttpRequestError, LibraryError,
    SslError, OSError, IOError, ProtocolError, JsonParsingError,
    OpenParserJsonError], tags: [RootEffect, ReadIOEffect, TimeEffect,
                                 WriteIOEffect], forbids: [].}

Starts a multipart upload and returns presigned URLs for each part. This endpoint requires scopeEditProducts OAuth scope.

The maximum file size is 20 GB. The client should split the file into parts of at least 5 MB each, then upload each part to S3 using the provided presigned URLs.

After all parts are uploaded, call postCompleteFileUpload to finalize the upload.

proc shouldRetry(res: GumroadApiResponseFileAbort): bool {....raises: [], tags: [],
    forbids: [].}
True when /files/abort should be called again.