Skip to content

Commit fb088c6

Browse files
authored
Merge pull request #488 from vimeo/access-grant
Support access grant property on TeamMembership
2 parents 0251626 + f091a44 commit fb088c6

File tree

5 files changed

+74
-0
lines changed

5 files changed

+74
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.vimeo.networking2
2+
3+
import com.squareup.moshi.Json
4+
import com.squareup.moshi.JsonClass
5+
6+
/**
7+
* The access granted to a team member in a folder.
8+
*
9+
* @param folder The folder with the largest scope to which the user has been granted access.
10+
* @param permissionPolicy The permissions that have been
11+
*/
12+
@JsonClass(generateAdapter = true)
13+
data class AccessGrant(
14+
@Json(name = "folder")
15+
val folder: Folder? = null,
16+
17+
@Json(name = "permission_policy")
18+
val permissionPolicy: PermissionPolicy? = null
19+
)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.vimeo.networking2
2+
3+
import com.squareup.moshi.Json
4+
import com.squareup.moshi.JsonClass
5+
6+
/**
7+
* The actions that can be taken by a team member in a folder.
8+
*
9+
* @param folderDeleteVideo True if the user can delete videos from the folder, false otherwise.
10+
* @param folderEdit True if the user can edit the folder, false otherwise.
11+
* @param folderInvite True if the user can invite others to the folder, false otherwise.
12+
* @param folderView True if the user can view the folder, false otherwise.
13+
*/
14+
@JsonClass(generateAdapter = true)
15+
data class PermissionActions(
16+
17+
@Json(name = "folder.delete_video")
18+
val folderDeleteVideo: Boolean? = null,
19+
20+
@Json(name = "folder.edit")
21+
val folderEdit: Boolean? = null,
22+
23+
@Json(name = "folder.invite")
24+
val folderInvite: Boolean? = null,
25+
26+
@Json(name = "folder.view")
27+
val folderView: Boolean? = null
28+
)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.vimeo.networking2
2+
3+
import com.squareup.moshi.Json
4+
import com.squareup.moshi.JsonClass
5+
6+
/**
7+
* The permission policy for a team member in a folder.
8+
*
9+
* @param name The name of the permission level the user has.
10+
* @param permissionActions The actions the user can take.
11+
*/
12+
@JsonClass(generateAdapter = true)
13+
data class PermissionPolicy(
14+
15+
@Json(name = "name")
16+
val name: String? = null,
17+
18+
@Json(name = "permission_actions")
19+
val permissionActions: PermissionActions? = null
20+
)

models/src/main/java/com/vimeo/networking2/TeamMembership.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import java.util.Date
1111
/**
1212
* Stores information related to relevant members of a team.
1313
*
14+
* @param accessGrant The grant that gives the team member access to the current context.
1415
* @param uri The URI to independently request this team membership information.
1516
* @param role The user's role on the team. See [TeamMembership.roleType].
1617
* @param localizedRole A localized string for display purposes that names the user's role on the team. See [role].
@@ -30,6 +31,9 @@ import java.util.Date
3031
@JsonClass(generateAdapter = true)
3132
data class TeamMembership(
3233

34+
@Json(name = "access_grant")
35+
val accessGrant: AccessGrant? = null,
36+
3337
@Json(name = "uri")
3438
val uri: String? = null,
3539

models/src/test/java/com/vimeo/networking2/ModelsTest.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import kotlin.reflect.full.primaryConstructor
77
class ModelsTest {
88

99
private val models = listOf(
10+
AccessGrant::class,
1011
AddSubfolderInteraction::class,
1112
Album::class,
1213
AlbumConnections::class,
@@ -88,6 +89,8 @@ class ModelsTest {
8889
NotificationTypeCount::class,
8990
Paging::class,
9091
Periodic::class,
92+
PermissionActions::class,
93+
PermissionPolicy::class,
9194
Picture::class,
9295
PictureCollection::class,
9396
PinCodeInfo::class,

0 commit comments

Comments
 (0)