Commit Graph

11 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
D. Scott Boggs 96fbef900e Change error implementation to use thiserror 2022-12-29 13:27:41 -05:00
Matthias Beyer 2ac63466d1
Fix clippy: Derive Eq for NewStatus
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2022-12-27 18:50:12 +01:00
Matthias Beyer 1a8524f4fe
Fix clippy: Derive Eq for StatusBuilder
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2022-12-27 18:48:52 +01:00
Matthias Beyer 781b8a0b2e
Fix clippy: Derive Eq for Visibility
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2022-12-27 18:48:14 +01:00
Matthias Beyer e19070f935
Fix clippy: Remove unneeded clone() call
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2022-12-27 15:44:07 +01:00
D. Scott Boggs 2ec3bd42ec Rename elefren to mastodon-async 2022-12-23 12:18:03 -05:00
D. Scott Boggs c811f42054 misc fixups 2022-12-18 16:06:30 -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