acter/
api.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
use anyhow::Result;
use futures::Stream;
use lazy_static::lazy_static;
use tokio::runtime::Runtime;

use crate::platform;

#[no_mangle]
pub extern "C" fn __hello_world() {
    // DO NOT REMOVE.
    // empty external linking helper, noop but needed for
    // iOS to properly link the headers and lib into
    // the binary.
    // DO NOT REMOVE.
}

lazy_static! {
    pub static ref RUNTIME: Runtime = Runtime::new().expect("Can’t start Tokio runtime");
}

mod account;
mod attachments;
mod auth;
mod backup;
mod bookmarks;
mod calendar_events;
mod categories;
mod client;
mod comments;
mod common;
mod convo;
mod deep_linking;
mod device;
mod invitation;
mod message;
mod news;
mod pins;
mod profile;
mod push;
mod reactions;
mod room;
mod rsvp;
mod search;
mod settings;
mod spaces;
mod stories;
mod stream;
mod super_invites;
mod tasks;
mod typing;
mod utils;
mod verification;

pub mod read_receipts;
#[cfg(feature = "uniffi")]
mod uniffi_api;

#[cfg(feature = "uniffi")]
pub use uniffi_api::*;

pub use account::{Account, ExternalId, ThreePidEmailTokenResponse};
pub use acter_core::{
    events::{
        calendar::EventLocationInfo, news::NewsContent, stories::StoryContent, Category,
        CategoryBuilder, Colorize, ColorizeBuilder, Display, DisplayBuilder, ObjRef, ObjRefBuilder,
        RefDetails, RefDetailsBuilder, UtcDateTime,
    },
    models::{ActerModel, Tag, TextMessageContent},
};
pub use attachments::{Attachment, AttachmentDraft, AttachmentsManager};
pub use auth::{
    destroy_local_data, guest_client, login_new_client, login_with_token, register_with_token,
    request_password_change_token_via_email, request_registration_token_via_email, reset_password,
    set_proxy, PasswordChangeEmailTokenResponse, RegistrationTokenViaEmailResponse,
};
#[cfg(feature = "testing")]
pub use auth::{
    login_new_client_under_config, login_with_token_under_config, make_client_config,
    register_under_config, register_with_token_under_config, sanitize_user,
};
pub use backup::BackupManager;
pub use bookmarks::Bookmarks;
pub use calendar_events::{CalendarEvent, CalendarEventDraft, CalendarEventUpdateBuilder};
pub use categories::{Categories, CategoriesBuilder};
pub use client::{Client, ClientStateBuilder, HistoryLoadState, SyncState};
pub use comments::{Comment, CommentDraft, CommentsManager};
pub use common::{
    duration_from_secs, new_calendar_event_ref_builder, new_colorize_builder, new_display_builder,
    new_link_ref_builder, new_obj_ref_builder, new_pin_ref_builder, new_task_list_ref_builder,
    new_task_ref_builder, new_thumb_size, ComposeDraft, DeviceRecord, MediaSource, MsgContent,
    OptionBuffer, OptionComposeDraft, OptionRsvpStatus, OptionString, ReactionRecord,
    ThumbnailInfo, ThumbnailSize,
};
pub use convo::{
    new_convo_settings_builder, Convo, ConvoDiff, CreateConvoSettings, CreateConvoSettingsBuilder,
};
pub use core::time::Duration as EfkDuration;
pub use device::DeviceEvent;
pub use invitation::Invitation;
pub use message::{EventSendState, RoomEventItem, RoomMessage, RoomVirtualItem};
pub use news::{NewsEntry, NewsEntryDraft, NewsEntryUpdateBuilder, NewsSlide, NewsSlideDraft};
pub use pins::{Pin as ActerPin, PinDraft, PinUpdateBuilder};
pub use profile::UserProfile;
pub use push::{
    NotificationItem, NotificationRoom, NotificationSender, NotificationSettings, Pusher,
};
pub use reactions::{Reaction, ReactionManager};
pub use read_receipts::ReadReceiptsManager;
pub use room::{
    new_join_rule_builder, JoinRuleBuilder, Member, MemberPermission, MembershipStatus, Room,
    SpaceHierarchyRoomInfo, SpaceRelation, SpaceRelations,
};
pub use rsvp::{Rsvp, RsvpDraft, RsvpManager, RsvpStatus};
pub use search::{PublicSearchResult, PublicSearchResultItem};
pub use settings::{
    ActerAppSettings, ActerAppSettingsBuilder, ActerUserAppSettings, ActerUserAppSettingsBuilder,
    EventsSettings, NewsSettings, PinsSettings, RoomPowerLevels, SimpleOnOffSetting,
    SimpleOnOffSettingBuilder, SimpleSettingWithTurnOff, SimpleSettingWithTurnOffBuilder,
    TasksSettings,
};
pub use spaces::{
    new_space_settings_builder, CreateSpaceSettings, CreateSpaceSettingsBuilder,
    RelationTargetType, Space, SpaceDiff,
};
pub use stories::{Story, StoryDraft, StorySlide, StorySlideDraft, StoryUpdateBuilder};
pub use stream::{MsgDraft, RoomMessageDiff, TimelineStream};
pub use super_invites::{
    SuperInviteInfo, SuperInviteToken, SuperInvites, SuperInvitesTokenUpdateBuilder,
};
pub use tasks::{
    Task, TaskDraft, TaskList, TaskListDraft, TaskListUpdateBuilder, TaskUpdateBuilder,
};
pub use typing::TypingEvent;
pub use utils::parse_markdown;
pub use verification::{SessionManager, VerificationEmoji, VerificationEvent};

pub type DeviceId = matrix_sdk_base::ruma::OwnedDeviceId;
pub type EventId = matrix_sdk_base::ruma::OwnedEventId;
pub type MxcUri = matrix_sdk_base::ruma::OwnedMxcUri;
pub type RoomId = matrix_sdk_base::ruma::OwnedRoomId;
pub type UserId = matrix_sdk_base::ruma::OwnedUserId;

#[cfg(all(not(doctest), feature = "dart"))]
ffi_gen_macro::ffi_gen!("native/acter/api.rsh");

#[cfg(not(all(not(doctest), feature = "dart")))]
#[allow(clippy::module_inception)]
mod api {
    /// helpers for doctests, as ffigen for some reason can’t find the path
    pub struct FfiBuffer<T>(Vec<T>);
    impl<T> FfiBuffer<T> {
        pub fn new(inner: Vec<T>) -> FfiBuffer<T> {
            FfiBuffer(inner)
        }
    }
}
// reexport
pub use platform::{init_logging, rotate_log_file, would_log, write_log};