Skip to content

Commit 260392e

Browse files
Merge pull request #564 from vimeo/MPS-3106-Upload-Quota-Update
MPS-3106 Upload quota update
2 parents d31db4d + e5394e1 commit 260392e

10 files changed

Lines changed: 135 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
Change Log
22
==========
3+
Version 3.6.0 *(2022-06-07)*
4+
----------------------------
5+
- Added `unit` to `StorageQuota`.
6+
- Added `period` to `Periodic` and `Space`.
7+
- Added `resetDate` to `Periodic`.
8+
39
Version 3.5.0 *(2022-05-16)*
410
----------------------------
511
- Added new account types: Free, Starter, Standard, and Advanced.

api-core/src/main/java/com/vimeo/networking2/ApiConstants.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ object ApiConstants {
3333

3434
const val SSL_URL_PATTERN = "*.vimeo.com"
3535

36-
const val SDK_VERSION = "3.5.0"
36+
const val SDK_VERSION = "3.6.0"
3737

3838
const val NONE = -1
3939

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
org.gradle.parallel=true
2020
org.gradle.daemon=true
2121
org.gradle.jvmargs=-Xmx4096M
22-
version=3.5.0
22+
version=3.6.0
2323

2424
android.useAndroidX=true
2525
android.enableJetifier=true

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package com.vimeo.networking2
33
import com.squareup.moshi.Json
44
import com.squareup.moshi.JsonClass
55
import com.vimeo.networking2.common.StorageQuota
6+
import com.vimeo.networking2.enums.UploadQuotaUnitType
7+
import com.vimeo.networking2.enums.asEnum
68

79
/**
810
* Lifetime data.
@@ -16,6 +18,16 @@ data class Lifetime(
1618
@Json(name = "max")
1719
override val max: Long? = null,
1820

21+
@Json(name = "unit")
22+
override val unit: String? = null,
23+
1924
@Json(name = "used")
2025
override val used: Long? = null
2126
) : StorageQuota
27+
28+
/**
29+
* @see Lifetime.unit
30+
* @see UploadQuotaUnitType
31+
*/
32+
val Lifetime.unitType: UploadQuotaUnitType
33+
get() = unit.asEnum(UploadQuotaUnitType.UNKNOWN)

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,16 @@ package com.vimeo.networking2
33
import com.squareup.moshi.Json
44
import com.squareup.moshi.JsonClass
55
import com.vimeo.networking2.common.StorageQuota
6+
import com.vimeo.networking2.enums.UploadQuotaPeriodType
7+
import com.vimeo.networking2.enums.UploadQuotaUnitType
8+
import com.vimeo.networking2.enums.asEnum
9+
import java.util.Date
610

711
/**
812
* Periodic upload quota information.
13+
*
14+
* @param period The renewal frequency of the quota. See [Periodic.periodType].
15+
* @param resetDate The time in ISO 8601 format when the authenticated user's upload quota resets.
916
*/
1017
@JsonClass(generateAdapter = true)
1118
data class Periodic(
@@ -16,7 +23,30 @@ data class Periodic(
1623
@Json(name = "max")
1724
override val max: Long? = null,
1825

26+
@Json(name = "period")
27+
val period: String? = null,
28+
29+
@Json(name = "reset_date")
30+
val resetDate: Date? = null,
31+
32+
@Json(name = "unit")
33+
override val unit: String? = null,
34+
1935
@Json(name = "used")
2036
override val used: Long? = null
2137

2238
) : StorageQuota
39+
40+
/**
41+
* @see Periodic.period
42+
* @see UploadQuotaPeriodType
43+
*/
44+
val Periodic.periodType: UploadQuotaPeriodType
45+
get() = period.asEnum(UploadQuotaPeriodType.UNKNOWN)
46+
47+
/**
48+
* @see Periodic.unit
49+
* @see UploadQuotaUnitType
50+
*/
51+
val Periodic.unitType: UploadQuotaUnitType
52+
get() = unit.asEnum(UploadQuotaUnitType.UNKNOWN)

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@ package com.vimeo.networking2
55
import com.squareup.moshi.Json
66
import com.squareup.moshi.JsonClass
77
import com.vimeo.networking2.common.StorageQuota
8+
import com.vimeo.networking2.enums.UploadQuotaPeriodType
9+
import com.vimeo.networking2.enums.UploadQuotaUnitType
810
import com.vimeo.networking2.enums.UploadSpaceType
911
import com.vimeo.networking2.enums.asEnum
1012

1113
/**
1214
* Upload quota space data.
1315
*
16+
* @param period The renewal frequency of the quota. See [Space.periodType].
1417
* @param showing The amount of time represented by the available space quota representation (e.g. lifetime or
1518
* periodic). See [Space.showingType].
1619
*/
@@ -23,17 +26,37 @@ data class Space(
2326
@Json(name = "max")
2427
override val max: Long? = null,
2528

29+
@Json(name = "period")
30+
val period: String? = null,
31+
2632
@Json(name = "showing")
2733
val showing: String? = null,
2834

35+
@Json(name = "unit")
36+
override val unit: String? = null,
37+
2938
@Json(name = "used")
3039
override val used: Long? = null
3140

3241
) : StorageQuota
3342

43+
/**
44+
* @see Space.period
45+
* @see UploadQuotaPeriodType
46+
*/
47+
val Space.periodType: UploadQuotaPeriodType
48+
get() = period.asEnum(UploadQuotaPeriodType.UNKNOWN)
49+
3450
/**
3551
* @see Space.showing
3652
* @see UploadSpaceType
3753
*/
3854
val Space.showingType: UploadSpaceType
3955
get() = showing.asEnum(UploadSpaceType.UNKNOWN)
56+
57+
/**
58+
* @see Space.unit
59+
* @see UploadQuotaUnitType
60+
*/
61+
val Space.unitType: UploadQuotaUnitType
62+
get() = unit.asEnum(UploadQuotaUnitType.UNKNOWN)

models/src/main/java/com/vimeo/networking2/common/StorageQuota.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ interface StorageQuota {
1414
*/
1515
val max: Long?
1616

17+
/**
18+
* The unit type of [free], [used], and [max].
19+
*/
20+
val unit: String?
21+
1722
/**
1823
* The number of bytes that you've already uploaded against your quota in the current period.
1924
*/
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.vimeo.networking2.enums
2+
3+
/**
4+
* The renewal frequency of the upload quota.
5+
*/
6+
enum class UploadQuotaPeriodType(override val value: String?) : StringValue {
7+
/**
8+
* The quota renews weekly.
9+
*/
10+
WEEKLY("weekly"),
11+
12+
/**
13+
* The quota renews monthly.
14+
*/
15+
MONTHLY("monthly"),
16+
17+
/**
18+
* The quota renews yearly.
19+
*/
20+
YEARLY("yearly"),
21+
22+
/**
23+
* The user doesn't have a periodic quota.
24+
*/
25+
LIFETIME("lifetime"),
26+
27+
/**
28+
* The quota renews on an unknown schedule.
29+
*/
30+
UNKNOWN(null)
31+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.vimeo.networking2.enums
2+
3+
/**
4+
* The unit type of the approach to calculating the upload quota (e.g. a byte size based approach or a video count
5+
* based approach)
6+
*
7+
*/
8+
enum class UploadQuotaUnitType(override val value: String?) : StringValue {
9+
10+
/**
11+
* The quota is calculated using count of videos.
12+
*/
13+
COUNT("video_count"),
14+
15+
/**
16+
* The quota is calculated using the size in bytes of the videos.
17+
*/
18+
SIZE("video_size"),
19+
20+
/**
21+
* The quota is calculated using an unknown approach.
22+
*/
23+
UNKNOWN(null)
24+
}

models/src/test/java/com/vimeo/networking2/enums/EnumsTest.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ class EnumsTest {
5050
TranscodeStatusType::class.java,
5151
TrialStatusType::class.java,
5252
TvodItemType::class.java,
53+
UploadQuotaPeriodType::class.java,
54+
UploadQuotaUnitType::class.java,
5355
UploadSpaceType::class.java,
5456
UploadStatusType::class.java,
5557
UserBadgeType::class.java,

0 commit comments

Comments
 (0)