Skip to content

Commit 8c6a2ca

Browse files
committed
Add documentation for optional User.ID methods
1 parent 6d975e4 commit 8c6a2ca

File tree

7 files changed

+23
-23
lines changed

7 files changed

+23
-23
lines changed

Sources/Twift+Blocks.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ extension Twift {
4545
///
4646
/// Equivalent to `POST /2/users/:id/blocking`
4747
/// - Parameters:
48-
/// - sourceUserId: The user ID who you would like to initiate the block on behalf of. It must match the user ID of the currently authenticated user.
48+
/// - sourceUserId: The user ID who you would like to initiate the block on behalf of. It must match the user ID of the currently authenticated user. When set to `nil`, this method will try to use the currently-authenticated user's ID.
4949
/// - targetUserId: The user ID of the user you would like the source user to block.
5050
/// - Returns: A ``BlockResponse`` indicating the blocked status.
5151
public func blockUser(sourceUserId: User.ID? = nil, targetUserId: User.ID) async throws -> TwitterAPIData<BlockResponse> {

Sources/Twift+Follows.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ extension Twift {
1414
///
1515
/// Equivalent to `GET /2/users/:id/following`.
1616
/// - Parameters:
17-
/// - userId: The user ID whose following you would like to retreive.
17+
/// - userId: The user ID whose following you would like to retreive. When set to `nil`, this method will try to use the currently-authenticated user's ID.
1818
/// - fields: Any additional fields to include on returned objects
1919
/// - expansions: Objects and their corresponding fields that should be expanded in the `includes` property
2020
/// - paginationToken: When iterating over pages of results, you can pass in the `nextToken` from the previously-returned value to get the next page of results
@@ -51,7 +51,7 @@ extension Twift {
5151
///
5252
/// Equivalent to `GET /2/users/:id/followers`.
5353
/// - Parameters:
54-
/// - userId: The user ID whose followers you would like to retrieve
54+
/// - userId: The user ID whose followers you would like to retrieve. When set to `nil`, this method will try to use the currently-authenticated user's ID.
5555
/// - fields: Any additional fields to include on returned objects
5656
/// - expansions: Objects and their corresponding fields that should be expanded in the `includes` property
5757
/// - paginationToken: When iterating over pages of results, you can pass in the `nextToken` from the previously-returned value to get the next page of results
@@ -93,7 +93,7 @@ extension Twift {
9393
///
9494
/// The request succeeds with no action when the authenticated user sends a request to a user they're already following, or if they're sending a follower request to a user that does not have public Tweets.
9595
/// - Parameters:
96-
/// - sourceUserId: The authenticated user ID who you would like to initiate the follow on behalf of.
96+
/// - sourceUserId: The authenticated user ID who you would like to initiate the follow on behalf of. When set to `nil`, this method will try to use the currently-authenticated user's ID.
9797
/// - targetUserId: The user ID of the user that you would like the `sourceUserId` to follow.
9898
/// - Returns: A ``FollowResponse`` indicating whether the source user is now following the target user, and whether the follow request is pending
9999
public func followUser(
@@ -115,7 +115,7 @@ extension Twift {
115115
///
116116
/// The request succeeds with no action when the authenticated user sends a request to a user they're not following or have already unfollowed.
117117
/// - Parameters:
118-
/// - sourceUserId: The authenticated user ID who you would like to initiate the unfollow on behalf of.
118+
/// - sourceUserId: The authenticated user ID who you would like to initiate the unfollow on behalf of. When set to `nil`, this method will try to use the currently-authenticated user's ID.
119119
/// - targetUserId: The user ID of the user that you would like the `sourceUserId` to unfollow.
120120
/// - Returns: A ``FollowResponse`` indicating whether the source user is now following the target user
121121
public func unfollowUser(sourceUserId: User.ID? = nil,

Sources/Twift+Likes.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ extension Twift {
66
/// Equivalent to `POST /2/users/:user_id/likes`
77
/// - Parameters:
88
/// - tweetId: The ID of the Tweet that you would like the `userId` to Like.
9-
/// - userId: The user ID who you are liking a Tweet on behalf of. It must match your own user ID or that of an authenticating user.
9+
/// - userId: The user ID who you are liking a Tweet on behalf of. It must match your own user ID or that of an authenticating user. When set to `nil`, this method will try to use the currently-authenticated user's ID.
1010
/// - Returns: A response object containing a ``LikeResponse``
1111
public func likeTweet(_ tweetId: Tweet.ID, userId: User.ID? = nil) async throws -> TwitterAPIData<LikeResponse> {
1212
guard let userId = userId ?? authenticatedUserId else { throw TwiftError.MissingUserID }
@@ -25,7 +25,7 @@ extension Twift {
2525
/// Equivalent to `DELETE /2/users/:user_id/likes/:tweet_id`
2626
/// - Parameters:
2727
/// - tweetId: The ID of the Tweet that you would like the `userId` to unlike.
28-
/// - userId: The user ID who you are removing Like of a Tweet on behalf of. It must match your own user ID or that of an authenticating user.
28+
/// - userId: The user ID who you are removing Like of a Tweet on behalf of. It must match your own user ID or that of an authenticating user. When set to `nil`, this method will try to use the currently-authenticated user's ID.
2929
/// - Returns: A response object containing a ``LikeResponse``
3030
public func unlikeTweet(_ tweetId: Tweet.ID, userId: User.ID? = nil) async throws -> TwitterAPIData<LikeResponse> {
3131
guard let userId = userId ?? authenticatedUserId else { throw TwiftError.MissingUserID }
@@ -59,7 +59,7 @@ extension Twift {
5959
///
6060
/// Equivalent to `GET /2/users/:id/liked_tweets`
6161
/// - Parameters:
62-
/// - userId: User ID of the user to request liked Tweets for.
62+
/// - userId: User ID of the user to request liked Tweets for. When set to `nil`, this method will try to use the currently-authenticated user's ID.
6363
/// - fields: Any additional fields to include on returned objects
6464
/// - expansions: Objects and their corresponding fields that should be expanded in the `includes` property
6565
/// - paginationToken: This parameter is used to move forwards or backwards through 'pages' of results, based on the value of the next_token or previous_token in the response.

Sources/Twift+Lists.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ extension Twift {
6262
///
6363
/// Equivalent to `GET /2/user/:user_id/owned_lists`
6464
/// - Parameters:
65-
/// - userId: The user ID whose owned Lists you would like to retrieve.
65+
/// - userId: The user ID whose owned Lists you would like to retrieve. When set to `nil`, this method will try to use the currently-authenticated user's ID.
6666
/// - fields: Any additional fields to include on returned objects
6767
/// - expansions: Objects and their corresponding fields that should be expanded in the `includes` property
6868
/// - paginationToken: When iterating over pages of results, you can pass in the `nextToken` from the previously-returned value to get the next page of results
@@ -112,7 +112,7 @@ extension Twift {
112112
///
113113
/// Equivalent to `GET /2/user/:user_id/list_memberships`
114114
/// - Parameters:
115-
/// - userId: The user ID whose List memberships you would like to retrieve
115+
/// - userId: The user ID whose List memberships you would like to retrieve. When set to `nil`, this method will try to use the currently-authenticated user's ID.
116116
/// - fields: Any additional fields to include on returned objects
117117
/// - expansions: Objects and their corresponding fields that should be expanded in the `includes` property
118118
/// - paginationToken: When iterating over pages of results, you can pass in the `nextToken` from the previously-returned value to get the next page of results
@@ -218,7 +218,7 @@ extension Twift {
218218
/// Enables the authenticated user to unfollow a List.
219219
/// - Parameters:
220220
/// - listId: The ID of the List that you would like the user id to unfollow.
221-
/// - userId: The user ID who you are unfollowing a List on behalf of. It must match your own user ID or that of an authenticating user
221+
/// - userId: The user ID who you are unfollowing a List on behalf of. It must match your own user ID or that of an authenticating user. When set to `nil`, this method will try to use the currently-authenticated user's ID.
222222
/// - Returns: A response object containing the result of the unfollow request
223223
public func unfollowList(_ listId: List.ID, userId: User.ID? = nil) async throws -> TwitterAPIData<FollowResponse> {
224224
guard let userId = userId ?? authenticatedUserId else { throw TwiftError.MissingUserID }
@@ -231,7 +231,7 @@ extension Twift {
231231
/// Enables the authenticated user to follow a List.
232232
/// - Parameters:
233233
/// - listId: The ID of the List that you would like the user id to follow.
234-
/// - userId: The user ID who you are following a List on behalf of. It must match your own user ID or that of an authenticating user
234+
/// - userId: The user ID who you are following a List on behalf of. It must match your own user ID or that of an authenticating user. When set to `nil`, this method will try to use the currently-authenticated user's ID.
235235
/// - Returns: A response object containing the result of the follow request
236236
public func followList(_ listId: List.ID, userId: User.ID? = nil) async throws -> TwitterAPIData<FollowResponse> {
237237
guard let userId = userId ?? authenticatedUserId else { throw TwiftError.MissingUserID }
@@ -277,7 +277,7 @@ extension Twift {
277277

278278
/// Returns all Lists a specified user follows.
279279
/// - Parameters:
280-
/// - userId: The user ID whose followed Lists you would like to retrieve.
280+
/// - userId: The user ID whose followed Lists you would like to retrieve. When set to `nil`, this method will try to use the currently-authenticated user's ID.
281281
/// - fields: Any additional fields to include on returned objects
282282
/// - expansions: Objects and their corresponding fields that should be expanded in the `includes` property
283283
/// - paginationToken: When iterating over pages of results, you can pass in the `nextToken` from the previously-returned value to get the next page of results
@@ -319,7 +319,7 @@ extension Twift {
319319
/// Equivalent to `POST /2/users/:user_id/pinned_lists`
320320
/// - Parameters:
321321
/// - listId: The ID of the List that you would like the user id to pin.
322-
/// - userId: The user ID who you are pinning a List on behalf of. It must match your own user ID or that of an authenticating user
322+
/// - userId: The user ID who you are pinning a List on behalf of. It must match your own user ID or that of an authenticating user. When set to `nil`, this method will try to use the currently-authenticated user's ID.
323323
/// - Returns: A response object containing the result of this pin list request
324324
public func pinList(_ listId: List.ID, userId: User.ID? = nil) async throws -> TwitterAPIData<PinnedResponse> {
325325
guard let userId = userId ?? authenticatedUserId else { throw TwiftError.MissingUserID }
@@ -337,7 +337,7 @@ extension Twift {
337337
/// Equivalent to `DELETE /2/users/:user_id/pinned_lists/:list_id`
338338
/// - Parameters:
339339
/// - listId: The ID of the List that you would like the user id to unpin.
340-
/// - userId: The user ID who you are unpinning a List on behalf of. It must match your own user ID or that of an authenticating user
340+
/// - userId: The user ID who you are unpinning a List on behalf of. It must match your own user ID or that of an authenticating user. When set to `nil`, this method will try to use the currently-authenticated user's ID.
341341
/// - Returns: A response object containing the result of this unpin list request
342342
public func unpinList(_ listId: List.ID, userId: User.ID? = nil) async throws -> TwitterAPIData<PinnedResponse> {
343343
guard let userId = userId ?? authenticatedUserId else { throw TwiftError.MissingUserID }
@@ -349,7 +349,7 @@ extension Twift {
349349

350350
/// Returns all Lists a specified user has pinned.
351351
/// - Parameters:
352-
/// - userId: The user ID whose pinned Lists you would like to retrieve.
352+
/// - userId: The user ID whose pinned Lists you would like to retrieve. When set to `nil`, this method will try to use the currently-authenticated user's ID.
353353
/// - fields: Any additional fields to include on returned objects
354354
/// - expansions: Objects and their corresponding fields that should be expanded in the `includes` property
355355
/// - Returns: A response object containing an array of lists pinned by the user, any requested expansions, and a meta object with pagination information

Sources/Twift+Mutes.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ extension Twift {
77
///
88
/// Equivalent to `GET /2/users/:id/muting`.
99
/// - Parameters:
10-
/// - userId: The user ID whose muted users you would like to retrieve
10+
/// - userId: The user ID whose muted users you would like to retrieve. When set to `nil`, this method will try to use the currently-authenticated user's ID.
1111
/// - fields: Any additional fields to include on returned objects
1212
/// - expansions: Objects and their corresponding fields that should be expanded in the `includes` property
1313
/// - paginationToken: When iterating over pages of results, you can pass in the `nextToken` from the previously-returned value to get the next page of results
@@ -44,7 +44,7 @@ extension Twift {
4444
///
4545
/// Equivalent to `POST /2/users/:id/muting`
4646
/// - Parameters:
47-
/// - sourceUserId: The user ID who you would like to initiate the mute on behalf of. It must match the user ID of the currently authenticated user.
47+
/// - sourceUserId: The user ID who you would like to initiate the mute on behalf of. It must match the user ID of the currently authenticated user. When set to `nil`, this method will try to use the currently-authenticated user's ID.
4848
/// - targetUserId: The user ID of the user you would like the source user to mute.
4949
/// - Returns: A ``MuteResponse`` indicating the muted status.
5050
public func muteUser(sourceUserId: User.ID? = nil, targetUserId: User.ID) async throws -> TwitterAPIData<MuteResponse> {
@@ -62,7 +62,7 @@ extension Twift {
6262
///
6363
/// Equivalent to `DELETE /2/users/:source_user_id/muting/:target_user_id`
6464
/// - Parameters:
65-
/// - sourceUserId: The user ID who you would like to initiate the mute on behalf of. It must match the user ID of the currently authenticated user.
65+
/// - sourceUserId: The user ID who you would like to initiate the mute on behalf of. It must match the user ID of the currently authenticated user. When set to `nil`, this method will try to use the currently-authenticated user's ID.
6666
/// - targetUserId: The user ID of the user you would like the source user to mute.
6767
/// - Returns: A ``MuteResponse`` indicating the muted status.
6868
public func unmuteUser(sourceUserId: User.ID? = nil, targetUserId: User.ID) async throws -> TwitterAPIData<MuteResponse> {

Sources/Twift+Retweets.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ extension Twift {
66
/// Equivalent to `POST /2/users/:user_id/retweets`
77
/// - Parameters:
88
/// - tweetId: The ID of the Tweet that you would like the `userId` to Retweet.
9-
/// - userId: The user ID who you are Retweeting a Tweet on behalf of. It must match your own user ID or that of an authenticating user.
9+
/// - userId: The user ID who you are Retweeting a Tweet on behalf of. It must match your own user ID or that of an authenticating user. When set to `nil`, this method will try to use the currently-authenticated user's ID.
1010
/// - Returns: A response object containing the result of the request
1111
public func retweet(_ tweetId: Tweet.ID, userId: User.ID? = nil) async throws -> TwitterAPIData<RetweetResponse> {
1212
guard let userId = userId ?? authenticatedUserId else { throw TwiftError.MissingUserID }
@@ -25,7 +25,7 @@ extension Twift {
2525
/// Equivalent to `DELETE /2/users/:user_id/retweets/:tweet_id`
2626
/// - Parameters:
2727
/// - tweetId: The ID of the Tweet that you would like the `userId` to remove the Retweet of.
28-
/// - userId: The user ID who you are removing a the Retweet of a Tweet on behalf of. It must match your own user ID or that of an authenticating user.
28+
/// - userId: The user ID who you are removing a the Retweet of a Tweet on behalf of. It must match your own user ID or that of an authenticating user. When set to `nil`, this method will try to use the currently-authenticated user's ID.
2929
/// - Returns: A response object containing the result of the request
3030
public func unretweet(_ tweetId: Tweet.ID, userId: User.ID? = nil) async throws -> TwitterAPIData<RetweetResponse> {
3131
guard let userId = userId ?? authenticatedUserId else { throw TwiftError.MissingUserID }

Sources/Twift+Tweets.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ extension Twift {
4646
///
4747
/// Equivalent to `GET /2/users/:id/timeline`
4848
/// - Parameters:
49-
/// - userId: Unique identifier of the Twitter account (user ID) for whom to return results.
49+
/// - userId: Unique identifier of the Twitter account (user ID) for whom to return results. When set to `nil`, this method will try to use the currently-authenticated user's ID.
5050
/// - startTime: The oldest or earliest UTC timestamp from which the Tweets will be provided. Only the 3200 most recent Tweets are available. Timestamp is in second granularity and is inclusive (for example, 12:00:01 includes the first second of the minute). Minimum allowable time is 2010-11-06T00:00:00Z
5151
/// - endTime: The newest or most recent UTC timestamp from which the Tweets will be provided. Only the 3200 most recent Tweets are available. Timestamp is in second granularity and is inclusive (for example, 12:00:01 includes the first second of the minute). Minimum allowable time is 2010-11-06T00:00:01Z
5252
/// - exclude: Comma-separated list of the types of Tweets to exclude from the response. When exclude=retweets is used, the maximum historical Tweets returned is still 3200. When the exclude=replies parameter is used for any value, only the most recent 800 Tweets are available.
@@ -95,7 +95,7 @@ extension Twift {
9595
///
9696
/// Equivalent to `GET /2/users/:id/mentions`
9797
/// - Parameters:
98-
/// - userId: Unique identifier of the Twitter account (user ID) for whom to return results.
98+
/// - userId: Unique identifier of the Twitter account (user ID) for whom to return results. When set to `nil`, this method will try to use the currently-authenticated user's ID.
9999
/// - startTime: The oldest or earliest UTC timestamp from which the Tweets will be provided. Only the 3200 most recent Tweets are available. Timestamp is in second granularity and is inclusive (for example, 12:00:01 includes the first second of the minute). Minimum allowable time is 2010-11-06T00:00:00Z
100100
/// - endTime: The newest or most recent UTC timestamp from which the Tweets will be provided. Only the 3200 most recent Tweets are available. Timestamp is in second granularity and is inclusive (for example, 12:00:01 includes the first second of the minute). Minimum allowable time is 2010-11-06T00:00:01Z
101101
/// - exclude: Comma-separated list of the types of Tweets to exclude from the response. When exclude=retweets is used, the maximum historical Tweets returned is still 3200. When the exclude=replies parameter is used for any value, only the most recent 800 Tweets are available.

0 commit comments

Comments
 (0)