Skip to content

Improve helix::client_ext helpers & types in collections #359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Audit
env:
MSRV: 1.67.0
MSRV: 1.77.0
on:
pull_request:
types: [opened, reopened, synchronize]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: CI
env:
CI_TWITCH_API_FEATURES: "twitch_oauth2/all all unsupported deny_unknown_fields ureq"
MSRV: 1.67.0
MSRV: 1.77.0
on:
pull_request:
types: [opened, reopened, synchronize]
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

### Breaking changes

- MSRV: 1.67.0
- MSRV: 1.77.0
- Requests for helix endpoints have been converted to take `Cow`s.
This change means the `builder()` methods are harder to use, consider using the new methods on
each request which provide the same functionality but with better ergonomics.
Expand Down Expand Up @@ -73,6 +73,7 @@
- Added `helix::Response::new` and `helix::Response::with_data` to make it possible to create your own responses.
- Added `is_branded_content` and `content_classification_labels` to `Get Channel Information` and `Modify Channel information`
- Added `channel.update` v2 EventSub event
- Added `HelixClient` functions `get_streams_from_logins` and `get_streams_from_ids`
- Added `is_featured` to Get Clips
- Added beta `Get Ad Schedule` and `Snooze Next Ad` endpoint
- Added beta `channel.ad_break.begin` eventsub event
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ include = [
"CHANGELOG.md",
"LICENSE*",
]
rust-version = "1.67.0"
rust-version = "1.77.0"


[workspace]
Expand All @@ -29,7 +29,7 @@ exclude = ["twitch_types", "twitch_oauth2"]
[workspace.dependencies]
twitch_api = { version = "0.7.0-rc.6", path = "." }
twitch_oauth2 = { version = "0.13.0", path = "twitch_oauth2/" }
twitch_types = { version = "0.4.3", features = [
twitch_types = { version = "0.4.5", features = [
"serde",
], path = "./twitch_types" }

Expand Down
5 changes: 2 additions & 3 deletions examples/channel_information_custom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ async fn run() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>>
.expect("Please set env: TWITCH_TOKEN or pass token as first argument");
let token = UserToken::from_existing(&client, token, None, None).await?;

let ids: &[_] = &[token.user_id.as_ref()];
let resp = client
.req_get_custom(
helix::channels::GetChannelInformationRequest::broadcaster_ids(ids),
helix::channels::GetChannelInformationRequest::broadcaster_ids(&token.user_id),
&token,
)
.await
Expand All @@ -43,7 +42,7 @@ async fn run() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>>
/// Return Values for Get Channel Information
///
/// [`get-channel-information`](https://dev.twitch.tv/docs/api/reference#get-channel-information)
#[derive(PartialEq, Eq, serde::Deserialize, serde_derive::Serialize, Debug, Clone)]
#[derive(PartialEq, Eq, serde_derive::Deserialize, serde_derive::Serialize, Debug, Clone)]
pub struct CustomChannelInformation<'a> {
/// Twitch User ID of this channel owner
pub broadcaster_id: &'a types::UserIdRef,
Expand Down
4 changes: 1 addition & 3 deletions examples/eventsub/src/twitch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,7 @@ pub async fn is_live<'a>(
tracing::info!("checking if live");
if let Some(stream) = client
.req_get(
helix::streams::get_streams::GetStreamsRequest::user_ids(
&[config.broadcaster.id.as_ref()][..],
),
helix::streams::get_streams::GetStreamsRequest::user_ids(&config.broadcaster.id),
token,
)
.await
Expand Down
7 changes: 5 additions & 2 deletions examples/followed_streams.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,13 @@ async fn run() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>>
.get_games_by_id(
&streams
.iter()
.map(|s| s.game_id.as_ref())
.collect::<Vec<_>>(),
.map(|s| &s.game_id)
.collect::<Vec<_>>()
.into(),
&token,
)
.map_ok(|g| (g.id.clone(), g))
.try_collect::<std::collections::HashMap<_, _>>()
.await?;

println!(
Expand Down
Loading