From 2f94948c960bccf46d979da9b69d9758f6a0d874 Mon Sep 17 00:00:00 2001 From: Howard Rigberg Date: Mon, 25 Nov 2019 13:40:54 -0500 Subject: [PATCH 01/10] adding support for connected_apps endpoint --- .../main/java/com/vimeo/networking/Vimeo.java | 4 + .../com/vimeo/networking/VimeoClient.java | 80 +++++ .../com/vimeo/networking/VimeoService.java | 25 ++ .../model/ConnectionCollection.java | 17 ++ .../vimeo/networking/model/Interaction.java | 18 ++ .../model/InteractionCollection.java | 76 +++++ .../model/connectedapp/ConnectedApp.java | 275 ++++++++++++++++++ .../model/connectedapp/ConnectedAppList.java | 19 ++ .../model/connectedapp/ConnectedScopes.java | 53 ++++ .../model/connectedapp/PublishOptionItem.java | 83 ++++++ .../networking/utils/VimeoNetworkUtil.java | 35 +++ 11 files changed, 685 insertions(+) create mode 100644 vimeo-networking/src/main/java/com/vimeo/networking/model/connectedapp/ConnectedApp.java create mode 100644 vimeo-networking/src/main/java/com/vimeo/networking/model/connectedapp/ConnectedAppList.java create mode 100644 vimeo-networking/src/main/java/com/vimeo/networking/model/connectedapp/ConnectedScopes.java create mode 100644 vimeo-networking/src/main/java/com/vimeo/networking/model/connectedapp/PublishOptionItem.java diff --git a/vimeo-networking/src/main/java/com/vimeo/networking/Vimeo.java b/vimeo-networking/src/main/java/com/vimeo/networking/Vimeo.java index ebd705f23..0737aa382 100644 --- a/vimeo-networking/src/main/java/com/vimeo/networking/Vimeo.java +++ b/vimeo-networking/src/main/java/com/vimeo/networking/Vimeo.java @@ -87,6 +87,10 @@ public final class Vimeo { public static final String PARAMETER_ALBUM_PRIVACY = "privacy"; public static final String PARAMETER_ALBUM_PASSWORD = "password"; + public static final String PARAMETER_ACCESS_TOKEN = "access_token"; + public static final String PARAMETER_ACCESS_TOKEN_SECRET = "access_token_secret"; + public static final String PARAMETER_AUTH_CODE = "auth_code"; + public static final String PARAMETER_COMMENT_TEXT_BODY = "text"; public static final String PARAMETER_ACTIVE = "active"; diff --git a/vimeo-networking/src/main/java/com/vimeo/networking/VimeoClient.java b/vimeo-networking/src/main/java/com/vimeo/networking/VimeoClient.java index 6e97e870f..3dc5768c0 100644 --- a/vimeo-networking/src/main/java/com/vimeo/networking/VimeoClient.java +++ b/vimeo-networking/src/main/java/com/vimeo/networking/VimeoClient.java @@ -45,6 +45,8 @@ import com.vimeo.networking.model.Video; import com.vimeo.networking.model.VideoList; import com.vimeo.networking.model.VimeoAccount; +import com.vimeo.networking.model.connectedapp.ConnectedApp; +import com.vimeo.networking.model.connectedapp.ConnectedAppList; import com.vimeo.networking.model.error.ErrorCode; import com.vimeo.networking.model.error.LocalErrorCode; import com.vimeo.networking.model.error.VimeoError; @@ -1257,6 +1259,84 @@ public Call editSubscriptions(@NotNull Map + // ----------------------------------------------------------------------------------------------------- + // Conected Apps + // ----------------------------------------------------------------------------------------------------- + // + + /** + * Gets a {@link ConnectedAppList} for the authorized user. + * + * @param callback The callback to be invoked when the request finishes. + * @return A {@link Call} object. + */ + @NotNull + public Call getConnectedApps(@NotNull VimeoCallback callback) { + final Call call = mVimeoService.getConnectedApps(getAuthHeader()); + call.enqueue(callback); + return call; + } + + /** + * Gets a {@link ConnectedApp} for the authorized user for a specific {@link ConnectedApp.ConnectedAppType}. + * + * @param callback The callback to be invoked when the request finishes. + * @param type The {@link ConnectedApp.ConnectedAppType} of the {@link ConnectedApp} to return. + * @return A {@link Call} object. + */ + @NotNull + public Call getConnectedApp(@NotNull VimeoCallback callback, + @NotNull ConnectedApp.ConnectedAppType type) { + final Call call = mVimeoService.getConnectedApp(getAuthHeader(), type.toString()); + call.enqueue(callback); + return call; + } + + /** + * Creates a {@link ConnectedApp} for the authorized user for a specific {@link ConnectedApp.ConnectedAppType}. + * + * @param callback The callback to be invoked when the request finishes. + * @param type The {@link ConnectedApp.ConnectedAppType} of the {@link ConnectedApp} to create. + * @param authorization An authorization string for the third party platform. The nature of the string will + * vary depending upon the {@link ConnectedApp.ConnectedAppType} but should never be + * empty or the request will fail. + * @return A Call object or null if a client-side initialization error has occurred. In the event of an error, + * the callback will still be notified. + */ + @Nullable + public Call createConnectedApp(@NotNull VimeoCallback callback, + @NotNull ConnectedApp.ConnectedAppType type, + @NotNull String authorization) { + String auth = null; + Map params = + VimeoNetworkUtil.prepareConnectedAppCreateParameters(type, authorization, callback); + if (params == null) { + return null; + } + final Call call = mVimeoService.createConnectedApp(getAuthHeader(), type.toString(), params); + call.enqueue(callback); + return call; + } + + /** + * Deletes a {@link ConnectedApp} for the authorized user for a specific {@link ConnectedApp.ConnectedAppType}. + * + * @param callback The callback to be invoked when the request finishes. + * @param type The {@link ConnectedApp.ConnectedAppType} of the {@link ConnectedApp} to delete. + * @return A {@link Call} object. + */ + @Nullable + public Call deleteConnectedApps(@NotNull VimeoCallback callback, + @NotNull ConnectedApp.ConnectedAppType type) { + final Call call = mVimeoService.deleteConnectedApp(getAuthHeader(), type.toString()); + call.enqueue(callback); + return call; + } + + // + + // + // ----------------------------------------------------------------------------------------------------- // Documents // ----------------------------------------------------------------------------------------------------- diff --git a/vimeo-networking/src/main/java/com/vimeo/networking/VimeoService.java b/vimeo-networking/src/main/java/com/vimeo/networking/VimeoService.java index 47a0494b6..51ddeb624 100644 --- a/vimeo-networking/src/main/java/com/vimeo/networking/VimeoService.java +++ b/vimeo-networking/src/main/java/com/vimeo/networking/VimeoService.java @@ -48,6 +48,8 @@ import com.vimeo.networking.model.VimeoAccount; import com.vimeo.networking.model.appconfiguration.AppConfiguration; import com.vimeo.networking.model.cinema.ProgramContentItemList; +import com.vimeo.networking.model.connectedapp.ConnectedApp; +import com.vimeo.networking.model.connectedapp.ConnectedAppList; import com.vimeo.networking.model.iap.Product; import com.vimeo.networking.model.iap.Products; import com.vimeo.networking.model.live.LiveStats; @@ -74,6 +76,7 @@ import retrofit2.http.PATCH; import retrofit2.http.POST; import retrofit2.http.PUT; +import retrofit2.http.Path; import retrofit2.http.QueryMap; import retrofit2.http.Url; @@ -162,6 +165,28 @@ Call logInWithPinCode(@Header("Authorization") String authHeader, // + /** + * ---------------------------------------------------------------------------------------------------- + * Connected Apps + * ----------------------------------------------------------------------------------------------------- + */ + // + @GET("me/connected_apps") + Call getConnectedApps(@Header("Authorization") String authHeader); + + @GET("me/connected_apps/{type}") + Call getConnectedApp(@Header("Authorization") String authHeader, @Path("type") String type); + + @PUT("me/connected_apps/{type}") + Call createConnectedApp(@Header("Authorization") String authHeader, + @Path("type") String type, + @Body Map parameters); + + @DELETE("me/connected_apps/{type}") + Call deleteConnectedApp(@Header("Authorization") String authHeader, @Path("type") String type); + + // + /** * ---------------------------------------------------------------------------------------------------- * Album Modifications diff --git a/vimeo-networking/src/main/java/com/vimeo/networking/model/ConnectionCollection.java b/vimeo-networking/src/main/java/com/vimeo/networking/model/ConnectionCollection.java index 1fe2d0e09..01ca4f2f9 100644 --- a/vimeo-networking/src/main/java/com/vimeo/networking/model/ConnectionCollection.java +++ b/vimeo-networking/src/main/java/com/vimeo/networking/model/ConnectionCollection.java @@ -197,6 +197,10 @@ public class ConnectionCollection implements Serializable { @SerializedName("live_stats") private Interaction mLiveStats; + @Nullable + @SerializedName("connected_apps") + private Connection mConnectedApps; + /** * @return the {@link Interaction} for getting the {@link com.vimeo.networking.model.live.LiveStats} * for a live {@link Video} @@ -408,6 +412,19 @@ public Connection getUsersWithAccess() { return mUsersWithAccess; } + /** + * @return the {@link Connection} for getting the {@link com.vimeo.networking.model.connectedapp.ConnectedApp} + * for a logged in {@link com.vimeo.networking.model.User} + */ + @Nullable + public Connection getConnectedApps() { + return mConnectedApps; + } + + void setConnectedApps(@Nullable Connection connectedApps) { + mConnectedApps = connectedApps; + } + public void setUsersWithAccess(@Nullable Connection usersWithAccess) { mUsersWithAccess = usersWithAccess; } diff --git a/vimeo-networking/src/main/java/com/vimeo/networking/model/Interaction.java b/vimeo-networking/src/main/java/com/vimeo/networking/model/Interaction.java index 18b8df0a5..9b323e639 100644 --- a/vimeo-networking/src/main/java/com/vimeo/networking/model/Interaction.java +++ b/vimeo-networking/src/main/java/com/vimeo/networking/model/Interaction.java @@ -23,6 +23,7 @@ package com.vimeo.networking.model; import com.google.gson.annotations.SerializedName; +import com.vimeo.networking.model.connectedapp.ConnectedScopes; import com.vimeo.stag.UseStag; import org.jetbrains.annotations.NotNull; @@ -121,6 +122,14 @@ public String toString() { @SerializedName("expires_time") protected Date mExpiration; + @Nullable + @SerializedName("is_connected") + protected boolean mIsConnected; + + @Nullable + @SerializedName("all_scopes") + protected ConnectedScopes mAllScopes; + @Nullable @SerializedName("reason") protected ArrayList mReportingReasons; @@ -149,6 +158,15 @@ public Date getExpiration() { return mExpiration; } + public boolean isConnected() { + return mIsConnected; + } + + @Nullable + public ConnectedScopes getAllScopes() { + return mAllScopes; + } + public void setIsAdded(boolean added) { mAdded = added; } diff --git a/vimeo-networking/src/main/java/com/vimeo/networking/model/InteractionCollection.java b/vimeo-networking/src/main/java/com/vimeo/networking/model/InteractionCollection.java index f90d17c80..8c4d6aaa3 100644 --- a/vimeo-networking/src/main/java/com/vimeo/networking/model/InteractionCollection.java +++ b/vimeo-networking/src/main/java/com/vimeo/networking/model/InteractionCollection.java @@ -105,6 +105,22 @@ public class InteractionCollection implements Serializable { @SerializedName("add_to") private Interaction mAddTo; + @Nullable + @SerializedName("facebook_connected_app") + private Interaction mFacebookConnectedApp; + + @Nullable + @SerializedName("youtube_connected_app") + private Interaction mYouTubeConnectedApp; + + @Nullable + @SerializedName("linkedin_connected_app") + private Interaction mLinkedInConnectedApp; + + @Nullable + @SerializedName("twitter_connected_app") + private Interaction mTwitterConnectedApp; + @Nullable public Interaction getWatchLater() { return mWatchLater; @@ -204,6 +220,66 @@ void setAlbum(@Nullable Interaction album) { mAlbum = album; } + /** + * @return Information related to the user's connected Facebook app. + */ + @Nullable + public Interaction getFacebookConnectedApp() { + return mFacebookConnectedApp; + } + + /** + * Set information related to the user's connected Facebook app. + */ + void setFacebookConnectedApp(@Nullable Interaction facebookConnectedApp) { + mFacebookConnectedApp = facebookConnectedApp; + } + + /** + * @return Information related to the user's connected YouTube app. + */ + @Nullable + public Interaction getYouTubeConnectedApp() { + return mYouTubeConnectedApp; + } + + /** + * Set information related to the user's connected YouTube app. + */ + void setYouTubeConnectedApp(@Nullable Interaction youTubeConnectedApp) { + mYouTubeConnectedApp = youTubeConnectedApp; + } + + /** + * @return Information related to the user's connected LinkedIn app. + */ + @Nullable + public Interaction getLinkedInConnectedApp() { + return mLinkedInConnectedApp; + } + + /** + * Set information related to the user's connected LinkedIn app. + */ + void setLinkedInConnectedApp(@Nullable Interaction linkedInConnectedApp) { + mLinkedInConnectedApp = linkedInConnectedApp; + } + + /** + * @return Information related to the user's connected Twitter app. + */ + @Nullable + public Interaction getTwitterConnectedApp() { + return mTwitterConnectedApp; + } + + /** + * Set information related to the user's connected Twitter app. + */ + void setTwitterConnectedApp(@Nullable Interaction twitterConnectedApp) { + mTwitterConnectedApp = twitterConnectedApp; + } + /** * @return An {@link Interaction} that will be present in the Album or Channel objects returned from * a request to an "available_channels" or "available_albums" connection on a video object. The diff --git a/vimeo-networking/src/main/java/com/vimeo/networking/model/connectedapp/ConnectedApp.java b/vimeo-networking/src/main/java/com/vimeo/networking/model/connectedapp/ConnectedApp.java new file mode 100644 index 000000000..1da3033a4 --- /dev/null +++ b/vimeo-networking/src/main/java/com/vimeo/networking/model/connectedapp/ConnectedApp.java @@ -0,0 +1,275 @@ +package com.vimeo.networking.model.connectedapp; + +import com.google.gson.annotations.SerializedName; +import com.vimeo.networking.model.Entity; +import com.vimeo.stag.UseStag; +import com.vimeo.stag.UseStag.FieldOption; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.io.Serializable; +import java.util.Collections; +import java.util.Date; +import java.util.List; + +/** + * 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. + */ +@SuppressWarnings({"unused"}) +@UseStag(FieldOption.SERIALIZED_NAME) +public class ConnectedApp implements Serializable, Entity { + + private static final String S_FACEBOOK = "facebook"; + private static final String S_LINKEDIN = "linkedin"; + private static final String S_TWITTER = "twitter"; + private static final String S_YOUTUBE = "youtube"; + private static final long serialVersionUID = 5238428979625030071L; + + /** + * An enumeration of the supported connected app types. + */ + @UseStag + public enum ConnectedAppType { + @SerializedName(S_FACEBOOK) + FACEBOOK(S_FACEBOOK), // Represents a connection to Facebook. + @SerializedName(S_LINKEDIN) + LINKED_IN(S_LINKEDIN), // Represents a connection to LinkedIn. + @SerializedName(S_TWITTER) + TWITTER(S_TWITTER), // Represents a connection to Twitter. + @SerializedName(S_YOUTUBE) + YOUTUBE(S_YOUTUBE); // Represents a connection to YouTube. + + @NotNull + private final String mType; + + ConnectedAppType(@NotNull String type) { + mType = type; + } + + @Override + public String toString() { + return mType; + } + } + + + @Nullable + @SerializedName("add_date") + private Date mDateAdded; + + @SerializedName("data_access_is_expired") + private boolean mIsDataAccessExpired; + + @Nullable + @SerializedName("needed_scopes") + private List mNeededScopes; + + @Nullable + @SerializedName("pages") + private List mPages; + + @Nullable + @SerializedName("publish_categories") + private List mPublishCategories; + + @Nullable + @SerializedName("third_party_user_id") + private String mUserId; + + @Nullable + @SerializedName("type") + private ConnectedAppType mType; + + @Nullable + @SerializedName("third_party_user_display_name") + private String mUserName; + + @Nullable + @SerializedName("uri") + private String mUri; + + /** + * @return The date when the user established this connected app. + */ + @Nullable + public Date getDateAdded() { + return mDateAdded == null ? null : (Date) mDateAdded.clone(); + } + + /** + * Set the date when the user established this connected app. + */ + void setDateAdded(@Nullable Date dateAdded) { + mDateAdded = dateAdded == null ? null : (Date) dateAdded.clone(); + } + + /** + * @return Whether or not the user's data access is expired (Facebook only). + */ + public boolean isDataAccessExpired() { + return mIsDataAccessExpired; + } + + /** + * Set whether or not the user's data access is expired (Facebook only). + */ + void setDataAccessExpired(boolean dataAccessExpired) { + mIsDataAccessExpired = dataAccessExpired; + } + + /** + * @return The list of remaining scopes on this connected app that the user needs for a particular feature. + */ + @Nullable + public List getNeededScopes() { + return mNeededScopes == null ? null : Collections.unmodifiableList(mNeededScopes); + } + + /** + * Set the list of remaining scopes on this connected app that the user needs for a particular Vimeo feature. + */ + void setNeededScopes(@Nullable List neededScopes) { + mNeededScopes = neededScopes == null ? null : Collections.unmodifiableList(neededScopes); + } + + /** + * @return The list of third party pages that is associated with the user's account (Facebook and LinkedIn only). + */ + @Nullable + public List getPages() { + return mPages == null ? null : Collections.unmodifiableList(mPages); + } + + /** + * Set the list of third party pages that is associated with the user's account (Facebook and LinkedIn only). + */ + void setPages(@Nullable List pages) { + mPages = pages == null ? null : Collections.unmodifiableList(pages); + } + + /** + * @return The list of third party categories that can be selected for a publish to social + * job (Facebook and YouTube only). + */ + @Nullable + public List getPublishCategories() { + return mPublishCategories == null ? null : Collections.unmodifiableList(mPublishCategories); + } + + /** + * Set the list of third party categories that can be selected for a publish to social + * job (Facebook and YouTube only). + */ + void setPublishCategories(@Nullable List publishCategories) { + mPublishCategories = publishCategories == null ? null : Collections.unmodifiableList(publishCategories); + } + + /** + * @return The unique identifier for the user on this connected app. + */ + @Nullable + public String getUserId() { + return mUserId; + } + + /** + * Set the unique identifier for the user on this connected app. + */ + void setUserId(@Nullable String userId) { + mUserId = userId; + } + + /** + * @return The {@link ConnectedAppType} of the connected app. + */ + @Nullable + public ConnectedAppType getType() { + return mType; + } + + /** + * Set the {@link ConnectedAppType} of the connected app. + */ + void setType(@Nullable ConnectedAppType type) { + mType = type; + } + + /** + * @return The user's display name on the connected app. + */ + @Nullable + public String getUserName() { + return mUserName; + } + + /** + * Set the user's display name on the connected app. + */ + void setUserName(@Nullable String userName) { + mUserName = userName; + } + + /** + * @return The API URI of this connected app. + */ + @Nullable + public String getUri() { + return mUri; + } + + /** + * Set the API URI of this connected app. + */ + void setUri(@Nullable String uri) { + mUri = uri; + } + + @SuppressWarnings("EqualsReplaceableByObjectsCall") + @Override + public boolean equals(Object o) { + if (this == o) { return true; } + if (o == null || !o.getClass().equals(getClass())) { return false; } + + final ConnectedApp that = (ConnectedApp) o; + + if (mIsDataAccessExpired != that.mIsDataAccessExpired) { return false; } + if (mDateAdded != null ? !mDateAdded.equals(that.mDateAdded) : that.mDateAdded != null) { return false; } + if (mNeededScopes != null ? !mNeededScopes.equals(that.mNeededScopes) : that.mNeededScopes != null) { + return false; + } + if (mPages != null ? !mPages.equals(that.mPages) : that.mPages != null) { return false; } + if (mPublishCategories != null ? + !mPublishCategories.equals(that.mPublishCategories) : that.mPublishCategories != null) { + return false; + } + if (mUserId != null ? !mUserId.equals(that.mUserId) : that.mUserId != null) { return false; } + if (mType != that.mType) { return false; } + if (mUserName != null ? !mUserName.equals(that.mUserName) : that.mUserName != null) { return false; } + return mUri != null ? mUri.equals(that.mUri) : that.mUri == null; + } + + @Override + public int hashCode() { + int result = mDateAdded != null ? mDateAdded.hashCode() : 0; + result = 31 * result + (mIsDataAccessExpired ? 1 : 0); + result = 31 * result + (mNeededScopes != null ? mNeededScopes.hashCode() : 0); + result = 31 * result + (mPages != null ? mPages.hashCode() : 0); + result = 31 * result + (mPublishCategories != null ? mPublishCategories.hashCode() : 0); + result = 31 * result + (mUserId != null ? mUserId.hashCode() : 0); + result = 31 * result + (mType != null ? mType.hashCode() : 0); + result = 31 * result + (mUserName != null ? mUserName.hashCode() : 0); + result = 31 * result + (mUri != null ? mUri.hashCode() : 0); + return result; + } + + @Nullable + @Override + public String getIdentifier() { + return mUri; + } +} diff --git a/vimeo-networking/src/main/java/com/vimeo/networking/model/connectedapp/ConnectedAppList.java b/vimeo-networking/src/main/java/com/vimeo/networking/model/connectedapp/ConnectedAppList.java new file mode 100644 index 000000000..19a09232b --- /dev/null +++ b/vimeo-networking/src/main/java/com/vimeo/networking/model/connectedapp/ConnectedAppList.java @@ -0,0 +1,19 @@ +package com.vimeo.networking.model.connectedapp; + +import com.vimeo.networking.model.BaseResponseList; +import com.vimeo.stag.UseStag; + +/** + * A {@link BaseResponseList} of {@link ConnectedApp} objects. + */ +@SuppressWarnings("unused") +@UseStag +public class ConnectedAppList extends BaseResponseList { + + private static final long serialVersionUID = -114062434938515576L; + + @Override + public Class getModelClass() { + return ConnectedApp.class; + } +} diff --git a/vimeo-networking/src/main/java/com/vimeo/networking/model/connectedapp/ConnectedScopes.java b/vimeo-networking/src/main/java/com/vimeo/networking/model/connectedapp/ConnectedScopes.java new file mode 100644 index 000000000..49425ab1b --- /dev/null +++ b/vimeo-networking/src/main/java/com/vimeo/networking/model/connectedapp/ConnectedScopes.java @@ -0,0 +1,53 @@ +package com.vimeo.networking.model.connectedapp; + +import com.google.gson.annotations.SerializedName; + +import org.jetbrains.annotations.Nullable; + +import java.io.Serializable; +import java.util.Collections; +import java.util.List; + +/** + * Provides the lists of scopes that are required for third-party connected app features. + */ +public class ConnectedScopes implements Serializable { + + private static final long serialVersionUID = -4253331609435421704L; + + @Nullable + @SerializedName("publish_to_social") + private List mPublishToSocial; + + @Nullable + @SerializedName("simulcast") + private List mSimulcast; + + /** + * @return All scopes required for publishing to a specific social media platform. + */ + @Nullable + public List getPublishToSocial() { + return mPublishToSocial == null ? null : Collections.unmodifiableList(mPublishToSocial); + } + + public void setPublishToSocial(@Nullable List publishToSocial) { + mPublishToSocial = publishToSocial == null ? null : Collections.unmodifiableList(publishToSocial); + } + + /** + * @return All scopes required for simulcasting to a specific social media platform. + */ + @Nullable + public List getSimulcast() { + return mSimulcast == null ? null : Collections.unmodifiableList(mSimulcast); + } + + /** + * Set all scopes required for publishing to a specific social media platform. + * @param simulcast A list of scope permissions + */ + public void setSimulcast(@Nullable List simulcast) { + mSimulcast = simulcast == null ? null : Collections.unmodifiableList(simulcast); + } +} diff --git a/vimeo-networking/src/main/java/com/vimeo/networking/model/connectedapp/PublishOptionItem.java b/vimeo-networking/src/main/java/com/vimeo/networking/model/connectedapp/PublishOptionItem.java new file mode 100644 index 000000000..d25738087 --- /dev/null +++ b/vimeo-networking/src/main/java/com/vimeo/networking/model/connectedapp/PublishOptionItem.java @@ -0,0 +1,83 @@ +package com.vimeo.networking.model.connectedapp; + +import com.google.gson.annotations.SerializedName; +import com.vimeo.networking.model.Entity; +import com.vimeo.stag.UseStag; +import com.vimeo.stag.UseStag.FieldOption; + +import org.jetbrains.annotations.Nullable; + +import java.io.Serializable; + +/** + * A page or category that can be sent when publishing to a social media platform. + */ +@SuppressWarnings({"unused"}) +@UseStag(FieldOption.SERIALIZED_NAME) +public class PublishOptionItem implements Serializable, Entity { + + private static final long serialVersionUID = -4124113112184284361L; + + @Nullable + @SerializedName("id") + private String mId; + + @Nullable + @SerializedName("name") + private String mName; + + /** + * @return The ID of the publish item. + */ + @Nullable + public String getId() { + return mId; + } + + /** + * Set the ID of the publish item. + */ + public void setId(@Nullable String id) { + mId = id; + } + + /** + * @return The name or display name of the publish item, i.e.: "art", "family", "vacation" etc. + */ + @Nullable + public String getName() { + return mName; + } + + /** + * Set the name or display name of the publich item, i.e.: "art", "family", "vacation" etc. + */ + public void setName(@Nullable String name) { + mName = name; + } + + @SuppressWarnings("EqualsReplaceableByObjectsCall") + @Override + public boolean equals(Object o) { + if (this == o) { return true; } + if (o == null || !o.getClass().equals(getClass())) { return false; } + + final PublishOptionItem that = (PublishOptionItem) o; + + if (mId != null ? !mId.equals(that.mId) : that.mId != null) { return false; } + return mName != null ? mName.equals(that.mName) : that.mName == null; + } + + @Override + public int hashCode() { + int result = mId != null ? mId.hashCode() : 0; + result = 31 * result + (mName != null ? mName.hashCode() : 0); + return result; + } + + @Nullable + @Override + public String getIdentifier() { + return mId; + } +} diff --git a/vimeo-networking/src/main/java/com/vimeo/networking/utils/VimeoNetworkUtil.java b/vimeo-networking/src/main/java/com/vimeo/networking/utils/VimeoNetworkUtil.java index 9c7fbb348..ca8e6159d 100644 --- a/vimeo-networking/src/main/java/com/vimeo/networking/utils/VimeoNetworkUtil.java +++ b/vimeo-networking/src/main/java/com/vimeo/networking/utils/VimeoNetworkUtil.java @@ -33,6 +33,7 @@ import com.vimeo.networking.logging.ClientLogger; import com.vimeo.networking.model.AlbumPrivacy; import com.vimeo.networking.model.AlbumPrivacy.AlbumPrivacyViewValue; +import com.vimeo.networking.model.connectedapp.ConnectedApp; import com.vimeo.networking.model.error.VimeoError; import com.vimeo.stag.generated.Stag; @@ -278,4 +279,38 @@ public static Map prepareAlbumEditParameters(@NotNull final Stri return retVal; } + + /** + * Prepare the parameters for creating a {@link ConnectedApp}. In the event of invalid parameters, + * the callback.failure will be invoked and the method will return null. + * + * @param type The {@link ConnectedApp.ConnectedAppType} of the {@link ConnectedApp} that will be created. + * @param authorization A non-null, non-empty (will be validated) authorization token. The contents of this string + * will vary depending on the {@link ConnectedApp.ConnectedAppType}. + * @param callback A callback that will receive the results of the network request. + * @return A prepared map of parameters or null in the event of an error. + */ + @Nullable + public static Map prepareConnectedAppCreateParameters(@NotNull ConnectedApp.ConnectedAppType type, + @NotNull String authorization, + @NotNull final VimeoCallback callback) { + final String emptyAuthError = "Authorization can't be empty in connected app create."; + if (!validateString(authorization, emptyAuthError, callback)) { + return null; + } + final Map retVal = new HashMap<>(); + switch (type) { + case FACEBOOK: + retVal.put(Vimeo.PARAMETER_ACCESS_TOKEN, authorization); + break; + case LINKED_IN: + case YOUTUBE: + retVal.put(Vimeo.PARAMETER_AUTH_CODE, authorization); + break; + case TWITTER: + retVal.put(Vimeo.PARAMETER_ACCESS_TOKEN_SECRET, authorization); + break; + } + return retVal; + } } From 3aeb19de52407f6e39c10af8e689b746721f7c28 Mon Sep 17 00:00:00 2001 From: Howard Rigberg Date: Mon, 2 Dec 2019 16:10:19 -0500 Subject: [PATCH 02/10] adding connected apps for the new version of the networking library --- .../com/vimeo/networking2/ConnectedApp.kt | 77 +++++++++++++ .../networking2/ConnectedAppInteraction.kt | 31 +++++ .../com/vimeo/networking2/ConnectedAppList.kt | 26 +++++ .../com/vimeo/networking2/ConnectedScopes.kt | 21 ++++ .../vimeo/networking2/PublishOptionItem.kt | 29 +++++ .../com/vimeo/networking2/UserConnections.kt | 6 + .../com/vimeo/networking2/UserInteractions.kt | 28 ++++- .../networking2/enums/ConnectedAppType.kt | 33 ++++++ .../java/com/vimeo/networking2/ModelsTest.kt | 5 + .../com/vimeo/networking2/enums/EnumsTest.kt | 1 + .../main/java/com/vimeo/networking/Vimeo.java | 3 +- .../com/vimeo/networking/VimeoClient.java | 108 +++++++++++++++--- .../com/vimeo/networking/VimeoService.java | 22 ++++ .../networking/utils/VimeoNetworkUtil.java | 49 +++++--- 14 files changed, 402 insertions(+), 37 deletions(-) create mode 100644 models/src/main/java/com/vimeo/networking2/ConnectedApp.kt create mode 100644 models/src/main/java/com/vimeo/networking2/ConnectedAppInteraction.kt create mode 100644 models/src/main/java/com/vimeo/networking2/ConnectedAppList.kt create mode 100644 models/src/main/java/com/vimeo/networking2/ConnectedScopes.kt create mode 100644 models/src/main/java/com/vimeo/networking2/PublishOptionItem.kt create mode 100644 models/src/main/java/com/vimeo/networking2/enums/ConnectedAppType.kt diff --git a/models/src/main/java/com/vimeo/networking2/ConnectedApp.kt b/models/src/main/java/com/vimeo/networking2/ConnectedApp.kt new file mode 100644 index 000000000..5815baea9 --- /dev/null +++ b/models/src/main/java/com/vimeo/networking2/ConnectedApp.kt @@ -0,0 +1,77 @@ +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 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 pictures: List? = 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? = 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? = 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 type: ConnectedAppType? = null +) : Entity { + + override val identifier: String? = uri + +} diff --git a/models/src/main/java/com/vimeo/networking2/ConnectedAppInteraction.kt b/models/src/main/java/com/vimeo/networking2/ConnectedAppInteraction.kt new file mode 100644 index 000000000..fe4035f68 --- /dev/null +++ b/models/src/main/java/com/vimeo/networking2/ConnectedAppInteraction.kt @@ -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? = 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 diff --git a/models/src/main/java/com/vimeo/networking2/ConnectedAppList.kt b/models/src/main/java/com/vimeo/networking2/ConnectedAppList.kt new file mode 100644 index 000000000..c4c3c7883 --- /dev/null +++ b/models/src/main/java/com/vimeo/networking2/ConnectedAppList.kt @@ -0,0 +1,26 @@ +package com.vimeo.networking2 + +import com.squareup.moshi.Json +import com.vimeo.networking2.common.Pageable + +/** + * List of the logged in user's [ConnectedApps][ConnectedApp]. + */ +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? = null + +) : Pageable diff --git a/models/src/main/java/com/vimeo/networking2/ConnectedScopes.kt b/models/src/main/java/com/vimeo/networking2/ConnectedScopes.kt new file mode 100644 index 000000000..94d497be8 --- /dev/null +++ b/models/src/main/java/com/vimeo/networking2/ConnectedScopes.kt @@ -0,0 +1,21 @@ +package com.vimeo.networking2 + +import com.squareup.moshi.Json + +/** + * Provides the lists of scopes that are required for third-party connected app features. + */ +data class ConnectedScopes( + + /** + * All scopes required for publishing to a specific social media platform. + */ + @Json(name = "publish_to_social") + val publishToSocial: List? = null, + + /** + * All scopes required for simulcasting to a specific social media platform. + */ + @Json(name = "simulcast") + val simulcast: List? = null +) diff --git a/models/src/main/java/com/vimeo/networking2/PublishOptionItem.kt b/models/src/main/java/com/vimeo/networking2/PublishOptionItem.kt new file mode 100644 index 000000000..9247c22a5 --- /dev/null +++ b/models/src/main/java/com/vimeo/networking2/PublishOptionItem.kt @@ -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 + +} diff --git a/models/src/main/java/com/vimeo/networking2/UserConnections.kt b/models/src/main/java/com/vimeo/networking2/UserConnections.kt index 019c131e1..bc5cce9b8 100644 --- a/models/src/main/java/com/vimeo/networking2/UserConnections.kt +++ b/models/src/main/java/com/vimeo/networking2/UserConnections.kt @@ -41,6 +41,12 @@ data class UserConnections( @Json(name = "channels") val channels: Connection? = null, + /** + * Information about this user's connected apps. + */ + @Json(name = "connected_apps") + val connectedApps: Connection? = null, + /** * Information about this user's feed. */ diff --git a/models/src/main/java/com/vimeo/networking2/UserInteractions.kt b/models/src/main/java/com/vimeo/networking2/UserInteractions.kt index 85eff2c82..d1e2460fb 100644 --- a/models/src/main/java/com/vimeo/networking2/UserInteractions.kt +++ b/models/src/main/java/com/vimeo/networking2/UserInteractions.kt @@ -1,8 +1,8 @@ package com.vimeo.networking2 -import com.vimeo.networking2.common.FollowableInteractions import com.squareup.moshi.Json import com.squareup.moshi.JsonClass +import com.vimeo.networking2.common.FollowableInteractions /** * All actions that can be taken on a user. @@ -32,6 +32,30 @@ data class UserInteractions( * Information regarding where and how to report a user. */ @Json(name = "report") - val report: BasicInteraction? = null + val report: BasicInteraction? = null, + + /** + * Information related to the Facebook connected app. + */ + @Json(name = "facebook_connected_app") + val facebookConnectedApp: ConnectedAppInteraction? = null, + + /** + * Information related to the YouTube connected app. + */ + @Json(name = "youtube_connected_app") + val youtubeConnectedApp: ConnectedAppInteraction? = null, + + /** + * Information related to the LinkedIn connected app. + */ + @Json(name = "linkedin_connected_app") + val linkedinConnectedApp: ConnectedAppInteraction? = null, + + /** + * Information related to the Twitter connected app. + */ + @Json(name = "twitter_connected_app") + val twitterConnectedApp: ConnectedAppInteraction? = null ): FollowableInteractions diff --git a/models/src/main/java/com/vimeo/networking2/enums/ConnectedAppType.kt b/models/src/main/java/com/vimeo/networking2/enums/ConnectedAppType.kt new file mode 100644 index 000000000..21871b56a --- /dev/null +++ b/models/src/main/java/com/vimeo/networking2/enums/ConnectedAppType.kt @@ -0,0 +1,33 @@ +package com.vimeo.networking2.enums + +/** + * An enumeration of the supported connected app types. + */ +@Suppress("unused") +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); +} diff --git a/models/src/test/java/com/vimeo/networking2/ModelsTest.kt b/models/src/test/java/com/vimeo/networking2/ModelsTest.kt index d7da14f24..0f2ba0965 100644 --- a/models/src/test/java/com/vimeo/networking2/ModelsTest.kt +++ b/models/src/test/java/com/vimeo/networking2/ModelsTest.kt @@ -31,6 +31,10 @@ class ModelsTest { Comment::class, CommentConnections::class, CommentList::class, + ConnectedApp::class, + ConnectedAppList::class, + ConnectedAppInteraction::class, + ConnectedScopes::class, Connection::class, Credit::class, Document::class, @@ -86,6 +90,7 @@ class ModelsTest { ProgrammedContentItem::class, ProgrammedContentItemList::class, Publish::class, + PublishOptionItem::class, PurchaseInteraction::class, PurchaseOnDemandInteraction::class, Quota::class, diff --git a/models/src/test/java/com/vimeo/networking2/enums/EnumsTest.kt b/models/src/test/java/com/vimeo/networking2/enums/EnumsTest.kt index b45eb8652..40f280bdc 100644 --- a/models/src/test/java/com/vimeo/networking2/enums/EnumsTest.kt +++ b/models/src/test/java/com/vimeo/networking2/enums/EnumsTest.kt @@ -16,6 +16,7 @@ class EnumsTest { BillingPeriodType::class.java, CommentType::class.java, CommentPrivacyType::class.java, + ConnectedAppType::class.java, ContentFilterType::class.java, DownloadType::class.java, EmbedPrivacyType::class.java, diff --git a/vimeo-networking/src/main/java/com/vimeo/networking/Vimeo.java b/vimeo-networking/src/main/java/com/vimeo/networking/Vimeo.java index 0737aa382..28b75f3fe 100644 --- a/vimeo-networking/src/main/java/com/vimeo/networking/Vimeo.java +++ b/vimeo-networking/src/main/java/com/vimeo/networking/Vimeo.java @@ -87,9 +87,8 @@ public final class Vimeo { public static final String PARAMETER_ALBUM_PRIVACY = "privacy"; public static final String PARAMETER_ALBUM_PASSWORD = "password"; - public static final String PARAMETER_ACCESS_TOKEN = "access_token"; - public static final String PARAMETER_ACCESS_TOKEN_SECRET = "access_token_secret"; public static final String PARAMETER_AUTH_CODE = "auth_code"; + public static final String PARAMETER_APP_TYPE = "app_type"; public static final String PARAMETER_COMMENT_TEXT_BODY = "text"; diff --git a/vimeo-networking/src/main/java/com/vimeo/networking/VimeoClient.java b/vimeo-networking/src/main/java/com/vimeo/networking/VimeoClient.java index 3dc5768c0..80c9ecac2 100644 --- a/vimeo-networking/src/main/java/com/vimeo/networking/VimeoClient.java +++ b/vimeo-networking/src/main/java/com/vimeo/networking/VimeoClient.java @@ -58,6 +58,7 @@ import com.vimeo.networking.utils.BaseUrlInterceptor; import com.vimeo.networking.utils.PrivacySettingsParams; import com.vimeo.networking.utils.VimeoNetworkUtil; +import com.vimeo.networking2.enums.ConnectedAppType; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -1260,7 +1261,7 @@ public Call editSubscriptions(@NotNull Map // ----------------------------------------------------------------------------------------------------- - // Conected Apps + // Connected Apps // ----------------------------------------------------------------------------------------------------- // @@ -1271,44 +1272,63 @@ public Call editSubscriptions(@NotNull Map getConnectedApps(@NotNull VimeoCallback callback) { + public Call getConnectedApps(@NotNull final VimeoCallback callback) { final Call call = mVimeoService.getConnectedApps(getAuthHeader()); call.enqueue(callback); return call; } + /** + * @return A {@link Call} object that can be used to request a {@link com.vimeo.networking2.ConnectedAppList}. + */ + @NotNull + public Call getConnectedApps() { + return mVimeoService.getConnectedAppsMoshi(getAuthHeader()); + } + /** * Gets a {@link ConnectedApp} for the authorized user for a specific {@link ConnectedApp.ConnectedAppType}. * - * @param callback The callback to be invoked when the request finishes. * @param type The {@link ConnectedApp.ConnectedAppType} of the {@link ConnectedApp} to return. + * @param callback The callback to be invoked when the request finishes. * @return A {@link Call} object. */ @NotNull - public Call getConnectedApp(@NotNull VimeoCallback callback, - @NotNull ConnectedApp.ConnectedAppType type) { + public Call getConnectedApp(@NotNull final ConnectedApp.ConnectedAppType type, + @NotNull final VimeoCallback callback) { final Call call = mVimeoService.getConnectedApp(getAuthHeader(), type.toString()); call.enqueue(callback); return call; } + /** + * Returns a {@link Call} object that can be used to request a {@link com.vimeo.networking2.ConnectedApp}. + * + * @param type The {@link ConnectedAppType} of the {@link com.vimeo.networking2.ConnectedApp} to return. + * @return A {@link Call} object that can be used to request a {@link com.vimeo.networking2.ConnectedApp}. + */ + @NotNull + public Call getConnectedApp(@NotNull final ConnectedAppType type) { + return mVimeoService.getConnectedAppMoshi(getAuthHeader(), type.getValue()); + } + /** * Creates a {@link ConnectedApp} for the authorized user for a specific {@link ConnectedApp.ConnectedAppType}. * - * @param callback The callback to be invoked when the request finishes. * @param type The {@link ConnectedApp.ConnectedAppType} of the {@link ConnectedApp} to create. * @param authorization An authorization string for the third party platform. The nature of the string will * vary depending upon the {@link ConnectedApp.ConnectedAppType} but should never be * empty or the request will fail. - * @return A Call object or null if a client-side initialization error has occurred. In the event of an error, - * the callback will still be notified. + * @param callback The callback to be invoked when the request finishes. + * @return A {@link Call} object or null if a client-side initialization error has occurred. + * In the event of an error, the callback will still be notified. */ @Nullable - public Call createConnectedApp(@NotNull VimeoCallback callback, - @NotNull ConnectedApp.ConnectedAppType type, - @NotNull String authorization) { - String auth = null; - Map params = + public Call createConnectedApp(@NotNull final ConnectedApp.ConnectedAppType type, + @NotNull final String authorization, + @NotNull final VimeoCallback callback) { + final String auth = null; + final Map params = VimeoNetworkUtil.prepareConnectedAppCreateParameters(type, authorization, callback); if (params == null) { return null; @@ -1318,22 +1338,57 @@ public Call createConnectedApp(@NotNull VimeoCallback createConnectedApp(@NotNull final ConnectedAppType type, + @NotNull final String authorization) { + final Map params = VimeoNetworkUtil.prepareConnectedAppCreateParameters(type, authorization); + if (params == null) { + return null; + } + return mVimeoService.createConnectedAppMoshi(getAuthHeader(), type.getValue(), params); + } + /** * Deletes a {@link ConnectedApp} for the authorized user for a specific {@link ConnectedApp.ConnectedAppType}. * - * @param callback The callback to be invoked when the request finishes. * @param type The {@link ConnectedApp.ConnectedAppType} of the {@link ConnectedApp} to delete. + * @param callback The callback to be invoked when the request finishes. * @return A {@link Call} object. */ - @Nullable - public Call deleteConnectedApps(@NotNull VimeoCallback callback, - @NotNull ConnectedApp.ConnectedAppType type) { + @NotNull + public Call deleteConnectedApp(@NotNull final ConnectedApp.ConnectedAppType type, + @NotNull final VimeoCallback callback) { final Call call = mVimeoService.deleteConnectedApp(getAuthHeader(), type.toString()); call.enqueue(callback); return call; } - // + /** + * Deletes a {@link ConnectedApp} for the authorized user for a specific {@link ConnectedApp.ConnectedAppType}. + * + * @param type The {@link ConnectedAppType} of the {@link com.vimeo.networking2.ConnectedApp} to delete. + * @return A {@link Call} object that can be used to delete a {@link com.vimeo.networking2.ConnectedApp}. + */ + @Nullable + public Call deleteConnectedApp(@NotNull final ConnectedAppType type) { + final String typeString = type.getValue(); + if (typeString == null || typeString.isEmpty() || type == ConnectedAppType.UNKNOWN) { + return null; + } + return mVimeoService.deleteConnectedApp(getAuthHeader(), typeString); + } // @@ -1669,6 +1724,23 @@ public Call getProduct(String uri, VimeoCallback callback) { return getContent(uri, CacheControl.FORCE_NETWORK, GetRequestCaller.PRODUCT, null, null, null, callback); } + /** + * Fetches the currently authenticated user from the API + * @param query Query string for hitting the search endpoint + * @param refinementMap Used to refine lists (generally for search) with sorts and filters + * {@link RequestRefinementBuilder} + * @param fieldFilter The JSON Filter + * to optimize the request query. May be null. (highly recommended!) + * @return A {@link Call} object that can be used to get a {@link com.vimeo.networking2.User}. + */ + public Call getCurrentUser(@Nullable String query, + @Nullable Map refinementMap, + @Nullable String fieldFilter){ + return mVimeoService.getUserMoshi(getAuthHeader(), + createQueryMap(query, refinementMap, fieldFilter), + createCacheControlString(CacheControl.FORCE_NETWORK)); + } + /** * Fetches the currently authenticated user from the API * diff --git a/vimeo-networking/src/main/java/com/vimeo/networking/VimeoService.java b/vimeo-networking/src/main/java/com/vimeo/networking/VimeoService.java index 51ddeb624..aee016508 100644 --- a/vimeo-networking/src/main/java/com/vimeo/networking/VimeoService.java +++ b/vimeo-networking/src/main/java/com/vimeo/networking/VimeoService.java @@ -174,14 +174,30 @@ Call logInWithPinCode(@Header("Authorization") String authHeader, @GET("me/connected_apps") Call getConnectedApps(@Header("Authorization") String authHeader); + @GET("me/connected_apps") + @Serializer(converter = ConverterType.MOSHI) + Call getConnectedAppsMoshi(@Header("Authorization") String authHeader); + + @GET("me/connected_apps/{type}") Call getConnectedApp(@Header("Authorization") String authHeader, @Path("type") String type); + @GET("me/connected_apps/{type}") + @Serializer(converter = ConverterType.MOSHI) + Call getConnectedAppMoshi(@Header("Authorization") String authHeader, + @Path("type") String type); + @PUT("me/connected_apps/{type}") Call createConnectedApp(@Header("Authorization") String authHeader, @Path("type") String type, @Body Map parameters); + @PUT("me/connected_apps/{type}") + @Serializer(converter = ConverterType.MOSHI) + Call createConnectedAppMoshi(@Header("Authorization") String authHeader, + @Path("type") String type, + @Body Map parameters); + @DELETE("me/connected_apps/{type}") Call deleteConnectedApp(@Header("Authorization") String authHeader, @Path("type") String type); @@ -328,6 +344,12 @@ Call getUser(@Header("Authorization") String authHeader, @QueryMap Map options, @Header("Cache-Control") String cacheHeaderValue); + @GET("me") + @Serializer(converter = ConverterType.MOSHI) + Call getUserMoshi(@Header("Authorization") String authHeader, + @QueryMap Map options, + @Header("Cache-Control") String cacheHeaderValue); + @GET Call