Commit Graph

15 Commits

Author SHA1 Message Date
Matthias Beyer af3facfbf0 Add mastodon_async_entities
This patch move the entities module to a helper-crate.

With this, we give the user the opportunity to use only the entities
types in their codebase, if need be.
One scenario where this is required came up in

    https://github.com/dscottboggs/mastodon-async/issues/38

TL;DR is: A user needed to be able to pass types like `Status` from a
backend part of an application to a frontend which was compiled to WASM.
Because mastodon_async depends on tokio, which does not compile to WASM
(at least not with the features required by mastodon_async).

One option would have been to provide types in the application code
which can be constructed from mastodon_asyncs entity types. This would
lead to _a lot_ of code duplication (over several projects still,... but
that's rather undesireable anyways).

The solution mastodon_async offers with this patch is a helper-crate
which only contains the entity types: mastodon_async_entities.

mastodon_async publicly exports the whole mastodon_async_entities crate,
so users do not have to depend on the latter directly.

In addition to the `entities` module from mastodon_async, also the
`Visibility` type had to be moved.

`mastodon_async_entities` also got an own `Error` type, which
`mastodon_async::Error` can of course wrap.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Suggested-by: D. Scott Boggs <scott@tams.tech>
2023-01-04 08:29:52 -05:00
Matthias Beyer c689b8390c Run cargo-fmt on whole codebase
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2022-12-29 07:14:00 -05:00
D. Scott Boggs 5c764185bb Rewrite awkward code 2022-12-28 15:35:39 -05:00
Matthias Beyer 609ddc895b
Fix clippy: Derive Eq for AddFilterRequest
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2022-12-27 19:07:24 +01:00
Matthias Beyer 3f70aba8bd
Fix clippy: Derive Eq for UpdateCredsRequest
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2022-12-27 18:58:29 +01:00
Matthias Beyer 3757ab90b8
Fix clippy: Derive Eq for UpdatePushRequest
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2022-12-27 18:52:16 +01:00
Matthias Beyer 3e7bd2605f
Fix clippy: Derive Eq for AddPushRequest
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2022-12-27 18:51:56 +01:00
Matthias Beyer e0b686fb27
Fix clippy: Derive Eq for Keys
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2022-12-27 18:51:45 +01:00
Matthias Beyer cb4c0c24a9
Fix clippy: Derive Eq for StatusesRequest
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2022-12-27 18:50:58 +01:00
Matthias Beyer 34932cb295
Fix clippy: Implement From instead of Into
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2022-12-27 15:49:55 +01:00
Matthias Beyer 607d86219c
Fix clippy: Remove unneeded clone() calls
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2022-12-27 15:47:42 +01:00
D. Scott Boggs 2ec3bd42ec Rename elefren to mastodon-async 2022-12-23 12:18:03 -05:00
D. Scott Boggs e69d92f71e Update client to work asynchronously
- Use reqwest's async client
 - Convert items_iter() to a futures::Stream
 - make Mastodon client an Arc smart pointer, removing the need for OwnedPage.
 - remove MastodonClient and HttpSender traits; these can be re-added once async trait fns are stabilized
 - make EventStream a futures::Stream
2022-12-05 10:35:29 -05:00
D. Scott Boggs f054c7d805 Update Rust Edition; Update dependencies
Async needs added
2022-11-29 18:50:29 -05:00
D. Scott Boggs 96b16c62d9 initial state; elefren 0.22.0 2022-11-27 09:44:43 -05:00