Skip to content

Commit

Permalink
Merge pull request #269 from ramsayleung/ramsay_update_doc
Browse files Browse the repository at this point in the history
Update document
  • Loading branch information
marioortizmanero authored Oct 13, 2021
2 parents 1d8c43e + 7a63864 commit 3aa35bf
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 39 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ We use GitHub Actions to make sure the codebase is consistent (`cargo fmt`) and

![](./doc/images/trait_hierarchy.png)

### Crate Hierarchy

![](./doc/images/crate_hierarchy.png)

## Building

Rspotify uses [`maybe_async`](https://docs.rs/maybe-async/0.2.0/maybe_async/) to switch between async and blocking clients, which is triggered inside `Cargo.toml`. So that must be taken into account when building `rspotify`. Read the Configuration section in the docs for more information about how to build with custom TLS implementations, and more.
Expand Down
Binary file added doc/images/crate_hierarchy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/images/trait_hierarchy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions doc/uml/crate_hierarchy.plantuml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@startuml
title Crate Hierarchy
rectangle rspotify-project{

rectangle client[
rspotify
]
rectangle {
rectangle http[
rspotify-http
]
rectangle macros[
rspotify-macros
]
rectangle model[
rspotify-model
]
}
}
client -down-> macros
client -down-> model
client -down-> http

@enduml
78 changes: 39 additions & 39 deletions doc/uml/trait_hierarchy.plantuml
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
@startuml
title Trait Hierarchy
abstract class BaseClient {
<color:green> {abstract} &Config get_config()
<color:green> {abstract} &HttpClient get_http()
<color:green> {abstract} RwLockReadGuard<Option<Token>> get_token()
<color:green> {abstract} RwLockWriteGuard<Option<Token>> get_token_mut()
<color:green> {abstract} &Credentials get_creds()
<color:green> {abstract} ClientResult<Option<Token>> refetch_token()

ClientResult<()> refresh_token()
String endpoint_url()
ClientResult<Headers> auth_headers()
ClientResult<()> write_token_cache()
ClientResult<Token> fetch_access_token()
<color:green>abstract</color> {abstract} &Config get_config()
<color:green>abstract</color> {abstract} &HttpClient get_http()
<color:green>abstract</color> {abstract} Arc<Mutex<Option<Token>>> get_token()
<color:green>abstract</color> {abstract} &Credentials get_creds()
<color:green>abstract</color> {abstract} ClientResult<Option<Token>> refetch_token()
---
ClientResult<()> auto_reauth()
ClientResult<()> refresh_token()
String endpoint_url()
ClientResult<Headers> auth_headers()
ClientResult<()> write_token_cache()
ClientResult<Token> fetch_access_token()
}

abstract class OAuthClient extends BaseClient{
<color:green> {abstract} {abstract} &OAuth get_oauth()
<color:green> {abstract} {abstract} ClientResult<()> request_token()

ClientResult<()> auto_reauth()
<color:green>abstract</color> {abstract} &OAuth get_oauth()
<color:green>abstract</color> {abstract} ClientResult<()> request_token()
---
Option<Token> read_token_cache()
}

class AuthCodeSpotify implements OAuthClient{
&Config get_config()
&HttpClient get_http()
RwLockReadGuard<Option<Token>> get_token()
RwLockWriteGuard<Option<Token>> get_token_mut()
&Credentials get_creds()
ClientResult<Option<Token>> refetch_token()

&OAuth get_oauth()
ClientResult<()> request_token()
&Config get_config()
&HttpClient get_http()
RwLockReadGuard<Option<Token>> get_token()
RwLockWriteGuard<Option<Token>> get_token_mut()
&Credentials get_creds()
ClientResult<Option<Token>> refetch_token()
---
&OAuth get_oauth()
ClientResult<()> request_token()
}

class AuthCodePkceSpotify implements OAuthClient{
&Config get_config()
&HttpClient get_http()
RwLockReadGuard<Option<Token>> get_token()
RwLockWriteGuard<Option<Token>> get_token_mut()
&Credentials get_creds()
ClientResult<Option<Token>> refetch_token()

&OAuth get_oauth()
ClientResult<()> request_token()
&HttpClient get_http()
RwLockReadGuard<Option<Token>> get_token()
RwLockWriteGuard<Option<Token>> get_token_mut()
&Credentials get_creds()
ClientResult<Option<Token>> refetch_token()
---
&OAuth get_oauth()
ClientResult<()> request_token()
}

class ClientCredsSpotify implements BaseClient{
&Config get_config()
&HttpClient get_http()
RwLockReadGuard<Option<Token>> get_token()
RwLockWriteGuard<Option<Token>> get_token_mut()
&Credentials get_creds()
ClientResult<Option<Token>> refetch_token()
&Config get_config()
&HttpClient get_http()
RwLockReadGuard<Option<Token>> get_token()
RwLockWriteGuard<Option<Token>> get_token_mut()
&Credentials get_creds()
ClientResult<Option<Token>> refetch_token()
---
}
@enduml

0 comments on commit 3aa35bf

Please sign in to comment.