Commit Graph
62 Commits
Author SHA1 Message Date
Paul Woolcock 384d3d2c41 add toml helpers to data.rs 2018-08-23 13:27:32 -04:00
Paul Woolcock ddcef1940a Move Data struct to it's own module 2018-08-23 13:27:32 -04:00
Paul Woolcock 8636e690c3 rustfmt pass 2018-08-23 10:35:26 -04:00
Paul Woolcock 0f5e295ea9 Revamp registration & auth process 2018-08-23 07:59:31 -04:00
Paul Woolcock 3f7841da02 Add necessary error variant 2018-08-23 07:37:58 -04:00
Paul Woolcock e7afdf7b59 Add MastodonBuilder and use in From<Data> impl 2018-08-23 07:37:58 -04:00
Paul Woolcock 5eca9748a3 Reduce the visibility of ItemsIter and add docs to items_iter 2018-08-22 16:09:16 -04:00
Paul Woolcock 49eee2313f Make the Meta fields optional
using `deserialize_with` causes an error if the `"meta"` key is missing
completely, which is not very useful. This isn't ideal, but it will make
it so all the various states that "meta" can be in will deser correctly
2018-08-22 15:18:58 -04:00
Paul Woolcock 2e8ee7e840 This field can be true/false or "true"/"false" 2018-08-22 14:22:27 -04:00
Paul Woolcock e5175f09fe make apps::prelude and use the preludes in the tests 2018-08-22 13:53:54 -04:00
Paul Woolcock 63d09c1113 Clean up src/lib.rs a bit more 2018-08-22 13:19:41 -04:00
Paul Woolcock 7f1303b5f6 Set a default redirect_uri if none is provided 2018-08-22 11:04:48 -04:00
Paul Woolcock cc083e335e Change Mastodon::from_data to just Mastodon::from 2018-08-22 06:48:56 -04:00
Paul Woolcock 1847160369 No reason to impl Deser for both the ApiError and Error types 2018-08-22 00:31:51 -04:00
Paul Woolcock 454d005517 Move From<> impls too 2018-08-22 00:31:51 -04:00
Paul Woolcock 3f5c1db430 Breakout errors into their own module 2018-08-22 00:31:51 -04:00
Paul Woolcock a9b6b52890 Change mammut references to elefren 2018-08-21 17:01:05 -04:00
Paul Woolcock 22b4b04738 Adds a MastodonClient trait
This is useful for user code, which can use the trait to add a layer of
indirection to their code, allowing them to swap out implementations for
testing
2018-08-21 16:29:57 -04:00
Paul WoolcockandGitHub 6c37ecb1e1 Merge pull request #2 from pwoolcoc/fix-url-error
Fix url error
2018-08-21 16:28:33 -04:00
Paul Woolcock 5c339fd41f compile (but don't run) two more tests 2018-08-21 16:09:54 -04:00
Paul Woolcock d14d50070e fix test 2018-08-21 15:56:01 -04:00
Paul Woolcock 664cb2797f fix the test so it actually tests something 2018-08-21 15:56:01 -04:00
Paul Woolcock 6501470312 Change PageIter to ItemsIter 2018-08-21 15:56:01 -04:00
Paul Woolcock 68f8766aff Return None if there are no items 2018-08-21 15:56:01 -04:00
Paul Woolcock b4cbcfa1a7 into_iter -> items_iter 2018-08-21 15:56:01 -04:00
Paul Woolcock 6d67e403bc Don't expose pageiter module, and add some docs to PageIter 2018-08-21 15:56:01 -04:00
Paul Woolcock 0e8eb4e568 Add PageIter<T> to abstract over iterating over pages 2018-08-21 15:56:01 -04:00
Paul Woolcock a647d47b57 remove unnecessary slash 2018-08-05 21:16:15 -04:00
Paul Woolcock 01704d7169 fix bug introduced in the last change 2018-08-05 21:10:09 -04:00
Aaron Power 87a0c103e6 Added doc_comment to properly doc functions 2018-08-05 16:50:24 +01:00
Paul WoolcockandAaron Power 142d8e7572 Statuses request struct for the statuses method (#34)
* Add `StatusesRequest` data type

* Breaking change: statuses now takes an id and a `StatusesRequest`

This allows use to pass all the available parameters to
`GET /api/v1/accounts/:id/statuses` without having to add a bunch of
parameters to the method. It is obviously a breaking API change

* Update version to 0.12

* Revert "Update version to 0.12"

This reverts commit d623ea21564a831aa15284b4a589f3de63e7d96c.

* Address review comments

* Address remaining code review comments
2018-08-05 16:30:02 +01:00
Aaron Power 523d83022e Fixed example code, and {un}follow routes. 2018-06-29 11:10:50 +01:00
Klaus PurerandAaron Power bc68726d23 fix(account): Fix moved field on Account (#31) 2018-06-28 08:44:28 +01:00
Aaron Power 0c312cecfc Fixed Instance deserialising and added undocumented properties 2018-03-02 23:43:18 +00:00
Aaron Power 7bedb2378a fixed ApiError 2018-03-02 21:45:55 +00:00
Aaron Power 75eea88023 Fixed examples 2018-03-02 20:27:32 +00:00
Aaron Power fd1fe41bb4 Fixed typo causing incorrect type signatures 2018-03-02 20:13:06 +00:00
Aaron Power d9586714fd Moved all array routes to paged and changed ids to strs 2018-02-25 15:42:04 +00:00
Aaron Power 4984dfaacf Version 0.10.0-rc1
- 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.
2018-02-12 00:09:23 +00:00
TheBestJohnandAaron Power ab1e5f86f0 Fixed the registration of new apps as well as url of statuses is now an Option<String> (#23)
* Changes IDs to Strings for compliance with APIv1

* - Changed Scope to Scopes to coencide with a quirk of the Mastodon API. Initial registration of the app asks for "Scopes" and authorization asks for "Scope"
- Swapped spaces for urlencoded spaces in the scopes serde definition to prevent broken links
- url of status is returned as a Map not a string"

* Fixed tests and updated Version number

* Fixed tests and verified now... learning experience
2018-02-10 18:22:30 +00:00
JohannesandAaron Power 0b5441e52c Changes IDs to Strings for compliance with APIv1 (#20) 2018-02-10 18:21:58 +00:00
Klaus PurerandAaron Power 0ee5806534 fix(errors): Directly pass up Serde errors for easier debugging (#16)
* fix(errors): Directly pass up Serde errors for easier debugging

* refactor(errors): Also check for API errors

* tests(errors): Add test case

* tests(upload): Ignore integration test with real Mastodon connection per default

* fix(tests): Fix error assertion after change of field ordering

* refactor(json): Create a shared function for response JSON converting
2018-02-10 18:21:12 +00:00
Paul WoolcockandAaron Power dfe317f329 Add PartialEq to Data struct (#19) 2017-12-21 16:56:14 +00:00
Aaron Power b445197381 docs(all): Added documentation to missing parts 2017-11-11 11:50:09 +00:00
Aaron Power 87bcc139bb refactor(error): Better errors from the Mastodon API 2017-11-11 10:21:12 +00:00
Aaron Power f8aa32f003 Version 0.9, Changed API to use Cow<'static, str>
Added documentation to Error enum
2017-11-09 13:56:50 +00:00
Aaron Power b6d350f29e updated reqwest and fixed media route
reqwest updated to 0.8
removed Result for creating Mastodon client as result of reqwest update
added Meta and ImageDetails struct for Attachment
Changed Attachment.id to String
Added test for media route.
Changed paramaters for media from Vec<u8> of image data to String of
file path.
Added dotenv for testing
2017-11-09 13:05:30 +00:00
Paul WoolcockandAaron Power a0c69aac43 Implement std::error::Error for the Error enum (#12) 2017-11-09 11:43:53 +00:00
Bryan TsangandAaron Power 974f9241e1 Fix incompatible serde versions, misspelled reference (#9) 2017-07-03 12:42:38 +01:00
wariuniandAaron Power 34f17ebcc0 Fix the attributes of Attachment (#5)
* Fix Attachment.text_url not being nullable

* Add missing "unknown" attribute to MediaType, which is not in the documentation by TootSuite

https://github.com/tootsuite/mastodon/blob/b97ebaf6202debb8c24d6f726886a594f02a6d3b/app/models/media_attachment.rb#L24
2017-06-05 10:55:50 +01:00