Skip to content

Commit a73edbd

Browse files
committed
make cursors into Cows too
1 parent 2f45c2f commit a73edbd

23 files changed

+61
-51
lines changed

src/helix/endpoints/channels/get_vips.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub struct GetVipsRequest<'a> {
5757
pub first: Option<usize>,
5858
/// The cursor used to get the next page of results. The Pagination object in the response contains the cursor’s value. Read more.
5959
#[cfg_attr(feature = "typed-builder", builder(default))]
60-
pub after: Option<helix::Cursor>,
60+
pub after: Option<Cow<'a, helix::CursorRef>>,
6161
}
6262

6363
impl<'a> GetVipsRequest<'a> {
@@ -110,7 +110,7 @@ impl Request for GetVipsRequest<'_> {
110110
}
111111

112112
impl helix::Paginated for GetVipsRequest<'_> {
113-
fn set_pagination(&mut self, cursor: Option<helix::Cursor>) { self.after = cursor; }
113+
fn set_pagination(&mut self, cursor: Option<helix::Cursor>) { self.after = cursor.map(|c| c.into_cow()) }
114114
}
115115

116116
impl RequestGet for GetVipsRequest<'_> {}

src/helix/endpoints/chat/get_chatters.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pub struct GetChattersRequest<'a> {
6262
pub first: Option<usize>,
6363
/// The cursor used to get the next page of results. The Pagination object in the response contains the cursor’s value.
6464
#[cfg_attr(feature = "typed-builder", builder(default))]
65-
pub after: Option<helix::Cursor>,
65+
pub after: Option<Cow<'a, helix::CursorRef>>,
6666
}
6767

6868
impl<'a> GetChattersRequest<'a> {
@@ -91,7 +91,7 @@ impl<'a> GetChattersRequest<'a> {
9191
}
9292

9393
impl helix::Paginated for GetChattersRequest<'_> {
94-
fn set_pagination(&mut self, cursor: Option<helix::Cursor>) { self.after = cursor }
94+
fn set_pagination(&mut self, cursor: Option<helix::Cursor>) { self.after = cursor.map(|c| c.into_cow()) }
9595
}
9696

9797
/// Return Values for [Get Chatters](super::get_chatters)

src/helix/endpoints/clips/get_clips.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ pub struct GetClipsRequest<'a> {
5959
// one of above is needed.
6060
/// Cursor for forward pagination: tells the server where to start fetching the next set of results, in a multi-page response. This applies only to queries specifying broadcaster_id or game_id. The cursor value specified here is from the pagination response field of a prior query.
6161
#[cfg_attr(feature = "typed-builder", builder(default))]
62-
pub after: Option<helix::Cursor>,
62+
pub after: Option<Cow<'a, helix::CursorRef>>,
6363
/// Cursor for backward pagination: tells the server where to start fetching the next set of results, in a multi-page response. This applies only to queries specifying broadcaster_id or game_id. The cursor value specified here is from the pagination response field of a prior query.
6464
#[cfg_attr(feature = "typed-builder", builder(default))]
6565
#[serde(borrow)]
66-
pub before: Option<&'a helix::CursorRef>,
66+
pub before: Option<Cow<'a, helix::CursorRef>>,
6767
/// Ending date/time for returned clips, in RFC3339 format. (Note that the seconds value is ignored.) If this is specified, started_at also must be specified; otherwise, the time period is ignored.
6868
#[cfg_attr(feature = "typed-builder", builder(default))]
6969
#[serde(borrow)]
@@ -199,7 +199,7 @@ impl Request for GetClipsRequest<'_> {
199199
impl RequestGet for GetClipsRequest<'_> {}
200200

201201
impl helix::Paginated for GetClipsRequest<'_> {
202-
fn set_pagination(&mut self, cursor: Option<helix::Cursor>) { self.after = cursor }
202+
fn set_pagination(&mut self, cursor: Option<helix::Cursor>) { self.after = cursor.map(|c| c.into_cow()) }
203203
}
204204

205205
#[cfg(test)]

src/helix/endpoints/eventsub/get_eventsub_subscriptions.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub struct GetEventSubSubscriptionsRequest<'a> {
2727
// FIXME: https://github.com/twitchdev/issues/issues/272
2828
/// Cursor for forward pagination
2929
#[cfg_attr(feature = "typed-builder", builder(default, setter(into)))]
30-
pub after: Option<helix::Cursor>,
30+
pub after: Option<Cow<'a, helix::CursorRef>>,
3131
// FIXME: https://github.com/twitchdev/issues/issues/271
3232
/// Maximum number of objects to return. Maximum: 100. Default: 20.
3333
#[cfg_attr(feature = "typed-builder", builder(default, setter(into)))]
@@ -124,7 +124,7 @@ impl RequestGet for GetEventSubSubscriptionsRequest<'_> {
124124
}
125125

126126
impl helix::Paginated for GetEventSubSubscriptionsRequest<'_> {
127-
fn set_pagination(&mut self, cursor: Option<helix::Cursor>) { self.after = cursor }
127+
fn set_pagination(&mut self, cursor: Option<helix::Cursor>) { self.after = cursor.map(|c| c.into_cow()) }
128128
}
129129

130130
#[cfg(test)]

src/helix/endpoints/games/get_top_games.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ use helix::RequestGet;
4848
pub struct GetTopGamesRequest<'a> {
4949
/// Cursor for forward pagination: tells the server where to start fetching the next set of results, in a multi-page response. The cursor value specified here is from the pagination response field of a prior query.
5050
#[cfg_attr(feature = "typed-builder", builder(default, setter(into)))]
51-
pub after: Option<helix::Cursor>,
51+
pub after: Option<Cow<'a, helix::CursorRef>>,
5252
/// Cursor for backward pagination: tells the server where to start fetching the next set of results, in a multi-page response. The cursor value specified here is from the pagination response field of a prior query.
5353
#[cfg_attr(feature = "typed-builder", builder(default, setter(into)))]
5454
#[serde(borrow)]
55-
pub before: Option<&'a helix::CursorRef>,
55+
pub before: Option<Cow<'a, helix::CursorRef>>,
5656
/// Maximum number of objects to return. Maximum: 100. Default: 20.
5757
#[cfg_attr(feature = "typed-builder", builder(default, setter(into)))]
5858
pub first: Option<usize>,
@@ -82,7 +82,7 @@ impl Request for GetTopGamesRequest<'_> {
8282
impl RequestGet for GetTopGamesRequest<'_> {}
8383

8484
impl helix::Paginated for GetTopGamesRequest<'_> {
85-
fn set_pagination(&mut self, cursor: Option<helix::Cursor>) { self.after = cursor }
85+
fn set_pagination(&mut self, cursor: Option<helix::Cursor>) { self.after = cursor.map(|c| c.into_cow()) }
8686
}
8787

8888
#[cfg(test)]

src/helix/endpoints/moderation/get_banned_users.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ pub struct GetBannedUsersRequest<'a> {
5555
pub user_id: Cow<'a, [&'a types::UserIdRef]>,
5656
/// Cursor for forward pagination: tells the server where to start fetching the next set of results, in a multi-page response. The cursor value specified here is from the pagination response field of a prior query.
5757
#[cfg_attr(feature = "typed-builder", builder(default))]
58-
pub after: Option<helix::Cursor>,
58+
pub after: Option<Cow<'a, helix::CursorRef>>,
5959
/// Cursor for backward pagination: tells the server where to start fetching the next set of results, in a multi-page response. The cursor value specified here is from the pagination response field of a prior query.
6060
#[cfg_attr(feature = "typed-builder", builder(default))]
6161
#[serde(borrow)]
62-
pub before: Option<&'a helix::CursorRef>,
62+
pub before: Option<Cow<'a, helix::CursorRef>>,
6363
/// Number of values to be returned per page. Limit: 100. Default: 20.
6464
#[cfg_attr(feature = "typed-builder", builder(setter(into), default))]
6565
pub first: Option<usize>,
@@ -128,7 +128,7 @@ impl Request for GetBannedUsersRequest<'_> {
128128
impl RequestGet for GetBannedUsersRequest<'_> {}
129129

130130
impl helix::Paginated for GetBannedUsersRequest<'_> {
131-
fn set_pagination(&mut self, cursor: Option<helix::Cursor>) { self.after = cursor }
131+
fn set_pagination(&mut self, cursor: Option<helix::Cursor>) { self.after = cursor.map(|c| c.into_cow()) }
132132
}
133133

134134
#[cfg(test)]

src/helix/endpoints/moderation/get_blocked_terms.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub struct GetBlockedTerms<'a> {
5757
pub first: Option<u32>,
5858
/// The cursor used to get the next page of results. The Pagination object in the response contains the cursor’s value.
5959
#[cfg_attr(feature = "typed-builder", builder(default))]
60-
pub after: Option<helix::Cursor>,
60+
pub after: Option<Cow<'a, helix::CursorRef>>,
6161
}
6262

6363
impl<'a> GetBlockedTerms<'a> {
@@ -98,7 +98,7 @@ impl Request for GetBlockedTerms<'_> {
9898
impl RequestGet for GetBlockedTerms<'_> {}
9999

100100
impl helix::Paginated for GetBlockedTerms<'_> {
101-
fn set_pagination(&mut self, cursor: Option<helix::Cursor>) { self.after = cursor }
101+
fn set_pagination(&mut self, cursor: Option<helix::Cursor>) { self.after = cursor.map(|c| c.into_cow()) }
102102
}
103103

104104
#[cfg(test)]

src/helix/endpoints/moderation/get_moderators.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pub struct GetModeratorsRequest<'a> {
5454
pub user_id: Cow<'a, [&'a types::UserIdRef]>,
5555
/// Cursor for forward pagination: tells the server where to start fetching the next set of results, in a multi-page response. The cursor value specified here is from the pagination response field of a prior query.
5656
#[cfg_attr(feature = "typed-builder", builder(default))]
57-
pub after: Option<helix::Cursor>,
57+
pub after: Option<Cow<'a, helix::CursorRef>>,
5858
/// Number of values to be returned per page. Limit: 100. Default: 20.
5959
#[cfg_attr(feature = "typed-builder", builder(setter(into), default))]
6060
pub first: Option<usize>,
@@ -110,7 +110,7 @@ impl Request for GetModeratorsRequest<'_> {
110110
impl RequestGet for GetModeratorsRequest<'_> {}
111111

112112
impl helix::Paginated for GetModeratorsRequest<'_> {
113-
fn set_pagination(&mut self, cursor: Option<helix::Cursor>) { self.after = cursor }
113+
fn set_pagination(&mut self, cursor: Option<helix::Cursor>) { self.after = cursor.map(|c| c.into_cow()) }
114114
}
115115

116116
#[cfg(test)]

src/helix/endpoints/points/get_custom_reward_redemption.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ pub struct GetCustomRewardRedemptionRequest<'a> {
6868

6969
/// Cursor for forward pagination: tells the server where to start fetching the next set of results, in a multi-page response. This applies only to queries without ID. If an ID is specified, it supersedes any cursor/offset combinations. The cursor value specified here is from the pagination response field of a prior query.
7070
#[cfg_attr(feature = "typed-builder", builder(default))]
71-
pub after: Option<helix::Cursor>,
71+
pub after: Option<Cow<'a, helix::CursorRef>>,
7272

7373
/// Number of results to be returned when getting the paginated Custom Reward Redemption objects for a reward. Limit: 50. Default: 20.
7474
#[cfg_attr(feature = "typed-builder", builder(default, setter(into)))]
@@ -174,7 +174,7 @@ impl Request for GetCustomRewardRedemptionRequest<'_> {
174174
impl RequestGet for GetCustomRewardRedemptionRequest<'_> {}
175175

176176
impl helix::Paginated for GetCustomRewardRedemptionRequest<'_> {
177-
fn set_pagination(&mut self, cursor: Option<helix::Cursor>) { self.after = cursor }
177+
fn set_pagination(&mut self, cursor: Option<helix::Cursor>) { self.after = cursor.map(|c| c.into_cow()) }
178178
}
179179

180180
#[cfg(test)]

src/helix/endpoints/polls/get_polls.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pub struct GetPollsRequest<'a> {
5454
pub id: Cow<'a, [&'a types::PollIdRef]>,
5555
/// Cursor for forward pagination
5656
#[cfg_attr(feature = "typed-builder", builder(default, setter(into)))]
57-
pub after: Option<helix::Cursor>,
57+
pub after: Option<Cow<'a, helix::CursorRef>>,
5858
/// Maximum number of objects to return. Maximum: 20. Default: 20.
5959
#[cfg_attr(feature = "typed-builder", builder(default, setter(into)))]
6060
pub first: Option<usize>,
@@ -128,7 +128,7 @@ impl Request for GetPollsRequest<'_> {
128128
impl RequestGet for GetPollsRequest<'_> {}
129129

130130
impl helix::Paginated for GetPollsRequest<'_> {
131-
fn set_pagination(&mut self, cursor: Option<helix::Cursor>) { self.after = cursor; }
131+
fn set_pagination(&mut self, cursor: Option<helix::Cursor>) { self.after = cursor.map(|c| c.into_cow()) }
132132
}
133133

134134
#[cfg(test)]

0 commit comments

Comments
 (0)