Get File Public URL ( hubspot)
One script reply has been approved by the moderators Verified

Created by saskiaorient 296 days ago Viewed 52 times 0 Points

No comments yet

Login to be able to comment
Points: 0
deno
One script reply has been approved by the moderators
Ap­pro­ved
import * as wmill from "https://deno.land/x/windmill@v1.70.1/mod.ts"
import { Client } from "npm:@hubspot/api-client@^8.1.0"

export async function main(
  auth: wmill.Resource<"hubspot">,
  file_id: string,
  size?: "" | "thumb" | "icon" | "medium" | "preview",
  expiration_seconds?: number,
  upscale?: boolean
) {
  const client = new Client({
    accessToken: auth.token
  })

  try {
    return await client.files.filesApi.getSignedUrl(
      file_id,
      size || undefined,
      expiration_seconds || undefined,
      upscale || undefined,
    )
  } catch (e) {
    throw Error(`
      ${e.code}\n
      Message: ${e.body.message || e.body}\n
    `)
  }
}

Submitted by adam186 112 days ago

Edited 29 days ago

No comments yet

Login to be able to comment