Skip to content

Commit 5d94ce8

Browse files
authored
Merge pull request #359 from Emilgardis/helpers
Improve helix::client_ext helpers & types in collections
2 parents 60d2408 + 788c4ea commit 5d94ce8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+426
-307
lines changed

.github/workflows/audit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Audit
22
env:
3-
MSRV: 1.67.0
3+
MSRV: 1.77.0
44
on:
55
pull_request:
66
types: [opened, reopened, synchronize]

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: CI
22
env:
33
CI_TWITCH_API_FEATURES: "twitch_oauth2/all all unsupported deny_unknown_fields ureq"
4-
MSRV: 1.67.0
4+
MSRV: 1.77.0
55
on:
66
pull_request:
77
types: [opened, reopened, synchronize]

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
### Breaking changes
1010

11-
- MSRV: 1.67.0
11+
- MSRV: 1.77.0
1212
- Requests for helix endpoints have been converted to take `Cow`s.
1313
This change means the `builder()` methods are harder to use, consider using the new methods on
1414
each request which provide the same functionality but with better ergonomics.
@@ -73,6 +73,7 @@
7373
- Added `helix::Response::new` and `helix::Response::with_data` to make it possible to create your own responses.
7474
- Added `is_branded_content` and `content_classification_labels` to `Get Channel Information` and `Modify Channel information`
7575
- Added `channel.update` v2 EventSub event
76+
- Added `HelixClient` functions `get_streams_from_logins` and `get_streams_from_ids`
7677
- Added `is_featured` to Get Clips
7778
- Added beta `Get Ad Schedule` and `Snooze Next Ad` endpoint
7879
- Added beta `channel.ad_break.begin` eventsub event

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ include = [
1919
"CHANGELOG.md",
2020
"LICENSE*",
2121
]
22-
rust-version = "1.67.0"
22+
rust-version = "1.77.0"
2323

2424

2525
[workspace]
@@ -29,7 +29,7 @@ exclude = ["twitch_types", "twitch_oauth2"]
2929
[workspace.dependencies]
3030
twitch_api = { version = "0.7.0-rc.6", path = "." }
3131
twitch_oauth2 = { version = "0.13.0", path = "twitch_oauth2/" }
32-
twitch_types = { version = "0.4.3", features = [
32+
twitch_types = { version = "0.4.5", features = [
3333
"serde",
3434
], path = "./twitch_types" }
3535

examples/channel_information_custom.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,9 @@ async fn run() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>>
2525
.expect("Please set env: TWITCH_TOKEN or pass token as first argument");
2626
let token = UserToken::from_existing(&client, token, None, None).await?;
2727

28-
let ids: &[_] = &[token.user_id.as_ref()];
2928
let resp = client
3029
.req_get_custom(
31-
helix::channels::GetChannelInformationRequest::broadcaster_ids(ids),
30+
helix::channels::GetChannelInformationRequest::broadcaster_ids(&token.user_id),
3231
&token,
3332
)
3433
.await
@@ -43,7 +42,7 @@ async fn run() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>>
4342
/// Return Values for Get Channel Information
4443
///
4544
/// [`get-channel-information`](https://dev.twitch.tv/docs/api/reference#get-channel-information)
46-
#[derive(PartialEq, Eq, serde::Deserialize, serde_derive::Serialize, Debug, Clone)]
45+
#[derive(PartialEq, Eq, serde_derive::Deserialize, serde_derive::Serialize, Debug, Clone)]
4746
pub struct CustomChannelInformation<'a> {
4847
/// Twitch User ID of this channel owner
4948
pub broadcaster_id: &'a types::UserIdRef,

examples/eventsub/src/twitch.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,7 @@ pub async fn is_live<'a>(
265265
tracing::info!("checking if live");
266266
if let Some(stream) = client
267267
.req_get(
268-
helix::streams::get_streams::GetStreamsRequest::user_ids(
269-
&[config.broadcaster.id.as_ref()][..],
270-
),
268+
helix::streams::get_streams::GetStreamsRequest::user_ids(&config.broadcaster.id),
271269
token,
272270
)
273271
.await

examples/followed_streams.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,13 @@ async fn run() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>>
4040
.get_games_by_id(
4141
&streams
4242
.iter()
43-
.map(|s| s.game_id.as_ref())
44-
.collect::<Vec<_>>(),
43+
.map(|s| &s.game_id)
44+
.collect::<Vec<_>>()
45+
.into(),
4546
&token,
4647
)
48+
.map_ok(|g| (g.id.clone(), g))
49+
.try_collect::<std::collections::HashMap<_, _>>()
4750
.await?;
4851

4952
println!(

0 commit comments

Comments
 (0)