Commit Graph

174 Commits

Author SHA1 Message Date
D. Scott Boggs 8abf4950f9 Test the whole workspace 2023-01-24 15:33:49 -05:00
D. Scott Boggs e662eac46a Fix routes which take an Id type; fix doctests 2023-01-24 15:33:49 -05:00
D. Scott Boggs 53fc05d36f Add Id types to prelude and entities prelude to crate prelude 2023-01-24 15:33:49 -05:00
D. Scott Boggs be39ca6e24 Implement std::format::Display for all Id types 2023-01-24 15:33:49 -05:00
D. Scott Boggs eeac76c750 Add CI jobs to comb branch 2023-01-24 15:33:49 -05:00
D. Scott Boggs ef28d8367f Add note pointing to more complete example. 2023-01-21 05:33:41 -05:00
Sprite 2301fda307 Fix errors caused by sync locks crossing `await` in `cli::authenticate` 2023-01-20 16:55:26 -05:00
kuna 9084c1fcaa Update docs for Registration::new_with_client
Co-authored-by: Scott Boggs <dscottboggs@gmail.com>
2023-01-14 16:28:05 -05:00
baummarten d94bcd45d2 Mastodon::new now wraps Mastodon::new_with_client 2023-01-14 16:28:05 -05:00
baummarten 72d158513c Registration::new_with_client
Registration can now be created with a custom Reqwest Client.
2023-01-14 16:28:05 -05:00
D. Scott Boggs c93e5a5020 Add static assertions 2023-01-09 09:03:21 -05:00
D. Scott Boggs fcc2035b46 Add constructors for ID types 2023-01-09 09:03:21 -05:00
D. Scott Boggs 876ac3b985 Add Mention ID type 2023-01-09 09:03:21 -05:00
D. Scott Boggs 6d8a9d6194 Add List ID type 2023-01-09 09:03:21 -05:00
D. Scott Boggs 6e044c3f35 Use `impl AsRef<str>` instead of `&str` to work with new ID types 2023-01-09 09:03:21 -05:00
D. Scott Boggs 06caec85b3 Add ID type for reports 2023-01-09 09:03:21 -05:00
D. Scott Boggs d4e7c4b59b Add ID type for relationships 2023-01-09 09:03:21 -05:00
D. Scott Boggs f4ef3c27ab Add ID type for pushes 2023-01-09 09:03:21 -05:00
D. Scott Boggs f188c20250 Add ID type for notifications 2023-01-09 09:03:21 -05:00
D. Scott Boggs c5f199b460 Add ID type for filters 2023-01-09 09:03:21 -05:00
D. Scott Boggs 9f4327f546 Add ID type for attachments 2023-01-09 09:03:21 -05:00
D. Scott Boggs 547d994d13 Add ID type for account 2023-01-09 09:03:21 -05:00
Matthias Beyer 97ae0973c3 Wrap status id in helper type
This wrapper type ensures that the status id cannot accidentially be
compared to some other string that represents something entirely else.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2023-01-09 09:03:21 -05:00
D. Scott Boggs 10ec4dc81f Fix: backwards compatibility 2023-01-09 07:27:53 -05:00
D. Scott Boggs 14dc17e582 Split status_builder module into a few files 2023-01-09 07:27:53 -05:00
D. Scott Boggs cc6bd77cab Publish NewStatus fields 2023-01-09 07:27:53 -05:00
D. Scott Boggs abafaf224c Add support for Filter v2 2023-01-09 07:27:53 -05:00
D. Scott Boggs 6ee2f277d8 Move legacy Filter type to mod v1; publish fields 2023-01-09 07:27:53 -05:00
D. Scott Boggs acef484b73 Finish TODO Parse DateTime before publishing this field 2023-01-09 07:27:53 -05:00
D. Scott Boggs 94624ac1db Make additional fields public 2023-01-09 07:27:53 -05:00
jhwgh1968 83e02464af Add notification type "follow request" 2023-01-09 04:51:26 -05:00
jhwgh1968 9fd1b29521 Add "poll" notification support 2023-01-09 04:51:26 -05:00
Matthias Beyer 6dcffc0802 Fix: Use Visibility pub here, to be backwards compatible
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2023-01-04 08:29:52 -05:00
Matthias Beyer e0f38240b7 Make package fields workspace-wide
This patch makes the "version", "license", "authors" and "edition"
fields in the manifest workspace-wide.

This way we ensure that mastodon-async-entities stays in sync with
mastodon-async.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2023-01-04 08:29:52 -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 02de9f5d32 Fix: Remove unused import
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2023-01-03 10:59:42 -05:00
Matthias Beyer 53447d1f48 Fix: Pass arguments in right order
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2023-01-03 10:59:42 -05:00
Matthias Beyer 5d445d2708 Fix clippy: Remove unnecessary Ok + ? operator
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2023-01-03 10:59:42 -05:00
Matthias Beyer 88ba4c0894 Fix clippy: Remove unnecessary Ok + ? operator
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2023-01-03 10:59:42 -05:00
Matthias Beyer b47e435b49 Fix: Let clippy lint all features
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2023-01-03 10:59:42 -05:00
Matthias Beyer 00c390f56b fixup! Add error variant for when not all bytes are written 2023-01-03 07:13:25 -05:00
D. Scott Boggs 1e4b2e0adb use serde_json's to_writer 2023-01-03 07:13:25 -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
Scott Boggs 21dd421656 Move prelude use statements to separate fn 2023-01-03 07:02:36 -05:00
Matthias Beyer faf0cda10c Add test for API exports
This patch adds a test file that only tries to import everything that's
exposed from the crate API, so we do not accidentially vanish something
from the API.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2023-01-03 07:02:36 -05:00
dependabot[bot] c497e11b4d Update url requirement from 1 to 2
Updates the requirements on [url](https://github.com/servo/rust-url) to permit the latest version.
- [Release notes](https://github.com/servo/rust-url/releases)
- [Commits](https://github.com/servo/rust-url/compare/v1.0.0...v2.3.1)

---
updated-dependencies:
- dependency-name: url
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-02 07:17:24 -05:00
Matthias Beyer e328924193 Add rust-cache in CI workflow
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2023-01-01 11:25:02 -05:00
D. Scott Boggs f830671ee9 Make tokio's rt-multi-thread enabled again in examples 2023-01-01 11:22:43 -05:00
D. Scott Boggs 6ba0cd03f8 Drop unnecessary tokio feature dependency 2022-12-30 07:16:29 -05:00
Matthias Beyer c32f628c49 Make Registered::complete() accept an AsRef<str>
This patch changes the signature of `Registered::complete` to accept an
`AsRef<str>`. This _should_ be backwards compatible to the old version.

This change was implemented as it has the neat benefit that a user can
implement a type that does not implement `Debug` or `Display`, but only
`AsRef<str>`.
This can be done to ensure that the access code is not accidentially
shown in log output, which might be pasted to some code forge for bug
reporting.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2022-12-29 14:07:09 -05:00