Skip to content

Commit

Permalink
Merge pull request #42 from unbekanntes-pferd/feature/0.16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
unbekanntes-pferd authored Sep 18, 2024
2 parents 685e3a3 + 16b6079 commit 4ce7b1b
Show file tree
Hide file tree
Showing 12 changed files with 568 additions and 197 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dco3"
version = "0.15.1"
version = "0.16.0"
edition = "2021"
authors = ["Octavio Simone"]
repository = "https://github.com/unbekanntes-pferd/dco3"
Expand Down
3 changes: 2 additions & 1 deletion src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ pub const SHARES_UPLOAD: &str = "uploads";
pub const SHARES_DOWNLOAD: &str = "downloads";

// DEFAULTS
pub const DEFAULT_CHUNK_SIZE: usize = 1024 * 1024 * 32; // 32 MB
pub const DEFAULT_UPLOAD_CHUNK_SIZE: usize = 1024 * 1024 * 32; // 32 MB
pub const DEFAULT_DOWNLOAD_CHUNK_SIZE: usize = 1024 * 1024 * 1024; // 1 GB
pub const DEFAULT_UPLOAD_GRANULARITY: usize = 1024; // default upload stream granularity
pub const POLLING_START_DELAY: u64 = 300;
// defines how many keys (users) distributed per file on upload
Expand Down
33 changes: 18 additions & 15 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -735,9 +735,15 @@ impl Dracoon<Connected> {
}

impl Dracoon<Provisioning> {
/// Returns the service token for provisioning
pub fn get_service_token(&self) -> String {
self.client.get_service_token()
}

/// Returns endpoint for all provisioning routes `/api/v4/provisioning`
pub fn provisioning(&self) -> &ProvisioningEndpoint<Provisioning> {
&self.endpoints.provisioning
}
}

impl<S> Dracoon<S> {
Expand All @@ -753,59 +759,56 @@ impl<S: ConnectedClient> Dracoon<S> {
.join(url_part)
.expect("Invalid base url")
}
}

impl Dracoon<Connected> {
/// Returns endpoint for all config routes `/api/v4/config`
pub fn config(&self) -> &ConfigEndpoint<S> {
pub fn config(&self) -> &ConfigEndpoint<Connected> {
&self.endpoints.config
}

/// Returns endpoint for all eventlog routes `/api/v4/eventlog`
pub fn eventlog(&self) -> &EventlogEndpoint<S> {
pub fn eventlog(&self) -> &EventlogEndpoint<Connected> {
&self.endpoints.eventlog
}

/// Returns endpoint for all groups routes `/api/v4/groups`
pub fn groups(&self) -> &GroupsEndpoint<S> {
pub fn groups(&self) -> &GroupsEndpoint<Connected> {
&self.endpoints.groups
}

/// Returns endpoint for all nodes routes `/api/v4/nodes`
pub fn nodes(&self) -> &NodesEndpoint<S> {
pub fn nodes(&self) -> &NodesEndpoint<Connected> {
&self.endpoints.nodes
}

/// Returns endpoint for all roles routes `/api/v4/roles`
pub fn roles(&self) -> &RolesEndpoint<S> {
pub fn roles(&self) -> &RolesEndpoint<Connected> {
&self.endpoints.roles
}

/// Returns endpoint for all settings routes `/api/v4/settings`
pub fn settings(&self) -> &SettingsEndpoint<S> {
pub fn settings(&self) -> &SettingsEndpoint<Connected> {
&self.endpoints.settings
}

/// Returns endpoint for all shares routes `/api/v4/shares`
pub fn shares(&self) -> &SharesEndpoint<S> {
pub fn shares(&self) -> &SharesEndpoint<Connected> {
&self.endpoints.shares
}

/// Returns endpoint for all system routes `/api/v4/system`
pub fn system(&self) -> &SystemEndpoint<S> {
pub fn system(&self) -> &SystemEndpoint<Connected> {
&self.endpoints.system
}

/// Returns endpoint for all provisioning routes `/api/v4/provisioning`
pub fn provisioning(&self) -> &ProvisioningEndpoint<S> {
&self.endpoints.provisioning
}

/// Returns endpoint for all user routes `/api/v4/user`
pub fn user(&self) -> &UserEndpoint<S> {
pub fn user(&self) -> &UserEndpoint<Connected> {
&self.endpoints.user
}

/// Returns endpoint for all users routes `/api/v4/users`
pub fn users(&self) -> &UsersEndpoint<S> {
pub fn users(&self) -> &UsersEndpoint<Connected> {
&self.endpoints.users
}
}
Expand Down
Loading

0 comments on commit 4ce7b1b

Please sign in to comment.