-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #402 from vimeo/VA-4132-Connected-Apps
VA-4132 connected apps
- Loading branch information
Showing
21 changed files
with
604 additions
and
11 deletions.
There are no files selected for viewing
85 changes: 85 additions & 0 deletions
85
models/src/main/java/com/vimeo/networking2/ConnectedApp.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
package com.vimeo.networking2 | ||
|
||
import com.squareup.moshi.Json | ||
import com.squareup.moshi.JsonClass | ||
import com.vimeo.networking2.common.Entity | ||
import com.vimeo.networking2.enums.ConnectedAppType | ||
import com.vimeo.networking2.enums.asEnum | ||
import java.util.* | ||
|
||
/** | ||
* A [ConnectedApp] represents a connection to a social media platform. Some activities, like simultaneously live | ||
* stream to multiple destinations, or publishing across platforms, require requesting specific scopes. The scopes | ||
* required will always be returned in the [neededScopes] array. | ||
* - Note: Some properties are specific to a particular platform. These cases have been noted in the documentation | ||
* where relevant. | ||
*/ | ||
@JsonClass(generateAdapter = true) | ||
data class ConnectedApp( | ||
|
||
/** | ||
* The time in ISO 8601 format when the connected app was added. | ||
*/ | ||
@Json(name = "add_date") | ||
var dateAdded: Date? = null, | ||
|
||
/** | ||
* The list of remaining scopes on this connected app that the user needs for a particular feature. | ||
*/ | ||
@Json(name = "needed_scopes") | ||
val neededScopes: ConnectedScopes? = null, | ||
|
||
/** | ||
* The list of third party pages that is associated with the user's account (Facebook and LinkedIn only). | ||
*/ | ||
@Json(name = "pages") | ||
val pages: List<PublishOptionItem>? = null, | ||
|
||
/** | ||
* The list of third party categories that can be selected for a publish to social | ||
* job (Facebook and YouTube only). | ||
*/ | ||
@Json(name = "publish_categories") | ||
val publishCategories: List<PublishOptionItem>? = null, | ||
|
||
/** | ||
* The unique identifier for the user on this connected app. | ||
*/ | ||
@Json(name = "third_party_user_id") | ||
val userId: String? = null, | ||
|
||
/** | ||
* The user's display name on the connected app. | ||
*/ | ||
@Json(name = "third_party_user_display_name") | ||
val userName: String? = null, | ||
|
||
/** | ||
* The API URI of this connected app. | ||
*/ | ||
@Json(name = "uri") | ||
val uri: String? = null, | ||
|
||
/** | ||
* Whether or not the user's data access is expired (Facebook only). | ||
*/ | ||
@Json(name = "data_access_is_expired") | ||
val isDataAccessExpired: Boolean? = null, | ||
|
||
/** | ||
* The [ConnectedAppType] of the connected app. | ||
*/ | ||
@Json(name = "type") | ||
val rawType: String? = null | ||
|
||
) : Entity { | ||
override val identifier: String? = uri | ||
} | ||
|
||
|
||
/** | ||
* @see ConnectedApp.rawType | ||
* @see ConnectedAppType | ||
*/ | ||
val ConnectedApp.type: ConnectedAppType | ||
get() = rawType.asEnum(ConnectedAppType.UNKNOWN) |
31 changes: 31 additions & 0 deletions
31
models/src/main/java/com/vimeo/networking2/ConnectedAppInteraction.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.vimeo.networking2 | ||
|
||
import com.squareup.moshi.Json | ||
import com.squareup.moshi.JsonClass | ||
import com.vimeo.networking2.common.Interaction | ||
|
||
/** | ||
* All of the interactions for a connected app. | ||
*/ | ||
@JsonClass(generateAdapter = true) | ||
data class ConnectedAppInteraction( | ||
|
||
@Json(name = "options") | ||
override val options: List<String>? = null, | ||
|
||
@Json(name = "uri") | ||
override val uri: String? = null, | ||
|
||
/** | ||
* Whether an app is connected or not. | ||
*/ | ||
@Json(name = "is_connected") | ||
val isConnected: Boolean? = null, | ||
|
||
/** | ||
* Provides the lists of scopes that are required for third-party connected app features. | ||
*/ | ||
@Json(name = "all_scopes") | ||
val allScopes: ConnectedScopes? = null | ||
|
||
) : Interaction |
28 changes: 28 additions & 0 deletions
28
models/src/main/java/com/vimeo/networking2/ConnectedAppList.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
import com.vimeo.networking2.common.Pageable | ||
|
||
/** | ||
* List of the logged in user's [ConnectedApps][ConnectedApp]. | ||
*/ | ||
@JsonClass(generateAdapter = true) | ||
data class ConnectedAppList( | ||
|
||
@Json(name = "total") | ||
override val total: Int? = null, | ||
|
||
@Json(name = "page") | ||
override val page: Int? = null, | ||
|
||
@Json(name = "per_page") | ||
override val perPage: Int? = null, | ||
|
||
@Json(name = "paging") | ||
override val paging: Paging? = null, | ||
|
||
@Json(name = "data") | ||
override val data: List<ConnectedApp>? = null | ||
|
||
) : Pageable<ConnectedApp> |
23 changes: 23 additions & 0 deletions
23
models/src/main/java/com/vimeo/networking2/ConnectedScopes.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.vimeo.networking2 | ||
|
||
import com.squareup.moshi.Json | ||
import com.squareup.moshi.JsonClass | ||
|
||
/** | ||
* Provides the lists of scopes that are required for third-party connected app features. | ||
*/ | ||
@JsonClass(generateAdapter = true) | ||
data class ConnectedScopes( | ||
|
||
/** | ||
* All scopes required for publishing to a specific social media platform. | ||
*/ | ||
@Json(name = "publish_to_social") | ||
val publishToSocial: List<String>? = null, | ||
|
||
/** | ||
* All scopes required for simulcasting to a specific social media platform. | ||
*/ | ||
@Json(name = "simulcast") | ||
val simulcast: List<String>? = null | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
models/src/main/java/com/vimeo/networking2/PublishOptionItem.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.vimeo.networking2 | ||
|
||
import com.squareup.moshi.Json | ||
import com.squareup.moshi.JsonClass | ||
import com.vimeo.networking2.common.Entity | ||
|
||
/** | ||
* A page or category that can be sent when publishing to a social media platform. | ||
*/ | ||
@JsonClass(generateAdapter = true) | ||
data class PublishOptionItem( | ||
|
||
/** | ||
* The ID of the publish item. | ||
*/ | ||
@Json(name = "id") | ||
val id: String? = null, | ||
|
||
/** | ||
* The name or display name of the publish item, i.e.: "art", "family", "vacation" etc. | ||
*/ | ||
@Json(name = "name") | ||
val name: String? = null | ||
|
||
) : Entity { | ||
|
||
override val identifier: String? = id | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
models/src/main/java/com/vimeo/networking2/enums/ConnectedAppType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.vimeo.networking2.enums | ||
|
||
/** | ||
* An enumeration of the supported connected app types. | ||
*/ | ||
enum class ConnectedAppType(override val value: String?) : StringValue { | ||
|
||
/** | ||
* Represents a connection to Facebook. | ||
*/ | ||
FACEBOOK("facebook"), | ||
|
||
/** | ||
* Represents a connection to LinkedIn. | ||
*/ | ||
LINKED_IN("linkedin"), | ||
|
||
/** | ||
* Represents a connection to Twitter. | ||
*/ | ||
TWITTER("twitter"), | ||
|
||
/** | ||
* Represents a connection to YouTube. | ||
*/ | ||
YOUTUBE("youtube"), | ||
|
||
/** | ||
* Unknown connection type. | ||
*/ | ||
UNKNOWN(null); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.