aboutsummaryrefslogtreecommitdiff
path: root/src/http
Commit message (Collapse)AuthorAgeFilesLines
...
* | Switch to parking_lot::{Mutex, RwLock}Zeyla Hellyer2017-10-102-14/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Switch to the `parking_lot` crate's implementations of `std::sync::Mutex` and `std::sync::RwLock`, which are more efficient. A writeup on why `parking_lot` is more efficient can be read here: <https://github.com/Amanieu/parking_lot> Upgrade path: Modify `mutex.lock().unwrap()` usage to `mutex.lock()` (not needing to unwrap or handle a result), and `rwlock.read().unwrap()`/`rwlock.write().unwrap()` usage to `rwlock.read()` and `rwlock.write()`. For example, modify: ```rust use serenity::CACHE; println!("{}", CACHE.read().unwrap().user.id); ``` to: ```rust use serenity::CACHE; println!("{}", CACHE.read().user.id); ```
* | Make webhook_id a majour parameter in ratelimitingZeyla Hellyer2017-10-092-4/+19
| | | | | | | | | | This change is made due to this change in documentation: <https://github.com/discordapp/discord-api-docs/commit/32d06c360867cead6aa785ff10c437fdb2743bd6?short_path=5f625d6#diff-5f625d6c4303e22c3d6af4c8d6df28fe>
* | Fix most clippy warningsMaiddog2017-10-091-1/+1
| |
* | Replace Vec parameters by IntoIterator (#176)François Triquet2017-10-091-2/+2
| |
* | Revert "Use the de-generification trick."acdenisSK2017-10-091-5/+1
| | | | | | | | Makes the compiliation time just a bit worse
* | Use the de-generification trick.acdenisSK2017-10-091-1/+5
| | | | | | | | Fixes #168
* | `to_owned` -> `to_string`acdenisSK2017-10-091-6/+6
|/
* Document http::set_token and unhide it from docsZeyla Hellyer2017-09-231-3/+22
|
* Apply rustfmtZeyla Hellyer2017-09-182-69/+43
|
* Apply rustfmtZeyla Hellyer2017-09-181-1/+3
|
* Use combinators in `parse_header`acdenisSK2017-09-171-14/+7
|
* Update deprecated bulk delete endpointZeyla Hellyer2017-09-051-1/+1
| | | | | | | | | | | | The bulk delete endpoint of `/channels/:channel_id/messages/bulk_delete` was deprecated a while ago and was modified to `/channels/:channel_id/messages/bulk-delete`. New endpoint docs: <https://discordapp.com/developers/docs/resources/channel#bulk-delete-messages> Deprecated endpoint docs: <https://discordapp.com/developers/docs/resources/channel#bulk-delete-messages-deprecated>
* Remove more non-bot user endpointsZeyla Hellyer2017-09-011-47/+0
| | | | | | | | | | | | These include the following functions removed: - `http::get_application_info` - `http::get_applications` - `http::get_emoji` - `http::get_emojis` - `model::Guild::{emoji, emojis}` - `model::GuildId::{emoji, emojis}` - `model::PartialGuild::{emoji, emojis}`
* Add ability to play DCA and Opus files. (#148)Maiddog2017-08-272-46/+76
|
* Revamp `RwLock` usage in the libacdenisSK2017-08-242-76/+46
| | | | Also not quite sure if they goofed rustfmt or something, but its changes it did were a bit bizarre.
* Fix rustfmt lines that are too longZeyla Hellyer2017-08-181-1/+3
| | | | | Apparently rustfmt can't fix some of these, causing it to exit with 3 and therefore failing the build.
* Apply rustfmtZeyla Hellyer2017-08-182-35/+64
|
* Clippy and rustfmtacdenisSK2017-08-011-1/+2
|
* Remove a few clonesacdenisSK2017-07-292-3/+2
|
* Change the config a bit, and a few nitpicksacdenisSK2017-07-272-439/+680
|
* rustfmtacdenisSK2017-07-273-256/+275
|
* Remove the code meant for debuggingacdenisSK2017-07-241-2/+0
| | | | "Meant" as in, the data frame errors and whatever shenanigans weren't allowing me to
* Revert the ignoring of protocol and data frame errors, while actually ↵acdenisSK2017-07-241-0/+2
| | | | | | handling ping pongs When receiving pings, serenity MUST send the pong with the same data as the ping. Well, as said in the rfc for websockets anyway. Though, regarding the errors, i found out that serenity's gateway wouldn't work, but i do see that i'll have to file an issue to see if they know why are these happening at all
* Add an actual way to fetch audit log entries from a guildacdenisSK2017-07-202-0/+15
|
* Remove the deprecated functionsacdenisSK2017-07-111-18/+0
| | | | It's already been enough time for people to migrate
* Implement attaching reasons to bansacdenisSK2017-07-081-3/+4
|
* Docs fixesmei2017-06-271-3/+2
|
* Update dependenciesZeyla Hellyer2017-06-211-2/+2
|
* Add 'wait' parameter to http::execute_webhookZeyla Hellyer2017-06-201-6/+21
| | | | | | The 'wait' parameter allows you to specify waiting for the Message to be sent prior to receiving a response, which will have Discord include the JSON representation of the Message in the body.
* Call send_files from http::send_fileZeyla Hellyer2017-06-141-35/+7
| | | | | | | | | | | | | | | | | | | When made, the `http::send_files` code was duplicated from `http::send_file`. Instead call `http::send_files`, which provides a fix for when an, e.g. 4xx status code, is received, and the library would continue to deserialize the response as usual. This fixes errors like: ``` Err(Json(ErrorImpl { code: Message("missing field `id`"), line: 1, column: 54 })) ``` Instead returning: ``` Err(Http(InvalidRequest(PayloadTooLarge))) ```
* Switch from #[doc(hidden)] to pub(crate)alex2017-06-142-10/+6
| | | | | | Switch from using `#[doc(hidden)]` to hide some internal functions to `pub(crate)`. The library now requires rustc 1.18.
* Use HTTPS Connector with remaining HTTP functionsMaiddog2017-06-141-9/+20
|
* Use an https connector in http::send_filesZeyla Hellyer2017-06-091-1/+5
|
* Use chrono for struct timestamp fieldsZeyla Hellyer2017-06-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Chrono is easier to use than timestamped strings, so they should be automatically deserialized and available for the user, instead of having the user deserialize the strings themselves. These fields have been changed to use a type of `DateTime<FixedOffset>`: - `ChannelPinsUpdateEvent.last_pin_timestamp` - `Group.last_pin_timestamp` - `Guild.joined_at` - `GuildChannel.last_pin_timestamp` - `Invite.created_at` - `Member.joined_at` - `Message.edited_timestamp - `Message.timestamp` - `MessageUpdateEvent.edited_timestamp` - `MessageUpdateEvent.timestamp` - `PrivateChannel.last_pin_timestamp` `Member.joined_at` is now also an `Option`. Previously, if a Guild Member Update was received for a member not in the cache, a new Member would be instantiated with a default String value. This is incorrect behaviour, and has now been replaced with being set to `None` in that case. Id methods' `created_at()` method now return a `chrono::NaiveDateTime` instead of a `time::Timespec`, and `User::created_at` has been updated to reflect that. Additionally, drop `time` as a direct dependency and use chrono for internals.
* Make http::send_files accept a slice of bytesZeyla Hellyer2017-06-041-4/+13
| | | | | | Sometimes a user might be working with a buffer of bytes in-memory and not writing to the disk, so `http::AttachmentType` should accept an &[u8].
* Make http::AttachmentType only use borrowed valuesZeyla Hellyer2017-06-041-14/+16
| | | | | With the way AttachmentType is meant to be used by `http::send_files`, none of the values need to be moved, they only need to be borrowed.
* Fix compilations across feature combinationsZeyla Hellyer2017-06-021-1/+2
|
* Fix ratelimiting::ROUTES doctestZeyla Hellyer2017-05-301-1/+1
| | | | | Values are now wrapped within an Arc<Mutex>, so the example needs to obtain a lock and unwrap it.
* Include more info on ratelimiting debugsZeyla Hellyer2017-05-301-7/+7
| | | | | In addition to the amount of time sleeping, include the route being ratelimited.
* Fix ratelimits causing 429s in certain situationsZeyla Hellyer2017-05-301-17/+18
|
* Implement multiple attachmentsKen Swenson2017-05-281-0/+86
|
* Fix incorrect attempted send_file deserializationZeyla Hellyer2017-05-271-0/+12
| | | | | | | | | | | If http::send_file received a non-success status code due to reasons such as sending to an invalid channel Id, not having permissions, or sending too large of a file, then it would still try to deserialize a response as if it were valid. To fix this, ensure that the response is successful. Document that if the file sent is too large, then `HttpError::InvalidRequest(PayloadTooLarge)` is returned.
* Fix broken docs links in http moduleZeyla Hellyer2017-05-241-43/+43
|
* Clippy lintsZeyla Hellyer2017-05-241-3/+3
|
* Restructure modulesZeyla Hellyer2017-05-223-0/+2083
Modules are now separated into a fashion where the library can be used for most use cases, without needing to compile the rest. The core of serenity, with no features enabled, contains only the struct (model) definitions, constants, and prelude. Models do not have most functions compiled in, as that is separated into the `model` feature. The `client` module has been split into 3 modules: `client`, `gateway`, and `http`. `http` contains functions to interact with the REST API. `gateway` contains the Shard to interact with the gateway, requiring `http` for retrieving the gateway URL. `client` requires both of the other features and acts as an abstracted interface over both the gateway and REST APIs, handling the event loop. The `builder` module has been separated from `utils`, and can now be optionally compiled in. It and the `http` feature are required by the `model` feature due to a large number of methods requiring access to them. `utils` now contains a number of utilities, such as the Colour struct, the `MessageBuilder`, and mention parsing functions. Each of the original `ext` modules are still featured, with `cache` not requiring any feature to be enabled, `framework` requiring the `client`, `model`, and `utils`, and `voice` requiring `gateway`. In total the features and their requirements are: - `builder`: none - `cache`: none - `client`: `gateway`, `http` - `framework`: `client`, `model`, `utils` - `gateway`: `http` - `http`: none - `model`: `builder`, `http` - `utils`: none - `voice`: `gateway` The default features are `builder`, `cache`, `client`, `framework`, `gateway`, `model`, `http`, and `utils`. To help with forwards compatibility, modules have been re-exported from their original locations.