pub struct InkittClient {
pub story: StoryClient,
/* private fields */
}Expand description
The main asynchronous client for interacting with the Inkitt API.
This client holds the HTTP connection, manages authentication state, and provides access to categorized sub-clients for different parts of the API.
Fields§
§story: StoryClientProvides access to story and part-related API endpoints.
Implementations§
Source§impl InkittClient
impl InkittClient
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new InkittClient with default settings.
This is now a convenience method that uses the builder.
Sourcepub fn builder() -> InkittClientBuilder
pub fn builder() -> InkittClientBuilder
Creates a new builder for configuring a InkittClient.
This is the new entry point for custom client creation.
Sourcepub async fn authenticate(
&self,
email: &str,
password: &str,
) -> Result<LoginResponse, InkittError>
pub async fn authenticate( &self, email: &str, password: &str, ) -> Result<LoginResponse, InkittError>
Authenticates the client using an email and password via the Inkitt API.
§Arguments
email- The Inkitt account email address.password- The Inkitt password.
Sourcepub async fn deauthenticate(&self) -> Result<(), InkittError>
pub async fn deauthenticate(&self) -> Result<(), InkittError>
Deauthenticates the client by logging out from Inkitt.
This method sends a request to the logout endpoint, which invalidates the session
cookies. It then sets the client’s internal authentication state to false.
§Returns
An empty Ok(()) on successful logout.
§Errors
Returns a InkittError if the HTTP request fails.
Sourcepub fn is_authenticated(&self) -> bool
pub fn is_authenticated(&self) -> bool
Checks if the client has been successfully authenticated.
§Returns
true if authenticate has been called successfully, false otherwise.