export type CreateApiMeMessagesMessageIdSendArgs = {'Content-Length'?: number | undefined}; export type CreateApiMeMessagesMessageIdSendOptions = {baseUrl?: string | undefined, azureOAuth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Send draft message * * POST /me/messages/{messageId}/send */ export const createApiMeMessagesMessageIdSend = async (args: CreateApiMeMessagesMessageIdSendArgs, options?: CreateApiMeMessagesMessageIdSendOptions) => { const {baseUrl = "https://graph.microsoft.com/v1.0", fetch: fetchFn = fetch, azureOAuth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['Content-Length'] != null) headers.set("Content-Length", String(args['Content-Length'])) if (azureOAuth2 !== undefined) headers.set('authorization', `Bearer ${azureOAuth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/me/messages/${encodeURIComponent(String(args.messageId))}/send${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };