Skip to content

Commit

Permalink
Merge pull request #564 from vimeo/MPS-3106-Upload-Quota-Update
Browse files Browse the repository at this point in the history
MPS-3106 Upload quota update
  • Loading branch information
howardrigberg authored Jun 7, 2022
2 parents d31db4d + e5394e1 commit 260392e
Show file tree
Hide file tree
Showing 10 changed files with 135 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
Change Log
==========
Version 3.6.0 *(2022-06-07)*
----------------------------
- Added `unit` to `StorageQuota`.
- Added `period` to `Periodic` and `Space`.
- Added `resetDate` to `Periodic`.

Version 3.5.0 *(2022-05-16)*
----------------------------
- Added new account types: Free, Starter, Standard, and Advanced.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ object ApiConstants {

const val SSL_URL_PATTERN = "*.vimeo.com"

const val SDK_VERSION = "3.5.0"
const val SDK_VERSION = "3.6.0"

const val NONE = -1

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
org.gradle.parallel=true
org.gradle.daemon=true
org.gradle.jvmargs=-Xmx4096M
version=3.5.0
version=3.6.0

android.useAndroidX=true
android.enableJetifier=true
12 changes: 12 additions & 0 deletions models/src/main/java/com/vimeo/networking2/Lifetime.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package com.vimeo.networking2
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
import com.vimeo.networking2.common.StorageQuota
import com.vimeo.networking2.enums.UploadQuotaUnitType
import com.vimeo.networking2.enums.asEnum

/**
* Lifetime data.
Expand All @@ -16,6 +18,16 @@ data class Lifetime(
@Json(name = "max")
override val max: Long? = null,

@Json(name = "unit")
override val unit: String? = null,

@Json(name = "used")
override val used: Long? = null
) : StorageQuota

/**
* @see Lifetime.unit
* @see UploadQuotaUnitType
*/
val Lifetime.unitType: UploadQuotaUnitType
get() = unit.asEnum(UploadQuotaUnitType.UNKNOWN)
30 changes: 30 additions & 0 deletions models/src/main/java/com/vimeo/networking2/Periodic.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@ package com.vimeo.networking2
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
import com.vimeo.networking2.common.StorageQuota
import com.vimeo.networking2.enums.UploadQuotaPeriodType
import com.vimeo.networking2.enums.UploadQuotaUnitType
import com.vimeo.networking2.enums.asEnum
import java.util.Date

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

@Json(name = "period")
val period: String? = null,

@Json(name = "reset_date")
val resetDate: Date? = null,

@Json(name = "unit")
override val unit: String? = null,

@Json(name = "used")
override val used: Long? = null

) : StorageQuota

/**
* @see Periodic.period
* @see UploadQuotaPeriodType
*/
val Periodic.periodType: UploadQuotaPeriodType
get() = period.asEnum(UploadQuotaPeriodType.UNKNOWN)

/**
* @see Periodic.unit
* @see UploadQuotaUnitType
*/
val Periodic.unitType: UploadQuotaUnitType
get() = unit.asEnum(UploadQuotaUnitType.UNKNOWN)
23 changes: 23 additions & 0 deletions models/src/main/java/com/vimeo/networking2/Space.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ package com.vimeo.networking2
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
import com.vimeo.networking2.common.StorageQuota
import com.vimeo.networking2.enums.UploadQuotaPeriodType
import com.vimeo.networking2.enums.UploadQuotaUnitType
import com.vimeo.networking2.enums.UploadSpaceType
import com.vimeo.networking2.enums.asEnum

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

@Json(name = "period")
val period: String? = null,

@Json(name = "showing")
val showing: String? = null,

@Json(name = "unit")
override val unit: String? = null,

@Json(name = "used")
override val used: Long? = null

) : StorageQuota

/**
* @see Space.period
* @see UploadQuotaPeriodType
*/
val Space.periodType: UploadQuotaPeriodType
get() = period.asEnum(UploadQuotaPeriodType.UNKNOWN)

/**
* @see Space.showing
* @see UploadSpaceType
*/
val Space.showingType: UploadSpaceType
get() = showing.asEnum(UploadSpaceType.UNKNOWN)

/**
* @see Space.unit
* @see UploadQuotaUnitType
*/
val Space.unitType: UploadQuotaUnitType
get() = unit.asEnum(UploadQuotaUnitType.UNKNOWN)
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ interface StorageQuota {
*/
val max: Long?

/**
* The unit type of [free], [used], and [max].
*/
val unit: String?

/**
* The number of bytes that you've already uploaded against your quota in the current period.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.vimeo.networking2.enums

/**
* The renewal frequency of the upload quota.
*/
enum class UploadQuotaPeriodType(override val value: String?) : StringValue {
/**
* The quota renews weekly.
*/
WEEKLY("weekly"),

/**
* The quota renews monthly.
*/
MONTHLY("monthly"),

/**
* The quota renews yearly.
*/
YEARLY("yearly"),

/**
* The user doesn't have a periodic quota.
*/
LIFETIME("lifetime"),

/**
* The quota renews on an unknown schedule.
*/
UNKNOWN(null)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.vimeo.networking2.enums

/**
* The unit type of the approach to calculating the upload quota (e.g. a byte size based approach or a video count
* based approach)
*
*/
enum class UploadQuotaUnitType(override val value: String?) : StringValue {

/**
* The quota is calculated using count of videos.
*/
COUNT("video_count"),

/**
* The quota is calculated using the size in bytes of the videos.
*/
SIZE("video_size"),

/**
* The quota is calculated using an unknown approach.
*/
UNKNOWN(null)
}
2 changes: 2 additions & 0 deletions models/src/test/java/com/vimeo/networking2/enums/EnumsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ class EnumsTest {
TranscodeStatusType::class.java,
TrialStatusType::class.java,
TvodItemType::class.java,
UploadQuotaPeriodType::class.java,
UploadQuotaUnitType::class.java,
UploadSpaceType::class.java,
UploadStatusType::class.java,
UserBadgeType::class.java,
Expand Down

0 comments on commit 260392e

Please sign in to comment.