Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

9.1 KB
Raw Blame
use crate::api::email::attachments::get::GetAttachmentResponse;
use crate::api::email::attachments::get_document_id::GetAttachmentDocumentIDResponse;
use crate::api::email::backfill::cancel::CancelBackfillParams;
use crate::api::email::backfill::get::{
    GetActiveBackfillJobResponse, GetBackfillJobResponse, ListBackfillJobsResponse,
};
use crate::api::email::contacts::block_sender::BlockSenderRequest;
use crate::api::email::contacts::list::ListContactsResponse;
use crate::api::email::contacts::list_blocked::ListBlockedResponse;
use crate::api::email::contacts::unblock_sender::UnblockSenderRequest;
use crate::api::email::drafts::add_attachment::{
    AddDraftAttachmentRequest, AddDraftAttachmentResponse,
};
use crate::api::email::drafts::add_forwarded_attachment::{
    AddForwardedAttachmentRequest, AddForwardedAttachmentResponse,
};
use crate::api::email::init::{InitErrorCodeResponse, InitResponse, SharedInboxConflictResponse};
use crate::api::email::labels::create::CreateLabelRequest;
use crate::api::email::labels::create::CreateLabelResponse;
use crate::api::email::links::list::ListLinksResponse;
use crate::api::email::links::resync::ResyncResponse;
use crate::api::email::messages::labels::{UpdateLabelBatchRequest, UpdateLabelBatchResponse};
use crate::api::email::settings::patch::{PatchSettingsRequest, PatchSettingsResponse};
use crate::api::email::threads::archived::{
    ArchiveThreadRequest, ArchiveThreadsRequest, ArchiveThreadsResponse,
};
use crate::api::{email, health};
use ::email::inbound;
use ::email::inbound::axum::api_types::{
    ApiDraftContactInfo, ApiDraftInput, ApiDraftOutput, ApiPaginatedThreadCursor, ApiSortMethod,
    ApiThread, CreateDraftRequest as HexCreateDraftRequest,
    CreateDraftResponse as HexCreateDraftResponse, GetThreadResponse,
    SendMessageRequest as HexSendMessageRequest, SendMessageResponse as HexSendMessageResponse,
};
use ::email::inbound::axum::axum_impls::GetPreviewsCursorParams;
use ::email::inbound::axum::email_filter_router::{
    ApiEmailFilter, ListEmailFiltersResponse, UpsertEmailFilterRequest, UpsertEmailFilterResponse,
};
use ::email::inbound::axum::list_labels_router::ListLabelsResponse as HexListLabelsResponse;
use ::email::inbound::axum::thread_labels_router::{
    UpdateThreadLabelRequest, UpdateThreadLabelsResponse,
};
use ::email::inbound::axum::thread_project_router::{
    UpdateThreadProjectRequest, UpdateThreadProjectResponse,
};
use model::response::EmptyResponse;
use models_email::api::link::SyncStatus;
use models_email::api::refresh::{BackfillStatus, RefreshEmailEvent};
use models_email::api::settings::Settings;
use models_email::email::service;
use models_email::email::service::address::ContactInfoWithInteraction;
use models_email::email::service::backfill::BackfillJob;
use models_email::email::service::link::Link;
use models_email::email::service::thread::{PreviewView, PreviewViewStandardLabel};
use models_email::service::label::Label;
use models_email::service::message::ParsedMessage;
use models_email::service::thread::ThreadPreviewCursor;
use utoipa::OpenApi;

#[derive(OpenApi)]
#[openapi(
    info(
        terms_of_service = "https://macro.com/terms",
    ),
    paths(
        crate::api::calendar_invitations::handler,
        crate::api::calendar_invitations::copy_handler,
        crate::api::calendar_event_forward::handler,
        crate::api::read_receipts::pixel,
        crate::api::read_receipts::thread,
        health::health_handler,
        email::attachments::get::handler,
        email::attachments::get_document_id::handler,
        email::backfill::cancel::handler,
        email::backfill::get::handler,
        email::backfill::get::active_handler,
        email::backfill::get::list_handler,
        email::init::handler,
        inbound::axum::draft_router::create_draft_handler,
        inbound::axum::draft_router::resolve_message_operation_handler,
        inbound::axum::draft_router::message_operation_status_handler,
        email::drafts::delete::handler,
        email::drafts::scheduled::list::handler,
        email::drafts::scheduled::remove::handler,
        email::drafts::scheduled::upsert::handler,
        email::drafts::add_attachment::handler,
        email::drafts::complete_attachment::handler,
        email::drafts::transfer::handler,
        email::drafts::transfer::recover,
        email::drafts::remove_attachment::handler,
        email::drafts::add_forwarded_attachment::handler,
        email::drafts::remove_forwarded_attachment::handler,
        email::messages::get::handler,
        email::messages::eml::handler,
        email::messages::get::batch_handler,
        email::messages::labels::handler,
        inbound::axum::send_router::send_message_handler,
        email::threads::seen::seen_handler,
        email::threads::get::get_thread_messages_handler,
        email::threads::archived::archived_handler,
        email::threads::archived::archived_batch_handler,
        inbound::axum::thread_labels_router::update_thread_labels_handler,
        inbound::axum::thread_labels_router::update_thread_state_handler,
        inbound::axum::thread_labels_router::thread_operations_handler,
        inbound::axum::previews_router::cursor_handler,
        inbound::axum::get_thread_router::get_thread_handler,
        inbound::axum::thread_project_router::update_thread_project_handler,
        email::links::list::list_links_handler,
        email::links::health_check::health_check_handler,
        email::links::delete::delete_link_handler,
        email::links::calendar::disable_link_calendar_handler,
        email::links::resync::resync_link_handler,
        email::labels::create::handler,
        email::labels::delete::handler,
        inbound::axum::list_labels_router::list_labels_handler,
        inbound::axum::email_filter_router::upsert_email_filter_handler,
        inbound::axum::email_filter_router::delete_email_filter_handler,
        inbound::axum::email_filter_router::list_email_filters_handler,
        email::contacts::list::list_contacts_handler,
        email::contacts::block_sender::handler,
        email::contacts::unblock_sender::handler,
        email::contacts::list_blocked::handler,
        email::sync::disable::disable_handler,
        email::settings::patch::patch_settings_handler,
        email::settings::operations::handler,
    ),
    components(
        schemas(
            EmptyResponse,
            // Backfill types
            CancelBackfillParams,
            GetBackfillJobResponse,
            GetActiveBackfillJobResponse,
            ListBackfillJobsResponse,
            BackfillJob,
            // Draft types
            HexCreateDraftRequest,
            HexCreateDraftResponse,
            ApiDraftInput,
            ApiDraftOutput,
            ApiDraftContactInfo,
            AddDraftAttachmentRequest,
            AddDraftAttachmentResponse,
            AddForwardedAttachmentRequest,
            AddForwardedAttachmentResponse,
            // Init types
            InitErrorCodeResponse,
            InitResponse,
            SharedInboxConflictResponse,
            // Label types
            CreateLabelRequest,
            CreateLabelResponse,
            HexListLabelsResponse,
            Label,
            // Message types
            UpdateLabelBatchRequest,
            UpdateLabelBatchResponse,
            HexSendMessageRequest,
            HexSendMessageResponse,
            ParsedMessage,
            // Thread types
            ArchiveThreadRequest,
            ArchiveThreadsRequest,
            ArchiveThreadsResponse,
            UpdateThreadLabelRequest,
            UpdateThreadLabelsResponse,
            UpdateThreadProjectRequest,
            UpdateThreadProjectResponse,
            ThreadPreviewCursor,
            GetThreadResponse,
            ApiThread,
            // Preview types
            GetPreviewsCursorParams,
            ApiPaginatedThreadCursor,
            PreviewView,
            PreviewViewStandardLabel,
            // Attachment types
            GetAttachmentResponse,
            GetAttachmentDocumentIDResponse,
            // Link types
            ListLinksResponse,
            Link,
            SyncStatus,
            RefreshEmailEvent,
            BackfillStatus,
            ResyncResponse,
            Settings,
            // Contact types
            ListContactsResponse,
            ContactInfoWithInteraction,
            BlockSenderRequest,
            UnblockSenderRequest,
            ListBlockedResponse,
            // Email filter types
            UpsertEmailFilterRequest,
            UpsertEmailFilterResponse,
            ListEmailFiltersResponse,
            ApiEmailFilter,
            // Sort/filter types
            ApiSortMethod,
            // Legacy service types (keeping for backward compatibility)
            service::thread::ThreadList,
            service::address::ContactInfo,
            service::label::LabelInfo,
            service::attachment::Attachment,
            service::thread::Thread,
            service::message::Message,
            PatchSettingsRequest,
            PatchSettingsResponse
        ),
    ),
    tags(
            (name = "Email Service", description = "Macro Email Service")
    )
)]
pub struct ApiDoc;