Skip to content

Commit

Permalink
Merge pull request #480 from vimeo/add-missing-folders-param
Browse files Browse the repository at this point in the history
Add missing folder URI parameter to change user membership functions
  • Loading branch information
anthonycr authored Apr 2, 2021
2 parents a54b741 + 282d432 commit 2af09c1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
6 changes: 6 additions & 0 deletions request/src/main/java/com/vimeo/networking2/VimeoApiClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1636,6 +1636,8 @@ interface VimeoApiClient {
*
* @param uri the URI from which content will be sent to.
* @param role The [TeamRoleType] that given user will be changed to.
* @param folderUri If the user is being changed to a [TeamRoleType.CONTRIBUTOR] or [TeamRoleType.VIEWER] a URI for
* the Folder they can contribute or view also needs to be added.
* @param queryParams Optional map used to refine the response from the API.
* @param callback The callback which will be notified of the request completion.
*
Expand All @@ -1644,6 +1646,7 @@ interface VimeoApiClient {
fun changeUserRole(
uri: String,
role: TeamRoleType,
folderUri: String?,
queryParams: Map<String, String>?,
callback: VimeoCallback<TeamMembership>
): VimeoRequest
Expand All @@ -1653,6 +1656,8 @@ interface VimeoApiClient {
*
* @param membership The [TeamMembership] of the User that will have their [TeamRoleType] changed.
* @param role The [TeamRoleType] that given user will be changed to.
* @param folder If the user is being changed to a [TeamRoleType.CONTRIBUTOR] or [TeamRoleType.VIEWER] the [Folder]
* they can contribute or view also needs to be added.
* @param queryParams Optional map used to refine the response from the API.
* @param callback The callback which will be notified of the request completion.
*
Expand All @@ -1661,6 +1666,7 @@ interface VimeoApiClient {
fun changeUserRole(
membership: TeamMembership,
role: TeamRoleType,
folder: Folder?,
queryParams: Map<String, String>?,
callback: VimeoCallback<TeamMembership>
): VimeoRequest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@ internal interface VimeoService {
@Header(AUTHORIZATION) authorization: String,
@Url uri: String,
@Field(PARAMETER_ROLE) role: TeamRoleType,
@Field(PARAMETER_FOLDER_URI) folderUri: String?,
@QueryMap queryParams: Map<String, @JvmSuppressWildcards String>
): VimeoCall<TeamMembership>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,16 +404,18 @@ internal class MutableVimeoApiClientDelegate(var actual: VimeoApiClient? = null)
override fun changeUserRole(
uri: String,
role: TeamRoleType,
folderUri: String?,
queryParams: Map<String, String>?,
callback: VimeoCallback<TeamMembership>
): VimeoRequest = client.changeUserRole(uri, role, queryParams, callback)
): VimeoRequest = client.changeUserRole(uri, role, folderUri, queryParams, callback)

override fun changeUserRole(
membership: TeamMembership,
role: TeamRoleType,
folder: Folder?,
queryParams: Map<String, String>?,
callback: VimeoCallback<TeamMembership>
): VimeoRequest = client.changeUserRole(membership, role, queryParams, callback)
): VimeoRequest = client.changeUserRole(membership, role, folder, queryParams, callback)

override fun grantTeamMembersFolderAccess(
uri: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -621,21 +621,25 @@ internal class VimeoApiClientImpl(
override fun changeUserRole(
uri: String,
role: TeamRoleType,
folderUri: String?,
queryParams: Map<String, String>?,
callback: VimeoCallback<TeamMembership>
): VimeoRequest {
val safeUri = uri.notEmpty() ?: return localVimeoCallAdapter.enqueueEmptyUri(callback)
return vimeoService.changeUserRole(authHeader, safeUri, role, queryParams.orEmpty()).enqueue(callback)
return vimeoService.changeUserRole(authHeader, safeUri, role, folderUri, queryParams.orEmpty())
.enqueue(callback)
}

override fun changeUserRole(
membership: TeamMembership,
role: TeamRoleType,
folder: Folder?,
queryParams: Map<String, String>?,
callback: VimeoCallback<TeamMembership>
): VimeoRequest {
val safeUri = membership.uri.notEmpty() ?: return localVimeoCallAdapter.enqueueEmptyUri(callback)
return vimeoService.changeUserRole(authHeader, safeUri, role, queryParams.orEmpty()).enqueue(callback)
return vimeoService.changeUserRole(authHeader, safeUri, role, folder?.uri, queryParams.orEmpty())
.enqueue(callback)
}

override fun grantTeamMembersFolderAccess(
Expand Down

0 comments on commit 2af09c1

Please sign in to comment.