Edits history of script submission #24210 for ' Get task (linkup)'

  • bunnative
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    
    /**
     * Get task
     * Retrieve a Linkup batch task by id, with its status and, once completed, its output.
     */
    export async function main(auth: RT.Linkup, task_id: string) {
      const url = new URL(
        `https://api.linkup.so/v1/tasks/${encodeURIComponent(task_id)}`
      )
    
      const response = await fetch(url, {
        method: "GET",
        headers: {
          Authorization: `Bearer ${auth.token}`,
          Accept: "application/json",
        },
      })
    
      if (!response.ok) {
        throw new Error(`${response.status} ${await response.text()}`)
      }
    
      return await response.json()
    }
    

    Submitted by hugo989 3 hours ago