lib

Core libraries for Radroots
git clone https://radroots.dev/git/lib.git
Log | Files | Refs | README | LICENSE

lib.rs (4723B)


      1 #![cfg_attr(not(feature = "std"), no_std)]
      2 
      3 extern crate alloc;
      4 
      5 #[cfg(feature = "client")]
      6 pub mod client;
      7 
      8 pub mod error;
      9 pub mod events;
     10 pub mod filter;
     11 pub mod parse;
     12 #[cfg(feature = "client")]
     13 pub mod relays;
     14 pub mod tags;
     15 pub mod types;
     16 pub mod util;
     17 
     18 #[cfg(test)]
     19 mod test_fixtures;
     20 
     21 #[cfg(feature = "codec")]
     22 pub mod codec_adapters;
     23 
     24 #[cfg(feature = "codec")]
     25 pub mod job_adapter;
     26 
     27 #[cfg(feature = "nip17")]
     28 pub mod nip17;
     29 
     30 #[cfg(feature = "http")]
     31 pub mod nip11;
     32 
     33 #[cfg(feature = "events")]
     34 pub mod event_adapters;
     35 
     36 #[cfg(feature = "events")]
     37 pub mod draft_signing;
     38 #[cfg(feature = "events")]
     39 pub mod event_convert;
     40 #[cfg(feature = "events")]
     41 pub mod event_verify;
     42 
     43 #[cfg(all(feature = "client", feature = "codec"))]
     44 pub mod identity_profile;
     45 
     46 pub mod prelude {
     47     pub use crate::events::radroots_nostr_build_event;
     48 
     49     #[cfg(feature = "client")]
     50     pub use crate::client::{
     51         RadrootsNostrClient, RadrootsNostrClientOptions, radroots_nostr_fetch_event_by_id,
     52         radroots_nostr_send_event,
     53     };
     54 
     55     pub use crate::error::{RadrootsNostrError, RadrootsNostrTagsResolveError};
     56     pub use crate::filter::{
     57         radroots_nostr_filter_kind, radroots_nostr_filter_new_events, radroots_nostr_filter_tag,
     58         radroots_nostr_kind,
     59     };
     60 
     61     pub use crate::events::{
     62         jobs::{radroots_nostr_build_event_job_feedback, radroots_nostr_build_event_job_result},
     63         metadata::radroots_nostr_build_metadata_event,
     64         post::{
     65             radroots_nostr_build_post_event, radroots_nostr_build_post_reply_event,
     66             radroots_nostr_post_events_filter,
     67         },
     68     };
     69 
     70     #[cfg(feature = "events")]
     71     pub use crate::events::application_handler::{
     72         RadrootsNostrApplicationHandlerSpec, radroots_nostr_build_application_handler_event,
     73         radroots_nostr_metadata_has_fields,
     74     };
     75 
     76     #[cfg(all(feature = "client", feature = "events"))]
     77     pub use crate::events::application_handler::radroots_nostr_publish_application_handler;
     78 
     79     #[cfg(feature = "client")]
     80     pub use crate::events::metadata::{
     81         radroots_nostr_fetch_metadata_for_author, radroots_nostr_post_metadata_event,
     82     };
     83 
     84     #[cfg(all(feature = "client", feature = "codec"))]
     85     pub use crate::identity_profile::{
     86         radroots_nostr_publish_identity_profile, radroots_nostr_publish_identity_profile_with_type,
     87     };
     88 
     89     #[cfg(all(feature = "client", feature = "codec", feature = "events"))]
     90     pub use crate::identity_profile::radroots_nostr_bootstrap_service_presence;
     91 
     92     #[cfg(all(feature = "client", feature = "events"))]
     93     pub use crate::events::post::radroots_nostr_fetch_post_events;
     94 
     95     pub use crate::parse::{radroots_nostr_parse_pubkey, radroots_nostr_parse_pubkeys};
     96     #[cfg(feature = "client")]
     97     pub use crate::relays::{
     98         radroots_nostr_add_relay, radroots_nostr_connect, radroots_nostr_remove_relay,
     99     };
    100     pub use crate::tags::*;
    101     pub use crate::types::{
    102         RadrootsNostrCoordinate, RadrootsNostrEvent, RadrootsNostrEventBuilder,
    103         RadrootsNostrEventId, RadrootsNostrFilter, RadrootsNostrFromBech32, RadrootsNostrKeys,
    104         RadrootsNostrKind, RadrootsNostrMetadata, RadrootsNostrPublicKey, RadrootsNostrRelayUrl,
    105         RadrootsNostrSecp256k1SecretKey, RadrootsNostrSecretKey, RadrootsNostrSubscriptionId,
    106         RadrootsNostrTag, RadrootsNostrTagKind, RadrootsNostrTagStandard, RadrootsNostrTimestamp,
    107         RadrootsNostrToBech32, RadrootsNostrUrl,
    108     };
    109     #[cfg(feature = "client")]
    110     pub use crate::types::{
    111         RadrootsNostrMonitor, RadrootsNostrMonitorNotification, RadrootsNostrOutput,
    112         RadrootsNostrRelay, RadrootsNostrRelayPoolNotification, RadrootsNostrRelayStatus,
    113         RadrootsNostrSubscribeAutoCloseOptions,
    114     };
    115     pub use crate::util::radroots_nostr_npub_string;
    116 
    117     #[cfg(feature = "nip17")]
    118     pub use crate::nip17::{
    119         RadrootsNip17Error, RadrootsNip17Rumor, RadrootsNip17WrapOptions,
    120         radroots_nostr_unwrap_gift_wrap, radroots_nostr_wrap_message,
    121         radroots_nostr_wrap_message_file,
    122     };
    123 
    124     #[cfg(feature = "http")]
    125     pub use crate::nip11::fetch_nip11;
    126 
    127     #[cfg(feature = "events")]
    128     pub use crate::event_adapters::{to_post_event_metadata, to_profile_event_metadata};
    129 
    130     #[cfg(feature = "events")]
    131     pub use crate::draft_signing::radroots_nostr_sign_frozen_draft;
    132 
    133     #[cfg(feature = "events")]
    134     pub use crate::event_convert::{radroots_event_from_nostr, radroots_event_ptr_from_nostr};
    135 
    136     #[cfg(feature = "events")]
    137     pub use crate::event_verify::{
    138         RadrootsNostrEventVerification, radroots_nostr_verify_event, radroots_nostr_verify_event_id,
    139     };
    140 
    141     #[cfg(feature = "codec")]
    142     pub use crate::job_adapter::RadrootsNostrEventAdapter;
    143 }