Skip to content

Commit

Permalink
Merge pull request #488 from vimeo/access-grant
Browse files Browse the repository at this point in the history
Support access grant property on TeamMembership
  • Loading branch information
anthonycr authored May 25, 2021
2 parents 0251626 + f091a44 commit fb088c6
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 0 deletions.
19 changes: 19 additions & 0 deletions models/src/main/java/com/vimeo/networking2/AccessGrant.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.vimeo.networking2

import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass

/**
* The access granted to a team member in a folder.
*
* @param folder The folder with the largest scope to which the user has been granted access.
* @param permissionPolicy The permissions that have been
*/
@JsonClass(generateAdapter = true)
data class AccessGrant(
@Json(name = "folder")
val folder: Folder? = null,

@Json(name = "permission_policy")
val permissionPolicy: PermissionPolicy? = null
)
28 changes: 28 additions & 0 deletions models/src/main/java/com/vimeo/networking2/PermissionActions.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.vimeo.networking2

import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass

/**
* The actions that can be taken by a team member in a folder.
*
* @param folderDeleteVideo True if the user can delete videos from the folder, false otherwise.
* @param folderEdit True if the user can edit the folder, false otherwise.
* @param folderInvite True if the user can invite others to the folder, false otherwise.
* @param folderView True if the user can view the folder, false otherwise.
*/
@JsonClass(generateAdapter = true)
data class PermissionActions(

@Json(name = "folder.delete_video")
val folderDeleteVideo: Boolean? = null,

@Json(name = "folder.edit")
val folderEdit: Boolean? = null,

@Json(name = "folder.invite")
val folderInvite: Boolean? = null,

@Json(name = "folder.view")
val folderView: Boolean? = null
)
20 changes: 20 additions & 0 deletions models/src/main/java/com/vimeo/networking2/PermissionPolicy.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.vimeo.networking2

import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass

/**
* The permission policy for a team member in a folder.
*
* @param name The name of the permission level the user has.
* @param permissionActions The actions the user can take.
*/
@JsonClass(generateAdapter = true)
data class PermissionPolicy(

@Json(name = "name")
val name: String? = null,

@Json(name = "permission_actions")
val permissionActions: PermissionActions? = null
)
4 changes: 4 additions & 0 deletions models/src/main/java/com/vimeo/networking2/TeamMembership.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import java.util.Date
/**
* Stores information related to relevant members of a team.
*
* @param accessGrant The grant that gives the team member access to the current context.
* @param uri The URI to independently request this team membership information.
* @param role The user's role on the team. See [TeamMembership.roleType].
* @param localizedRole A localized string for display purposes that names the user's role on the team. See [role].
Expand All @@ -30,6 +31,9 @@ import java.util.Date
@JsonClass(generateAdapter = true)
data class TeamMembership(

@Json(name = "access_grant")
val accessGrant: AccessGrant? = null,

@Json(name = "uri")
val uri: String? = null,

Expand Down
3 changes: 3 additions & 0 deletions models/src/test/java/com/vimeo/networking2/ModelsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import kotlin.reflect.full.primaryConstructor
class ModelsTest {

private val models = listOf(
AccessGrant::class,
AddSubfolderInteraction::class,
Album::class,
AlbumConnections::class,
Expand Down Expand Up @@ -88,6 +89,8 @@ class ModelsTest {
NotificationTypeCount::class,
Paging::class,
Periodic::class,
PermissionActions::class,
PermissionPolicy::class,
Picture::class,
PictureCollection::class,
PinCodeInfo::class,
Expand Down

0 comments on commit fb088c6

Please sign in to comment.