(teams)
Manage teams
Retrieve a list of teams for the authenticated user.
import { Midday } from "@midday-ai/sdk";
const midday = new Midday({
security: {
oauth2: process.env["MIDDAY_OAUTH2"] ?? "",
},
});
async function run() {
const result = await midday.teams.list();
console.log(result);
}
run();The standalone function version of this method:
import { MiddayCore } from "@midday-ai/sdk/core.js";
import { teamsList } from "@midday-ai/sdk/funcs/teamsList.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 teamsList(midday);
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("teamsList failed:", res.error);
}
}
run();| 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. |
Promise<operations.ListTeamsResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.APIError | 4XX, 5XX | */* |
Retrieve a team by its ID for the authenticated team.
import { Midday } from "@midday-ai/sdk";
const midday = new Midday({
security: {
oauth2: process.env["MIDDAY_OAUTH2"] ?? "",
},
});
async function run() {
const result = await midday.teams.get({
id: "123e4567-e89b-12d3-a456-426614174000",
});
console.log(result);
}
run();The standalone function version of this method:
import { MiddayCore } from "@midday-ai/sdk/core.js";
import { teamsGet } from "@midday-ai/sdk/funcs/teamsGet.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 teamsGet(midday, {
id: "123e4567-e89b-12d3-a456-426614174000",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("teamsGet failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetTeamByIdRequest | ✔️ | 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. |
Promise<operations.GetTeamByIdResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.APIError | 4XX, 5XX | */* |
Update a team for the authenticated workspace. If there’s no change, returns it as it is.
import { Midday } from "@midday-ai/sdk";
const midday = new Midday({
security: {
oauth2: process.env["MIDDAY_OAUTH2"] ?? "",
},
});
async function run() {
const result = await midday.teams.update({
id: "123e4567-e89b-12d3-a456-426614174000",
requestBody: {
name: "Acme Corporation",
email: "team@acme.com",
logoUrl: "https://cdn.midday.ai/logos/acme-corp.png",
baseCurrency: "USD",
countryCode: "US",
fiscalYearStartMonth: 4,
companyType: "solo_founder",
heardAbout: "twitter",
},
});
console.log(result);
}
run();The standalone function version of this method:
import { MiddayCore } from "@midday-ai/sdk/core.js";
import { teamsUpdate } from "@midday-ai/sdk/funcs/teamsUpdate.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 teamsUpdate(midday, {
id: "123e4567-e89b-12d3-a456-426614174000",
requestBody: {
name: "Acme Corporation",
email: "team@acme.com",
logoUrl: "https://cdn.midday.ai/logos/acme-corp.png",
baseCurrency: "USD",
countryCode: "US",
fiscalYearStartMonth: 4,
companyType: "solo_founder",
heardAbout: "twitter",
},
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("teamsUpdate failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.UpdateTeamByIdRequest | ✔️ | 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. |
Promise<operations.UpdateTeamByIdResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.APIError | 4XX, 5XX | */* |
List all team members for the authenticated team.
import { Midday } from "@midday-ai/sdk";
const midday = new Midday({
security: {
oauth2: process.env["MIDDAY_OAUTH2"] ?? "",
},
});
async function run() {
const result = await midday.teams.members({
id: "123e4567-e89b-12d3-a456-426614174000",
});
console.log(result);
}
run();The standalone function version of this method:
import { MiddayCore } from "@midday-ai/sdk/core.js";
import { teamsMembers } from "@midday-ai/sdk/funcs/teamsMembers.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 teamsMembers(midday, {
id: "123e4567-e89b-12d3-a456-426614174000",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("teamsMembers failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.ListTeamMembersRequest | ✔️ | 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. |
Promise<operations.ListTeamMembersResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.APIError | 4XX, 5XX | */* |