Skip to main content
Glama
organization.ts904 B
import { ensureMongoDocumentToObject } from '@utils/ensureMongoDocumentToObject'; import type { Organization, OrganizationAPI } from '@/types/organization.types'; /** * Maps an organization to an API response. * @param organization - The organization to map. * @param - Whether the user is an admin of the organization. * @returns The organization mapped to an API response. */ export const mapOrganizationToAPI = < T extends Organization | OrganizationAPI | null, >( organization?: T ): T extends null ? null : OrganizationAPI => { if (!organization) { return null as any; } const organizationObject = ensureMongoDocumentToObject(organization); return organizationObject as any; }; export const mapOrganizationsToAPI = ( organizations: (Organization | OrganizationAPI)[] ): OrganizationAPI[] => organizations.map(mapOrganizationToAPI).filter(Boolean) as OrganizationAPI[];

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aymericzip/intlayer'

If you have feedback or need assistance with the MCP directory API, please join our Discord server