Merge pull request #51 from hexedtech/feat/config-default

feat/config-default
This commit is contained in:
əlemi 2024-10-16 22:33:03 +02:00 committed by GitHub
commit 5457cb1121
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 12 deletions

View file

@ -8,7 +8,7 @@
/// `host`, `port` and `tls` affect all connections to all gRPC services; the /// `host`, `port` and `tls` affect all connections to all gRPC services; the
/// resulting endpoint is composed like this: /// resulting endpoint is composed like this:
/// http{tls?'s':''}://{host}:{port} /// http{tls?'s':''}://{host}:{port}
#[derive(Clone, Debug)] #[derive(Clone, Debug, Default)]
#[cfg_attr(feature = "js", napi_derive::napi(object))] #[cfg_attr(feature = "js", napi_derive::napi(object))]
#[cfg_attr( #[cfg_attr(
any(feature = "py", feature = "py-noabi"), any(feature = "py", feature = "py-noabi"),

View file

@ -7,9 +7,10 @@
//! use codemp::api::controller::{AsyncReceiver, AsyncSender}; // needed for send/recv trait methods //! use codemp::api::controller::{AsyncReceiver, AsyncSender}; // needed for send/recv trait methods
//! //!
//! // connect first, api.code.mp is managed by hexed.technology //! // connect first, api.code.mp is managed by hexed.technology
//! let client = codemp::Client::connect(codemp::api::Config::new( //! let client = codemp::Client::connect(codemp::api::Config {
//! "mail@example.net", "dont-use-this-password" //! username: "mail@example.net".into(), password: "dont-use-this-password".into(),
//! )).await?; //! ..Default::default()
//! }).await?;
//! //!
//! // create and join a workspace //! // create and join a workspace
//! client.create_workspace("some-workspace").await?; //! client.create_workspace("some-workspace").await?;
@ -45,7 +46,8 @@
//! //!
//! // connect first, api.code.mp is managed by hexed.technology //! // connect first, api.code.mp is managed by hexed.technology
//! let client = await codemp.connect({ //! let client = await codemp.connect({
//! username: "mail@example.net", password: "dont-use-this-password" //! username: "mail@example.net",
//! password: "dont-use-this-password"
//! }); //! });
//! //!
//! // create and join a workspace //! // create and join a workspace
@ -80,9 +82,10 @@
//! import codemp //! import codemp
//! //!
//! # connect first, api.code.mp is managed by hexed.technology //! # connect first, api.code.mp is managed by hexed.technology
//! client = codemp.connect( //! client = codemp.connect(codemp.Config(
//! codemp.Config('mail@example.net', 'dont-use-this-password') //! username='mail@example.net',
//! ).wait() //! password='dont-use-this-password'
//! )).wait()
//! //!
//! # create and join a workspace //! # create and join a workspace
//! client.create_workspace("some-workspace").wait() //! client.create_workspace("some-workspace").wait()
@ -128,7 +131,8 @@
//! //!
//! -- connect first, api.code.mp is managed by hexed.technology //! -- connect first, api.code.mp is managed by hexed.technology
//! local client = CODEMP.connect({ //! local client = CODEMP.connect({
//! username = "mail@example.net", password = "dont-use-this-password" //! username = "mail@example.net",
//! password = "dont-use-this-password"
//! }):await() //! }):await()
//! //!
//! -- create and join a workspace //! -- create and join a workspace
@ -165,9 +169,10 @@
//! import mp.code.*; //! import mp.code.*;
//! //!
//! // connect first, api.code.mp is managed by hexed.technology //! // connect first, api.code.mp is managed by hexed.technology
//! Client client = Client.connect( //! Client client = Client.connect(new data.Config(
//! new data.Config("mail@example.net", "dont-use-this-password") //! "mail@example.net",
//! ); //! "dont-use-this-password"
//! ));
//! //!
//! // create and join a workspace //! // create and join a workspace
//! client.createWorkspace("some-workspace"); //! client.createWorkspace("some-workspace");