Skip to content

Commit

Permalink
Merge pull request #259 from vimeo/VA-2691-Config-For-Stats
Browse files Browse the repository at this point in the history
Adding new models for Live Video features
  • Loading branch information
howardrigberg authored Oct 9, 2017
2 parents 9eb4bbe + 9009bdd commit e3e58e7
Show file tree
Hide file tree
Showing 32 changed files with 1,211 additions and 158 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ public void onCreate() {

public Configuration.Builder getAccessTokenBuilder() {
// The values file is left out of git, so you'll have to provide your own access token
String accessToken = getString(R.string.access_token);
String accessToken = "PROVIDE AN ACCESS TOKEN";
return new Configuration.Builder(accessToken);
}

public Configuration.Builder getClientIdAndClientSecretBuilder() {
// The values file is left out of git, so you'll have to provide your own id and secret
String clientId = getString(R.string.client_id);
String clientSecret = getString(R.string.client_secret);
String clientId = "PROVIDE A CLIENT ID";
String clientSecret = "PROVIDE A CLIENT SECRET";
String codeGrantRedirectUri = getString(R.string.deeplink_redirect_scheme) + "://" +
getString(R.string.deeplink_redirect_host);
TestAccountStore testAccountStore = new TestAccountStore(this.getApplicationContext());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ class TestApp : Application() {
// The values file is left out of git, so you'll have to provide your own access token
val accessTokenBuilder: Configuration.Builder
get() {
val accessToken = getString(R.string.access_token)
val accessToken = "PROVIDE AN ACCESS TOKEN"
return Configuration.Builder(accessToken)
}

// The values file is left out of git, so you'll have to provide your own id and secret
// Used for oauth flow
val clientIdAndClientSecretBuilder: Configuration.Builder
get() {
val clientId = getString(R.string.client_id)
val clientSecret = getString(R.string.client_secret)
val clientId = "PROVIDE A CLIENT ID"
val clientSecret = "PROVIDE A CLIENT SECRET"
val codeGrantRedirectUri = getString(R.string.deeplink_redirect_scheme) + "://" + getString(R.string.deeplink_redirect_host)
val testAccountStore = TestAccountStore(this.applicationContext)
val configBuilder = Configuration.Builder(clientId, clientSecret, SCOPE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import com.vimeo.networking.model.CommentList;
import com.vimeo.networking.model.Document;
import com.vimeo.networking.model.FeedList;
import com.vimeo.networking.model.live.LiveStats;
import com.vimeo.networking.model.PictureCollection;
import com.vimeo.networking.model.PictureResource;
import com.vimeo.networking.model.PinCodeInfo;
Expand Down Expand Up @@ -257,6 +258,12 @@ Call<Video> getVideo(@Header("Authorization") String authHeader,
@QueryMap Map<String, String> options,
@Header("Cache-Control") String cacheHeaderValue);

@GET
Call<LiveStats> getLiveStats(@Header("Authorization") String authHeader,
@Url String uri,
@QueryMap Map<String, String> options,
@Header("Cache-Control") String cacheHeaderValue);

@GET
Call<Void> getVoid(@Header("Authorization") String authHeader,
@Url String uri,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import com.vimeo.networking.model.Comment;
import com.vimeo.networking.model.CommentList;
import com.vimeo.networking.model.FeedList;
import com.vimeo.networking.model.live.LiveStats;
import com.vimeo.networking.model.RecommendationList;
import com.vimeo.networking.model.User;
import com.vimeo.networking.model.UserList;
Expand Down Expand Up @@ -225,6 +226,26 @@ public Call<FeedList> call(@NotNull String authHeader,
}
};

/**
* Used in association with
* {@link VimeoClient#getContent(String, CacheControl, Caller, String, Map, String, VimeoCallback)} or
* {@link VimeoClient#getContentSync(String, CacheControl, String, Map, String, Caller)}
* to get a {@link LiveStats} response from an API endpoint.
*/
public static final Caller<LiveStats> LIVE_STATS =
new Caller<LiveStats>() {

@NotNull
@Override
public Call<LiveStats> call(@NotNull String authHeader,
@NotNull String uri,
@NotNull Map<String, String> queryMap,
@NotNull String cacheHeader,
@NotNull VimeoService vimeoService) {
return vimeoService.getLiveStats(authHeader, uri, queryMap, cacheHeader);
}
};

/**
* Used in association with
* {@link VimeoClient#getContent(String, CacheControl, Caller, String, Map, String, VimeoCallback)} or
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* Stores a collection of Connection objects.
* Created by hanssena on 4/23/15.
*/
@SuppressWarnings("unused")
@SuppressWarnings({"WeakerAccess", "unused"})
@UseStag(FieldOption.SERIALIZED_NAME)
public class ConnectionCollection implements Serializable {

Expand Down Expand Up @@ -173,6 +173,18 @@ public class ConnectionCollection implements Serializable {
@SerializedName("folders")
private Connection mFolders;

@Nullable
@SerializedName("live_stats")
private Interaction mLiveStats;

/**
* @return the {@link Interaction} for getting the {@link com.vimeo.networking.model.live.LiveStats} for a live {@link Video}
*/
@Nullable
public Interaction getLiveStats() {
return mLiveStats;
}

@Nullable
public Connection getVideos() {
return mVideos;
Expand Down Expand Up @@ -341,4 +353,8 @@ public Connection getFolders() {
public void setFolders(@Nullable Connection folders) {
mFolders = folders;
}

void setLiveStats(@Nullable Interaction liveStats) {
mLiveStats = liveStats;
}
}
Loading

0 comments on commit e3e58e7

Please sign in to comment.