Skip to content

Latest commit

 

History

History
1069 lines (785 loc) · 77.8 KB

File metadata and controls

1069 lines (785 loc) · 77.8 KB

Integrations

(integrations)

Overview

Integration endpoints

Available Operations

slackOAuthCallback

Handles OAuth callback from Slack after user authorization. Exchanges authorization code for access token and creates app integration.

Example Usage

import { Midday } from "@midday-ai/sdk";

const midday = new Midday({
  security: {
    oauth2: process.env["MIDDAY_OAUTH2"] ?? "",
  },
});

async function run() {
  const result = await midday.integrations.slackOAuthCallback({
    code: "<value>",
    state: "North Carolina",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MiddayCore } from "@midday-ai/sdk/core.js";
import { integrationsSlackOAuthCallback } from "@midday-ai/sdk/funcs/integrationsSlackOAuthCallback.js";

// Use `MiddayCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const midday = new MiddayCore({
  security: {
    oauth2: process.env["MIDDAY_OAUTH2"] ?? "",
  },
});

async function run() {
  const res = await integrationsSlackOAuthCallback(midday, {
    code: "<value>",
    state: "North Carolina",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("integrationsSlackOAuthCallback failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.SlackOAuthCallbackRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.SlackOAuthCallbackResponse>

Errors

Error Type Status Code Content Type
errors.SlackOAuthCallbackBadRequestError 400 application/json
errors.SlackOAuthCallbackInternalServerError 500 application/json
errors.APIError 4XX, 5XX */*

getSlackInstallUrl

Generates OAuth install URL for Slack integration. Requires authentication.

Example Usage

import { Midday } from "@midday-ai/sdk";

const midday = new Midday({
  security: {
    oauth2: process.env["MIDDAY_OAUTH2"] ?? "",
  },
});

async function run() {
  const result = await midday.integrations.getSlackInstallUrl();

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MiddayCore } from "@midday-ai/sdk/core.js";
import { integrationsGetSlackInstallUrl } from "@midday-ai/sdk/funcs/integrationsGetSlackInstallUrl.js";

// Use `MiddayCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const midday = new MiddayCore({
  security: {
    oauth2: process.env["MIDDAY_OAUTH2"] ?? "",
  },
});

async function run() {
  const res = await integrationsGetSlackInstallUrl(midday);
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("integrationsGetSlackInstallUrl failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.GetSlackInstallUrlResponse>

Errors

Error Type Status Code Content Type
errors.APIError 4XX, 5XX */*

slackWebhook

Handles incoming webhook events from Slack. Verifies request signature and processes events.

Example Usage

import { Midday } from "@midday-ai/sdk";

const midday = new Midday({
  security: {
    oauth2: process.env["MIDDAY_OAUTH2"] ?? "",
  },
});

async function run() {
  const result = await midday.integrations.slackWebhook();

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MiddayCore } from "@midday-ai/sdk/core.js";
import { integrationsSlackWebhook } from "@midday-ai/sdk/funcs/integrationsSlackWebhook.js";

// Use `MiddayCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const midday = new MiddayCore({
  security: {
    oauth2: process.env["MIDDAY_OAUTH2"] ?? "",
  },
});

async function run() {
  const res = await integrationsSlackWebhook(midday);
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("integrationsSlackWebhook failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.SlackWebhookResponse>

Errors

Error Type Status Code Content Type
errors.APIError 4XX, 5XX */*

slackInteractions

Handles interactive component actions from Slack (button clicks, etc.)

Example Usage

import { Midday } from "@midday-ai/sdk";

const midday = new Midday({
  security: {
    oauth2: process.env["MIDDAY_OAUTH2"] ?? "",
  },
});

async function run() {
  const result = await midday.integrations.slackInteractions();

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MiddayCore } from "@midday-ai/sdk/core.js";
import { integrationsSlackInteractions } from "@midday-ai/sdk/funcs/integrationsSlackInteractions.js";

// Use `MiddayCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const midday = new MiddayCore({
  security: {
    oauth2: process.env["MIDDAY_OAUTH2"] ?? "",
  },
});

async function run() {
  const res = await integrationsSlackInteractions(midday);
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("integrationsSlackInteractions failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.SlackInteractionsResponse>

Errors

Error Type Status Code Content Type
errors.APIError 4XX, 5XX */*

gmailOAuthCallback

Handles OAuth callback from Google after user authorization. Exchanges authorization code for access token and creates inbox account.

Example Usage

import { Midday } from "@midday-ai/sdk";

const midday = new Midday({
  security: {
    oauth2: process.env["MIDDAY_OAUTH2"] ?? "",
  },
});

async function run() {
  const result = await midday.integrations.gmailOAuthCallback({
    state: "Delaware",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MiddayCore } from "@midday-ai/sdk/core.js";
import { integrationsGmailOAuthCallback } from "@midday-ai/sdk/funcs/integrationsGmailOAuthCallback.js";

// Use `MiddayCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const midday = new MiddayCore({
  security: {
    oauth2: process.env["MIDDAY_OAUTH2"] ?? "",
  },
});

async function run() {
  const res = await integrationsGmailOAuthCallback(midday, {
    state: "Delaware",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("integrationsGmailOAuthCallback failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.GmailOAuthCallbackRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.GmailOAuthCallbackResponse>

Errors

Error Type Status Code Content Type
errors.GmailOAuthCallbackBadRequestError 400 application/json
errors.GmailOAuthCallbackInternalServerError 500 application/json
errors.APIError 4XX, 5XX */*

getGmailInstallUrl

Generates OAuth install URL for Gmail integration. Requires authentication.

Example Usage

import { Midday } from "@midday-ai/sdk";

const midday = new Midday({
  security: {
    oauth2: process.env["MIDDAY_OAUTH2"] ?? "",
  },
});

async function run() {
  const result = await midday.integrations.getGmailInstallUrl();

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MiddayCore } from "@midday-ai/sdk/core.js";
import { integrationsGetGmailInstallUrl } from "@midday-ai/sdk/funcs/integrationsGetGmailInstallUrl.js";

// Use `MiddayCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const midday = new MiddayCore({
  security: {
    oauth2: process.env["MIDDAY_OAUTH2"] ?? "",
  },
});

async function run() {
  const res = await integrationsGetGmailInstallUrl(midday);
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("integrationsGetGmailInstallUrl failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.GetGmailInstallUrlResponse>

Errors

Error Type Status Code Content Type
errors.APIError 4XX, 5XX */*

outlookOAuthCallback

Handles OAuth callback from Microsoft after user authorization. Exchanges authorization code for access token and creates inbox account.

Example Usage

import { Midday } from "@midday-ai/sdk";

const midday = new Midday({
  security: {
    oauth2: process.env["MIDDAY_OAUTH2"] ?? "",
  },
});

async function run() {
  const result = await midday.integrations.outlookOAuthCallback({
    state: "New Hampshire",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MiddayCore } from "@midday-ai/sdk/core.js";
import { integrationsOutlookOAuthCallback } from "@midday-ai/sdk/funcs/integrationsOutlookOAuthCallback.js";

// Use `MiddayCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const midday = new MiddayCore({
  security: {
    oauth2: process.env["MIDDAY_OAUTH2"] ?? "",
  },
});

async function run() {
  const res = await integrationsOutlookOAuthCallback(midday, {
    state: "New Hampshire",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("integrationsOutlookOAuthCallback failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.OutlookOAuthCallbackRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.OutlookOAuthCallbackResponse>

Errors

Error Type Status Code Content Type
errors.OutlookOAuthCallbackBadRequestError 400 application/json
errors.OutlookOAuthCallbackInternalServerError 500 application/json
errors.APIError 4XX, 5XX */*

getOutlookInstallUrl

Generates OAuth install URL for Outlook integration. Requires authentication.

Example Usage

import { Midday } from "@midday-ai/sdk";

const midday = new Midday({
  security: {
    oauth2: process.env["MIDDAY_OAUTH2"] ?? "",
  },
});

async function run() {
  const result = await midday.integrations.getOutlookInstallUrl();

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MiddayCore } from "@midday-ai/sdk/core.js";
import { integrationsGetOutlookInstallUrl } from "@midday-ai/sdk/funcs/integrationsGetOutlookInstallUrl.js";

// Use `MiddayCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const midday = new MiddayCore({
  security: {
    oauth2: process.env["MIDDAY_OAUTH2"] ?? "",
  },
});

async function run() {
  const res = await integrationsGetOutlookInstallUrl(midday);
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("integrationsGetOutlookInstallUrl failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.GetOutlookInstallUrlResponse>

Errors

Error Type Status Code Content Type
errors.APIError 4XX, 5XX */*

xeroOAuthCallback

Handles OAuth callback from Xero after user authorization. Exchanges authorization code for access token and creates app integration.

Example Usage

import { Midday } from "@midday-ai/sdk";

const midday = new Midday({
  security: {
    oauth2: process.env["MIDDAY_OAUTH2"] ?? "",
  },
});

async function run() {
  const result = await midday.integrations.xeroOAuthCallback({
    state: "Maryland",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MiddayCore } from "@midday-ai/sdk/core.js";
import { integrationsXeroOAuthCallback } from "@midday-ai/sdk/funcs/integrationsXeroOAuthCallback.js";

// Use `MiddayCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const midday = new MiddayCore({
  security: {
    oauth2: process.env["MIDDAY_OAUTH2"] ?? "",
  },
});

async function run() {
  const res = await integrationsXeroOAuthCallback(midday, {
    state: "Maryland",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("integrationsXeroOAuthCallback failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.XeroOAuthCallbackRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.XeroOAuthCallbackResponse>

Errors

Error Type Status Code Content Type
errors.APIError 4XX, 5XX */*

getXeroInstallUrl

Generates OAuth install URL for Xero integration. Requires authentication.

Example Usage

import { Midday } from "@midday-ai/sdk";

const midday = new Midday({
  security: {
    oauth2: process.env["MIDDAY_OAUTH2"] ?? "",
  },
});

async function run() {
  const result = await midday.integrations.getXeroInstallUrl();

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MiddayCore } from "@midday-ai/sdk/core.js";
import { integrationsGetXeroInstallUrl } from "@midday-ai/sdk/funcs/integrationsGetXeroInstallUrl.js";

// Use `MiddayCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const midday = new MiddayCore({
  security: {
    oauth2: process.env["MIDDAY_OAUTH2"] ?? "",
  },
});

async function run() {
  const res = await integrationsGetXeroInstallUrl(midday);
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("integrationsGetXeroInstallUrl failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.GetXeroInstallUrlResponse>

Errors

Error Type Status Code Content Type
errors.APIError 4XX, 5XX */*

quickBooksOAuthCallback

Handles OAuth callback from QuickBooks after user authorization. Exchanges authorization code for access token and creates app integration.

Example Usage

import { Midday } from "@midday-ai/sdk";

const midday = new Midday({
  security: {
    oauth2: process.env["MIDDAY_OAUTH2"] ?? "",
  },
});

async function run() {
  const result = await midday.integrations.quickBooksOAuthCallback({
    state: "Georgia",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MiddayCore } from "@midday-ai/sdk/core.js";
import { integrationsQuickBooksOAuthCallback } from "@midday-ai/sdk/funcs/integrationsQuickBooksOAuthCallback.js";

// Use `MiddayCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const midday = new MiddayCore({
  security: {
    oauth2: process.env["MIDDAY_OAUTH2"] ?? "",
  },
});

async function run() {
  const res = await integrationsQuickBooksOAuthCallback(midday, {
    state: "Georgia",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("integrationsQuickBooksOAuthCallback failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.QuickBooksOAuthCallbackRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.QuickBooksOAuthCallbackResponse>

Errors

Error Type Status Code Content Type
errors.APIError 4XX, 5XX */*

getQuickBooksInstallUrl

Generates OAuth install URL for QuickBooks integration. Requires authentication.

Example Usage

import { Midday } from "@midday-ai/sdk";

const midday = new Midday({
  security: {
    oauth2: process.env["MIDDAY_OAUTH2"] ?? "",
  },
});

async function run() {
  const result = await midday.integrations.getQuickBooksInstallUrl();

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MiddayCore } from "@midday-ai/sdk/core.js";
import { integrationsGetQuickBooksInstallUrl } from "@midday-ai/sdk/funcs/integrationsGetQuickBooksInstallUrl.js";

// Use `MiddayCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const midday = new MiddayCore({
  security: {
    oauth2: process.env["MIDDAY_OAUTH2"] ?? "",
  },
});

async function run() {
  const res = await integrationsGetQuickBooksInstallUrl(midday);
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("integrationsGetQuickBooksInstallUrl failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.GetQuickBooksInstallUrlResponse>

Errors

Error Type Status Code Content Type
errors.APIError 4XX, 5XX */*

fortnoxOAuthCallback

Handles OAuth callback from Fortnox after user authorization. Exchanges authorization code for access token and creates app integration.

Example Usage

import { Midday } from "@midday-ai/sdk";

const midday = new Midday({
  security: {
    oauth2: process.env["MIDDAY_OAUTH2"] ?? "",
  },
});

async function run() {
  const result = await midday.integrations.fortnoxOAuthCallback({
    state: "South Dakota",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MiddayCore } from "@midday-ai/sdk/core.js";
import { integrationsFortnoxOAuthCallback } from "@midday-ai/sdk/funcs/integrationsFortnoxOAuthCallback.js";

// Use `MiddayCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const midday = new MiddayCore({
  security: {
    oauth2: process.env["MIDDAY_OAUTH2"] ?? "",
  },
});

async function run() {
  const res = await integrationsFortnoxOAuthCallback(midday, {
    state: "South Dakota",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("integrationsFortnoxOAuthCallback failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.FortnoxOAuthCallbackRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.FortnoxOAuthCallbackResponse>

Errors

Error Type Status Code Content Type
errors.APIError 4XX, 5XX */*

getFortnoxInstallUrl

Generates OAuth install URL for Fortnox integration. Requires authentication.

Example Usage

import { Midday } from "@midday-ai/sdk";

const midday = new Midday({
  security: {
    oauth2: process.env["MIDDAY_OAUTH2"] ?? "",
  },
});

async function run() {
  const result = await midday.integrations.getFortnoxInstallUrl();

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MiddayCore } from "@midday-ai/sdk/core.js";
import { integrationsGetFortnoxInstallUrl } from "@midday-ai/sdk/funcs/integrationsGetFortnoxInstallUrl.js";

// Use `MiddayCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const midday = new MiddayCore({
  security: {
    oauth2: process.env["MIDDAY_OAUTH2"] ?? "",
  },
});

async function run() {
  const res = await integrationsGetFortnoxInstallUrl(midday);
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("integrationsGetFortnoxInstallUrl failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.GetFortnoxInstallUrlResponse>

Errors

Error Type Status Code Content Type
errors.APIError 4XX, 5XX */*