Commit Graph

16 Commits

Author SHA1 Message Date
D. Scott Boggs e279f4bda7 Switch from the `is_variant` crate to the `derive_is_enum_variant` one. 2023-03-19 11:22:51 -04:00
D. Scott Boggs 6f5a2a5e90 Add is_variant methods to all enums 2023-02-01 15:38:48 -05:00
D. Scott Boggs 2e8f8a4885 Fixes for breaking changes in the toml crate 2023-02-01 08:52:50 -05:00
D. Scott Boggs 77409389ac Drop dependency on serde_qs for now 2023-02-01 07:28:51 -05:00
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 dbbdb8e5c0 Add error variant for when not all bytes are written
cargo-clippy tells us that the `crate::helpers::json::to_writer` and
`crate::helpers::toml::to_writer` functions were implemented without
checking the return value of the `write()` function called inside.

That might lead to serious issues on the user site, if indeed not all
bytes were written.

This patch fixes the issue of the user not knowning about the issue by
introducing a new error variant and returning it in case of unfinished
writes.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2023-01-03 07:13:25 -05:00
D. Scott Boggs f037379d0f drop dependency on hyper-old-types in favor of parse_link_header 2022-12-29 14:06:07 -05:00
D. Scott Boggs 96fbef900e Change error implementation to use thiserror 2022-12-29 13:27:41 -05:00
D. Scott Boggs 4fb24a5a21 Drop the magic bullshit
There were too many false positive responses from libmagic to have this
just happen in the background. In a future release I may add a specific
error which is returned when the given file has no extension, and
downstream application developers can use that as an indicator that they
should ask the user if they want to detect the filetype, making use of
libmagic directly in the downstream application as appropriate.
2022-12-28 08:49:43 -05:00
Matthias Beyer 6389141015
Fix: Use $crate instead of crate in macro
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2022-12-27 15:56:19 +01:00
D. Scott Boggs 6e5c93d997 Fix bug in media upload, add optional detectoin of mime-/file-type 2022-12-26 11:19:54 -05:00
D. Scott Boggs ed497d96d4 Improve remote error handling 2022-12-23 12:18:03 -05:00
D. Scott Boggs ca7f9c86a6 Removed more references to websockets 2022-12-22 12:27: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