Edits history of script submission #361 for ' Get a properties configuration from hubspot crm (hubspot)'

  • deno
    One script reply has been approved by the moderators
    Ap­pro­ved
    // Ctrl+. to cache dependencies on imports hover, Ctrl+S to format.
    
    type Hubspot = {
      token: string;
    };
    export async function main(
      auth: Hubspot,
      objectType: string,
      propertyName: string,
    ) {
      const res = await fetch(
        `https://api.hubapi.com/crm/v3/properties/${objectType}/${propertyName}?archived=false`,
        {
          headers: {
            Authorization: `Bearer ${auth.token}`,
            Accept: "application/json",
          },
          method: "GET",
        },
      );
      const jsonRes = await res.json();
      if (jsonRes.status == "error") {
        console.error(jsonRes);
        throw new Error(jsonRes.message);
      }
      return jsonRes;
    }
    

    Submitted by hugo697 376 days ago

  • deno
    // Ctrl+. to cache dependencies on imports hover, Ctrl+S to format.
    
    type Hubspot = {
      token: string;
    };
    export async function main(
      auth: Hubspot,
      objectType: string,
      propertyName: string,
    ) {
      const res = await fetch(
        `https://api.hubapi.com/crm/v3/properties/${objectType}/${propertyName}?archived=false`,
        {
          headers: {
            Authorization: `Bearer ${auth.token}`,
            Accept: "application/json",
          },
          method: "GET",
        },
      );
      const jsonRes = await res.json();
      if (jsonRes.status == "error") {
        console.error(jsonRes);
        throw new Error(jsonRes.message);
      }
      return jsonRes;
    }
    

    Submitted by admin 1009 days ago

  • deno
    // Ctrl+. to cache dependencies on imports hover, Ctrl+S to format.
    
    
    type Hubspot = {
      token: string;
    };
    export async function main(
      auth: Hubspot,
      objectType: string,
      propertyName: string,
    ) {
      const res = await fetch(
        `https://api.hubapi.com/crm/v3/properties/${objectType}/${propertyName}?archived=false`,
        {
          headers: {
            Authorization: `Bearer ${auth.token}`,
            Accept: "application/json",
          },
          method: "GET",
        },
      );
      const jsonRes = await res.json();
      if (jsonRes.status == "error") {
        console.error(jsonRes);
        throw new Error(jsonRes.message);
      }
      return jsonRes;
    }
    

    Submitted by admin 1012 days ago

  • deno
    // Ctrl+. to cache dependencies on imports hover, Ctrl+S to format.
    
    import type { Resource } from "https://deno.land/x/[email protected]/mod.ts"
    
    export async function main(
      auth: wmill.Resource<"hubspot">,
      objectType: string,
      propertyName: string,
    ) {
      const res = await fetch(
        `https://api.hubapi.com/crm/v3/properties/${objectType}/${propertyName}?archived=false`,
        {
          headers: {
            Authorization: `Bearer ${auth.token}`,
            Accept: "application/json",
          },
          method: "GET",
        },
      );
      const jsonRes = await res.json();
      if (jsonRes.status == "error") {
        console.error(jsonRes);
        throw new Error(jsonRes.message);
      }
      return jsonRes;
    }

    Submitted by sindre svendby964 1103 days ago

  • deno
    // Ctrl+. to cache dependencies on imports hover, Ctrl+S to format.
    
    import * as wmill from "https://deno.land/x/[email protected]/mod.ts";
    
    export async function main(
      auth: wmill.Resource<"hubspot">,
      objectType: string,
      propertyName: string,
    ) {
      const res = await fetch(
        `https://api.hubapi.com/crm/v3/properties/${objectType}/${propertyName}?archived=false`,
        {
          headers: {
            Authorization: `Bearer ${auth.token}`,
            Accept: "application/json",
          },
          method: "GET",
        },
      );
      const jsonRes = await res.json();
      if (jsonRes.status == "error") {
        console.error(jsonRes);
        throw new Error(jsonRes.message);
      }
      return jsonRes;
    }
    

    Submitted by sindre svendby964 1103 days ago