Edits history of script submission #24208 for ' Get credits balance (linkup)'

  • bunnative
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    
    /**
     * Get credits balance
     * Get the number of credits remaining on your Linkup account.
     */
    export async function main(auth: RT.Linkup) {
      const url = new URL("https://api.linkup.so/v1/credits/balance")
    
      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