|
4 | 4 | // ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import
|
5 | 5 |
|
6 | 6 | import '../../frb_generated.dart';
|
| 7 | +import '../relay/options.dart'; |
7 | 8 | import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
|
8 | 9 |
|
9 |
| -// These types are ignored because they are not used by any `pub` functions: `_ConnectionTarget` |
10 |
| -// These function are ignored because they are on traits that is not defined in current crate (put an empty `#[frb]` on it to unignore): `deref`, `deref`, `from`, `from` |
11 |
| -// These functions have error during generation (see debug logs or enable `stop_on_error: true` for more details): `addr`, `autoconnect`, `automatic_authentication`, `connection`, `embedded_tor_with_path`, `embedded_tor`, `gossip`, `min_pow`, `mode`, `target` |
| 10 | +// These function are ignored because they are on traits that is not defined in current crate (put an empty `#[frb]` on it to unignore): `deref`, `from`, `from` |
12 | 11 |
|
13 | 12 | // Rust type: RustOpaqueMoi<flutter_rust_bridge::for_generated::RustAutoOpaqueInner<_ClientOptions>>
|
14 | 13 | abstract class ClientOptions implements RustOpaqueInterface {
|
| 14 | + /// Automatically start connection with relays (default: false) |
| 15 | + /// |
| 16 | + /// When set to `true`, there isn't the need of calling the connect methods. |
| 17 | + ClientOptions autoconnect({required bool val}); |
| 18 | + |
| 19 | + /// Auto authenticate to relays (default: true) |
| 20 | + /// |
| 21 | + /// <https://github.com/nostr-protocol/nips/blob/master/42.md> |
| 22 | + ClientOptions automaticAuthentication({required bool enabled}); |
| 23 | + |
| 24 | + /// Connection |
| 25 | + ClientOptions connection({required Connection connection}); |
| 26 | + |
| 27 | + /// Enable gossip model (default: false) |
| 28 | + ClientOptions gossip({required bool enabled}); |
| 29 | + |
| 30 | + /// Minimum POW difficulty for received events |
| 31 | + ClientOptions minPow({required int difficulty}); |
| 32 | + |
15 | 33 | factory ClientOptions() =>
|
16 | 34 | NostrSdk.instance.api.crateApiClientOptionsClientOptionsNew();
|
17 | 35 | }
|
18 | 36 |
|
19 | 37 | // Rust type: RustOpaqueMoi<flutter_rust_bridge::for_generated::RustAutoOpaqueInner<_Connection>>
|
20 | 38 | abstract class Connection implements RustOpaqueInterface {
|
| 39 | + /// Set proxy (ex. `127.0.0.1:9050`) |
| 40 | + Connection addr({required String addr}); |
| 41 | + |
| 42 | + /// Use embedded tor client |
| 43 | + /// |
| 44 | + /// This not work on `android` and/or `ios` targets. |
| 45 | + /// Use [`Connection::embedded_tor_with_path`] instead. |
| 46 | + Connection embeddedTor(); |
| 47 | + |
| 48 | + /// Use embedded tor client |
| 49 | + /// |
| 50 | + /// Specify a path where to store data |
| 51 | + Connection embeddedTorWithPath({required String dataPath}); |
| 52 | + |
| 53 | + /// Set connection mode (default: direct) |
| 54 | + Connection mode({required ConnectionMode mode}); |
| 55 | + |
21 | 56 | factory Connection() =>
|
22 | 57 | NostrSdk.instance.api.crateApiClientOptionsConnectionNew();
|
| 58 | + |
| 59 | + /// Set connection target (default: all) |
| 60 | + Connection target({required ConnectionTarget target}); |
| 61 | +} |
| 62 | + |
| 63 | +/// Connection target |
| 64 | +enum ConnectionTarget { |
| 65 | + /// Use proxy for all relays |
| 66 | + all, |
| 67 | + |
| 68 | + /// Use proxy only for `.onion` relays |
| 69 | + onion, |
| 70 | + ; |
23 | 71 | }
|
0 commit comments