MediaApi
Defined in: packages/sdk/src/resources/MediaApi.ts:9
Per-website image uploads. Writes into the site repo at
public/uploads/{timestamp}-{filename}; bounded by GitHub’s
file-size limit (we cap at 8 MB) and refuses deletes outside that
prefix.
Extends
Section titled “Extends”Resource
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new MediaApi(
opts):MediaApi
Defined in: packages/sdk/src/request.ts:93
Parameters
Section titled “Parameters”Returns
Section titled “Returns”MediaApi
Inherited from
Section titled “Inherited from”Resource.constructor
Methods
Section titled “Methods”delete()
Section titled “delete()”delete(
websiteId,path):Promise<{ok:true;path:string; }>
Defined in: packages/sdk/src/resources/MediaApi.ts:30
Delete a previously-uploaded image. path must be under
public/uploads/ (the API refuses anything else).
Parameters
Section titled “Parameters”websiteId
Section titled “websiteId”string
string
Returns
Section titled “Returns”Promise<{ ok: true; path: string; }>
upload()
Section titled “upload()”upload(
websiteId,input):Promise<{bytes:number;path:string;url:string; }>
Defined in: packages/sdk/src/resources/MediaApi.ts:16
Upload an image into the website’s repo at
public/uploads/{timestamp}-{filename}. Max 8 MB. Returns the
public URL the live site will serve it at + the in-repo path
(useful for referencing it from a CMS field).
Parameters
Section titled “Parameters”websiteId
Section titled “websiteId”string
contentBase64
Section titled “contentBase64”string
contentType?
Section titled “contentType?”string
filename
Section titled “filename”string
Returns
Section titled “Returns”Promise<{ bytes: number; path: string; url: string; }>