Skip to content

Latest commit

 

History

History
402 lines (298 loc) · 29.5 KB

File metadata and controls

402 lines (298 loc) · 29.5 KB

Inbox

(inbox)

Overview

Manage inbox items

Available Operations

  • list - List all inbox items
  • get - Retrieve a inbox item
  • delete - Delete a inbox item
  • update - Update a inbox item
  • getPreSignedUrl - Generate pre-signed URL for inbox attachment

list

Retrieve a list of inbox items for the authenticated team.

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.inbox.list({});

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MiddayCore } from "@midday-ai/sdk/core.js";
import { inboxList } from "@midday-ai/sdk/funcs/inboxList.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 inboxList(midday, {});
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("inboxList failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.ListInboxItemsRequest ✔️ 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.ListInboxItemsResponse>

Errors

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

get

Retrieve a inbox item by its unique identifier for the authenticated team.

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.inbox.get({
    id: "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MiddayCore } from "@midday-ai/sdk/core.js";
import { inboxGet } from "@midday-ai/sdk/funcs/inboxGet.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 inboxGet(midday, {
    id: "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("inboxGet failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.GetInboxItemByIdRequest ✔️ 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.GetInboxItemByIdResponse>

Errors

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

delete

Delete a inbox item by its unique identifier for the authenticated team.

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.inbox.delete({
    id: "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MiddayCore } from "@midday-ai/sdk/core.js";
import { inboxDelete } from "@midday-ai/sdk/funcs/inboxDelete.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 inboxDelete(midday, {
    id: "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("inboxDelete failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.DeleteInboxItemRequest ✔️ 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.DeleteInboxItemResponse>

Errors

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

update

Update fields of an inbox item by its unique identifier for the authenticated team.

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.inbox.update({
    id: "<id>",
    requestBody: {},
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MiddayCore } from "@midday-ai/sdk/core.js";
import { inboxUpdate } from "@midday-ai/sdk/funcs/inboxUpdate.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 inboxUpdate(midday, {
    id: "<id>",
    requestBody: {},
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("inboxUpdate failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.UpdateInboxItemRequest ✔️ 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.UpdateInboxItemResponse>

Errors

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

getPreSignedUrl

Generate a pre-signed URL for accessing an inbox attachment. The URL is valid for 60 seconds and allows secure temporary access to the attachment file.

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.inbox.getPreSignedUrl({
    id: "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4",
    download: true,
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MiddayCore } from "@midday-ai/sdk/core.js";
import { inboxGetPreSignedUrl } from "@midday-ai/sdk/funcs/inboxGetPreSignedUrl.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 inboxGetPreSignedUrl(midday, {
    id: "b3b7c1e2-4c2a-4e7a-9c1a-2b7c1e24c2a4",
    download: true,
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("inboxGetPreSignedUrl failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.GetInboxPreSignedUrlRequest ✔️ 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.GetInboxPreSignedUrlResponse>

Errors

Error Type Status Code Content Type
errors.GetInboxPreSignedUrlBadRequestError 400 application/json
errors.GetInboxPreSignedUrlNotFoundError 404 application/json
errors.GetInboxPreSignedUrlInternalServerError 500 application/json
errors.APIError 4XX, 5XX */*