summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorD. Scott Boggs <scott@tams.tech>2022-11-27 09:44:43 -0500
committerD. Scott Boggs <scott@tams.tech>2022-11-27 09:44:43 -0500
commit96b16c62d95552884ac665b3cb5e79f0f21aa481 (patch)
tree58559b6135fd0bdec3fc8046e76dd94c1a02328a
initial state; elefren 0.22.0
-rw-r--r--.cargo-ok1
-rw-r--r--.cargo_vcs_info.json5
-rw-r--r--.clog.toml3
-rw-r--r--.env.sample5
-rw-r--r--.gitignore5
-rw-r--r--.travis.yml42
-rw-r--r--.vscode/settings.json22
-rw-r--r--CHANGELOG.md190
-rw-r--r--Cargo.toml99
-rw-r--r--LICENCE-APACHE13
-rw-r--r--LICENCE-MIT21
-rw-r--r--Makefile8
-rw-r--r--README.md100
-rw-r--r--appveyor.yml29
-rw-r--r--build.rs20
-rw-r--r--docs/book.toml8
-rw-r--r--docs/guide/.nojekyll1
-rw-r--r--docs/guide/FontAwesome/css/font-awesome.css4
-rw-r--r--docs/guide/FontAwesome/fonts/FontAwesome.ttfbin0 -> 138204 bytes
-rw-r--r--docs/guide/FontAwesome/fonts/fontawesome-webfont.eotbin0 -> 68875 bytes
-rw-r--r--docs/guide/FontAwesome/fonts/fontawesome-webfont.svg640
-rw-r--r--docs/guide/FontAwesome/fonts/fontawesome-webfont.ttfbin0 -> 138204 bytes
-rw-r--r--docs/guide/FontAwesome/fonts/fontawesome-webfont.woffbin0 -> 81284 bytes
-rw-r--r--docs/guide/FontAwesome/fonts/fontawesome-webfont.woff2bin0 -> 64464 bytes
-rw-r--r--docs/guide/ayu-highlight.css71
-rw-r--r--docs/guide/book.js600
-rw-r--r--docs/guide/chapter_1.html184
-rw-r--r--docs/guide/clipboard.min.js7
-rw-r--r--docs/guide/css/chrome.css417
-rw-r--r--docs/guide/css/general.css144
-rw-r--r--docs/guide/css/print.css54
-rw-r--r--docs/guide/css/variables.css210
-rw-r--r--docs/guide/elasticlunr.min.js10
-rw-r--r--docs/guide/favicon.pngbin0 -> 5679 bytes
-rw-r--r--docs/guide/highlight.css69
-rw-r--r--docs/guide/highlight.js2
-rw-r--r--docs/guide/index.html184
-rw-r--r--docs/guide/mark.min.js7
-rw-r--r--docs/guide/print.html192
-rw-r--r--docs/guide/searcher.js477
-rw-r--r--docs/guide/searchindex.js1
-rw-r--r--docs/guide/searchindex.json1
-rw-r--r--docs/guide/tomorrow-night.css96
-rw-r--r--docs/src/SUMMARY.md3
-rw-r--r--docs/src/chapter_1.md1
-rw-r--r--examples/follow_profile.rs27
-rw-r--r--examples/follows_me.rs27
-rw-r--r--examples/home_timeline.rs27
-rw-r--r--examples/print_your_profile.rs27
-rw-r--r--examples/register/mod.rs56
-rw-r--r--examples/search.rs28
-rw-r--r--examples/upload_photo.rs27
-rw-r--r--rustfmt.toml16
-rw-r--r--src/apps.rs233
-rw-r--r--src/data.rs17
-rw-r--r--src/entities/account.rs144
-rw-r--r--src/entities/attachment.rs63
-rw-r--r--src/entities/card.rs28
-rw-r--r--src/entities/context.rs13
-rw-r--r--src/entities/event.rs14
-rw-r--r--src/entities/filter.rs27
-rw-r--r--src/entities/instance.rs45
-rw-r--r--src/entities/itemsiter.rs95
-rw-r--r--src/entities/list.rs6
-rw-r--r--src/entities/mention.rs12
-rw-r--r--src/entities/mod.rs59
-rw-r--r--src/entities/notification.rs34
-rw-r--r--src/entities/push.rs67
-rw-r--r--src/entities/relationship.rs31
-rw-r--r--src/entities/report.rs10
-rw-r--r--src/entities/search_result.rs29
-rw-r--r--src/entities/status.rs107
-rw-r--r--src/errors.rs245
-rw-r--r--src/helpers/cli.rs27
-rw-r--r--src/helpers/env.rs81
-rw-r--r--src/helpers/json.rs231
-rw-r--r--src/helpers/mod.rs38
-rw-r--r--src/helpers/toml.rs229
-rw-r--r--src/http_send.rs26
-rw-r--r--src/lib.rs858
-rw-r--r--src/macros.rs364
-rw-r--r--src/mastodon_client.rs388
-rw-r--r--src/page.rs226
-rw-r--r--src/registration.rs430
-rw-r--r--src/requests/filter.rs154
-rw-r--r--src/requests/mod.rs13
-rw-r--r--src/requests/push.rs633
-rw-r--r--src/requests/statuses.rs614
-rw-r--r--src/requests/update_credentials.rs327
-rw-r--r--src/scopes.rs818
-rw-r--r--src/status_builder.rs366
-rw-r--r--tests/skeptic.rs1
92 files changed, 11284 insertions, 0 deletions
diff --git a/.cargo-ok b/.cargo-ok
new file mode 100644
index 0000000..b5754e2
--- /dev/null
+++ b/.cargo-ok
@@ -0,0 +1 @@
+ok \ No newline at end of file
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
new file mode 100644
index 0000000..8dcfab9
--- /dev/null
+++ b/.cargo_vcs_info.json
@@ -0,0 +1,5 @@
+{
+ "git": {
+ "sha1": "17c727f5c615eed921d0095d1b6f49e44024025d"
+ }
+}
diff --git a/.clog.toml b/.clog.toml
new file mode 100644
index 0000000..a853fbd
--- /dev/null
+++ b/.clog.toml
@@ -0,0 +1,3 @@
+[clog]
+changelog = "CHANGELOG.md"
+
diff --git a/.env.sample b/.env.sample
new file mode 100644
index 0000000..693aa30
--- /dev/null
+++ b/.env.sample
@@ -0,0 +1,5 @@
+export TOKEN='snakeoil'
+export CLIENT_ID=''
+export CLIENT_SECRET=''
+export REDIRECT=''
+export BASE='https://mastodon.social'
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..7111969
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+target
+Cargo.lock
+.env
+mastodon-data.toml*
+libtest.rmeta
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..8d8f57e
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,42 @@
+sudo: required
+language: rust
+dist: trusty
+addons:
+ apt:
+ packages:
+ - libssl-dev
+cache:
+ directories:
+ - $HOME/.cargo
+env:
+ - ELEFREN_FEATURES="--features toml"
+ - ELEFREN_FEATURES="--features json"
+ - ELEFREN_FEATURES="--features all"
+ - ELEFREN_FEATURES=""
+os:
+ - linux
+ - osx
+rust:
+ - stable
+ - beta
+ - nightly
+script:
+ - cargo test $ELEFREN_FEATURES
+matrix:
+ include:
+ - name: "Coverage"
+ rust: nightly
+ before_cache: RUSTFLAGS="--cfg procmacro2_semver_exempt" cargo install -f cargo-tarpaulin
+ script: cargo build --features all
+ after_success: cargo tarpaulin --ciserver travis-ci --coveralls $TRAVIS_JOB_ID --features all
+
+ - name: "rustfmt"
+ rust: nightly
+ before_script: rustup component add rustfmt-preview
+ script: cargo fmt --all -- --check
+
+ allow_failures:
+ - rust: nightly
+notifications:
+ email:
+ on_success: never
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..2c859eb
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,22 @@
+{
+ "cSpell.words": [
+ "Creds",
+ "deserialise",
+ "Elefren",
+ "favourite",
+ "favourited",
+ "indoc",
+ "isolang",
+ "querystring",
+ "reblog",
+ "reqwest",
+ "tomlcrate",
+ "tungstenite",
+ "Unauth",
+ "unendorse",
+ "unfavourite",
+ "unfollow",
+ "unmute",
+ "unreblog"
+ ]
+} \ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..9bfe7b4
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,190 @@
+<a name="v0.18.0"></a>
+## v0.18.0 (2019-01-05)
+
+#### Breaking Changes
+
+* Change `Registered::complete` to take the receiver by reference
+
+#### Features
+
+* Add `Registered::into_parts` and `Registered::from_parts`
+* Add `FromStr` implementation for `Scopes`
+
+<a name="v0.17.0"></a>
+## v0.17.0 (2018-12-12)
+
+#### Bug Fixes
+
+* Fixes `follow` to return a `Relationship` [6f63fef](6f63fef0b2414099c55e36107aab785f689d19b6)
+
+#### Features
+
+* Add `follows_me` and `followed_by_me` shortcut methods [4dd4042](4dd40422b3de11aaadcfc600317c0df3556b38f5)
+
+#### Breaking Changes
+
+* Change `u64` ids to `&str` [9a08058](9a080583f0577d3f77eaf7be55758835c56ea61e)
+* Fixes `follow` to return a `Relationship` [6f63fef](6f63fef0b2414099c55e36107aab785f689d19b6)
+
+<a name="v0.16.0"></a>
+## v0.16.0 (2018-10-03)
+
+This release upgrades reqwest, our http client dependency, from 0.8.8 ->
+0.9.0
+
+<a name="v0.15.2"></a>
+## v0.15.2
+
+This is a bugfix release
+
+<a name="v0.15.1"></a>
+## v0.15.1
+
+This is a bugfix release
+
+<a name="v0.15.0"></a>
+## v0.15.0 (2018-09-15)
+
+This release adds support for all new API endpoints introduced in Mastodon 2.4.* and 2.5.0
+
+#### Features
+
+* **scopes:** Implement granular OAuth scopes ([e284894d](e284894d), closes [#44](44))
+* **helpers:** cli::authenticate ([034bd4e6](034bd4e6))
+* **client:** Implement client.update\_credentials ([a57c7e2f](a57c7e2f))
+* **status:** Add language code to status builer ([989d9a59](989d9a59), closes [#55](55))
+* **client:** Implement profile metadata update ([0ad1e374](0ad1e374), closes [#54](54))
+* **search:** Implement `GET /api/v2/search` ([28192e11](28192e11))
+* **client:** Implement push notifciations endpoints ([690b029d](690b029d), closes [#53](53))
+* **client:** Add `replies_count` property to `Status` entities ([7d752a9f](7d752a9f), closes [#73](73))
+* **client:** Implement Keyword filtering API ([7d164cb8](7d164cb8), closes [#71](71))
+* **client:** Implement the Follow Suggestions API ([7de1bdc0](7de1bdc0), closes [#72](72))
+* **client:** Implement the Endorsements API ([1f0ba184](1f0ba184), closes [#74](74))
+
+#### Breaking Changes
+
+* **scopes:** Implement granular OAuth scopes ([e284894d](e284894d)) (closes [#44](44))
+
+#### Bug Fixes
+
+* **client:** change return value of client.unfollow to `Relationship` ([20a9c69a](20a9c69a))
+* **client:** change `POST /search` to `GET /search` ([34e2c008](34e2c008))
+
+
+<a name="v0.14.0"></a>
+## v0.14.0 (2018-08-29)
+
+#### Features
+
+* **helpers:** add json helper module ([46871da4](46871da4))
+
+#### Breaking Changes
+
+* **client:** fix broken paged\_routes\_with\_id methods ([c66c305d](c66c305d), closes [#42](42))
+
+#### Bug Fixes
+
+* **client:** fix broken paged\_routes\_with\_id methods ([c66c305d](c66c305d), closes [#42](42))
+
+
+# 0.13 (2018/08/27)
+
+## Features
+
+- `Registration` now duplicates the `AppBuilder` API, so you can
+ replace:
+
+ ```
+ let app = App::builder();
+ app.client_name("test-client");
+
+ let registration = Registration::new("http://example.com")
+ .register(app)?;
+ ```
+
+ with this:
+
+ ```
+ let registration = Registration::new("http://example.com")
+ .client_name("test-client")
+ .build()?;
+ ```
+
+ You can still call use the `Registration` & `AppBuilder` APIs like
+ before, but any App passed to `.register` will supercede anything app
+ config set on the `Registration` object itself.
+
+ In future releases, this will become a hard error.
+
+- `elefren::status_builder::StatusBuilder::new()` now takes anything
+ that implements `Display` instead of specifically an owned `String`
+
+## Breaking Changes
+
+- The `elefren::data::toml` module has been moved to
+ `elefren::helpers::toml`
+- Because of the changes to `Registration`, the `elefren::apps::prelude`
+ module has been removed. The types that are still necessary from that
+ prelude have been moved to `elefren::prelude`, but
+ `elefren::apps::App` will have to be imported separately
+- `elefren::entities::account::CredientialsBuilder` has been moved to
+ `elefren::entities::account::CredentialsBuilder` (note the spelling
+ difference)
+- `Registered::complete` now takes a `&str` instead of a `String`
+
+## Compatibility
+
+- `elefren::entities::instance::Instance` now has the `max_toot_chars`
+ property, for use with the Pleroma and Glitch-soc APIs
+
+# 0.12 (2018/08/23)
+
+## Features
+
+- `Page::items_iter` added, abstracts over "next_page" logic
+- `elefen::prelude` and `elefen::apps::prelude` modules added to more
+ easily import all necessary types
+- Helpers added to allow serialization & deseriasization of `Data` types
+ to `toml`
+
+## Breaking Changes
+
+- Combined all parameters to `mastodon.statuses` (except `id`) to their
+ own type, `StatusesRequest`
+- All API methods on `Mastodon` type moved into a trait,
+ `MastodonClient`, to enable better mocking during tests
+- `Mastodon::from_data(Data)` was changed to `Mastodon::from(Data)`
+- `AppBuilder` was changed, use `App::builder()` instead
+- `Registration` was broken up to enable better registration flow
+
+## Documentation
+
+- All API methods now have doc comments
+- All docs were updated for the new breaking changes
+
+## Compatibility
+
+- Login to pleroma instances was fixed
+
+# 0.11
+- Added more examples to `examples` directory.
+- Fixed `follow` and `unfollow` routes.
+- Updated `moved` field to be `Box<Account>`.
+
+# 0.10
+
+- Added the ability to handle paged entities like favourites and such.(Only favourites in prerelease)
+- Added optional `source` and `moved` fields to `Account`.
+- Added `Source` struct to match with the `Account.source` field.
+- Added `CredientialsBuilder` struct for updating profile using
+ `verify_credientials`.
+- Attachment now handles being sent an empty object, which is converted
+ to `None`.
+- Added ombed data fields to `Card`.
+- Added `version` and `urls` fields to `Instance`.
+- Added `id`, `muting_notifications`, and `domain_blocking` to `Relationship`.
+- Added `emojis`, `language`, and `pinned` fields to `Status`
+- Added `Emoji` struct.
+- Added `List` and `Mention` structs(matching routes not added yet).
+- Added example that prints your profile.
+- Updated dependencies
diff --git a/Cargo.toml b/Cargo.toml
new file mode 100644
index 0000000..cb857fa
--- /dev/null
+++ b/Cargo.toml
@@ -0,0 +1,9