import { Client } from "npm:@hubspot/api-client@^8.1.0";
/**
 * @param properties List of the properties to be returned in the response.
 *
 * @param properties_with_history List of the properties to be returned
 * along with their history of previous values.
 */
type Hubspot = {
  token: string;
};
export async function main(
  auth: Hubspot,
  contact_id: string,
  properties?: string[],
  properties_with_history?: string[],
) {
  const client = new Client({
    accessToken: auth.token,
  });
  try {
    return await client.crm.contacts.basicApi.getById(
      contact_id,
      getProp(properties),
      getProp(properties_with_history),
    );
  } catch (e) {
    throw Error(`
      ${e.code}\n
      Message: ${e.body.message || e.body}\n
    `);
  }
}
function getProp(prop?: string[]) {
  return Array.isArray(prop) && prop.length ? prop : undefined;
}
Submitted by hugo697 177 days ago
import { Client } from "npm:@hubspot/api-client@^8.1.0";
/**
 * @param properties List of the properties to be returned in the response.
 *
 * @param properties_with_history List of the properties to be returned
 * along with their history of previous values.
 */
type Hubspot = {
  token: string;
};
export async function main(
  auth: Hubspot,
  contact_id: string,
  properties?: string[],
  properties_with_history?: string[],
) {
  const client = new Client({
    accessToken: auth.token,
  });
  try {
    return await client.crm.contacts.basicApi.getById(
      contact_id,
      getProp(properties),
      getProp(properties_with_history),
    );
  } catch (e) {
    throw Error(`
      ${e.code}\n
      Message: ${e.body.message || e.body}\n
    `);
  }
}
function getProp(prop?: string[]) {
  return Array.isArray(prop) && prop.length ? prop : undefined;
}
Submitted by admin 810 days ago
import { Client } from "npm:@hubspot/api-client@^8.1.0"
/**
 * @param properties List of the properties to be returned in the response.
 * 
 * @param properties_with_history List of the properties to be returned 
 * along with their history of previous values.
 */
type Hubspot = {
  token: string;
};
export async function main(
  auth: Hubspot,
  contact_id: string,
  properties?: string[],
  properties_with_history?: string[],
) {
  const client = new Client({
    accessToken: auth.token
  })
  try {
    return await client.crm.contacts.basicApi.getById(
      contact_id,
      getProp(properties),
      getProp(properties_with_history)
    );
  } catch (e) {
    throw Error(`
      ${e.code}\n
      Message: ${e.body.message || e.body}\n
    `)
  }
}
function getProp(prop?: string[]) {
  return (Array.isArray(prop) && prop.length) ? prop : undefined
}
Submitted by admin 813 days ago
import * as wmill from "https://deno.land/x/windmill@v1.85.0/mod.ts"
import { Client } from "npm:@hubspot/api-client@^8.1.0"
/**
 * @param properties List of the properties to be returned in the response.
 * 
 * @param properties_with_history List of the properties to be returned 
 * along with their history of previous values.
 */
export async function main(
  auth: wmill.Resource<"hubspot">,
  contact_id: string,
  properties?: string[],
  properties_with_history?: string[],
) {
  const client = new Client({
    accessToken: auth.token
  })
  try {
    return await client.crm.contacts.basicApi.getById(
      contact_id,
      getProp(properties),
      getProp(properties_with_history)
    );
  } catch (e) {
    throw Error(`
      ${e.code}\n
      Message: ${e.body.message || e.body}\n
    `)
  }
}
function getProp(prop?: string[]) {
  return (Array.isArray(prop) && prop.length) ? prop : undefined
}
Submitted by adam186 941 days ago
import * as wmill from "https://deno.land/x/windmill@v1.70.1/mod.ts"
import { Client } from "npm:@hubspot/api-client@^8.1.0"
/**
 * @param properties List of the properties to be returned in the response.
 * 
 * @param properties_with_history List of the properties to be returned 
 * along with their history of previous values.
 */
export async function main(
  auth: wmill.Resource<"hubspot">,
  contact_id: string,
  properties?: string[],
  properties_with_history?: string[],
) {
  const client = new Client({
    accessToken: auth.token
  })
  try {
    return await client.crm.contacts.basicApi.getById(
      contact_id,
      getProp(properties),
      getProp(properties_with_history)
    );
  } catch (e) {
    throw Error(`
      ${e.code}\n
      Message: ${e.body.message || e.body}\n
    `)
  }
}
function getProp(prop?: string[]) {
  return (Array.isArray(prop) && prop.length) ? prop : undefined
}
Submitted by adam186 976 days ago
import * as wmill from "https://deno.land/x/windmill@v1.52.0/mod.ts"
import { Client } from "npm:@hubspot/api-client@^8.1.0"
/**
 * @param properties List of the properties to be returned in the response.
 * 
 * @param properties_with_history List of the properties to be returned 
 * along with their history of previous values.
 */
export async function main(
  auth: wmill.Resource<"hubspot">,
  contact_id: string,
  properties?: string[],
  properties_with_history?: string[],
) {
  const client = new Client({
    accessToken: auth.token
  })
  try {
    return await client.crm.contacts.basicApi.getById(
      contact_id,
      getProp(properties),
      getProp(properties_with_history)
    );
  } catch (e) {
    throw Error(`
      ${e.code}\n
      Message: ${e.body.message || e.body}\n
    `)
  }
}
function getProp(prop?: string[]) {
  return (Array.isArray(prop) && prop.length) ? prop : undefined
}
Submitted by adam186 1061 days ago