diff --git a/src/index.tsx b/src/index.tsx index 9679d75..ccc5c5d 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -232,9 +232,18 @@ export type CreateSubscriptionResultGql = { export type CreateUploadStreamReturn = { __typename?: "CreateUploadStreamReturn"; + value: CreateUploadStreamSuccessQuotaExceededErr; +}; + +export type CreateUploadStreamSuccess = { + __typename?: "CreateUploadStreamSuccess"; videoId: Scalars["Int"]["output"]; }; +export type CreateUploadStreamSuccessQuotaExceededErr = + | CreateUploadStreamSuccess + | QuotaExceededErr; + export type CreatedAfter = | { createdAt: Scalars["DateTime"]["input"]; videoId?: never } | { createdAt?: never; videoId: Scalars["Int"]["input"] }; @@ -2223,7 +2232,7 @@ export type GetShotsResult = { export type GetUploadLinkErrors = { __typename?: "GetUploadLinkErrors"; - error: MustHaveSetForUploadLinkErrSegmentAlreadyUploadedErrProcessingFailedErrNoInitForChunkedUploadErrTooManyProfileImageUploadsErrInitUploadAlreadyCompletedErrTooManyInitUploadsErr; + error: MustHaveSetForUploadLinkErrSegmentAlreadyUploadedErrProcessingFailedErrNoInitForChunkedUploadErrTooManyProfileImageUploadsErrInitUploadAlreadyCompletedErrTooManyInitUploadsErrQuotaExceededErr; }; export type GetUploadLinkReturn = { @@ -2327,12 +2336,13 @@ export type MustHaveSetForUploadLinkErr = { resolution?: Maybe; }; -export type MustHaveSetForUploadLinkErrSegmentAlreadyUploadedErrProcessingFailedErrNoInitForChunkedUploadErrTooManyProfileImageUploadsErrInitUploadAlreadyCompletedErrTooManyInitUploadsErr = +export type MustHaveSetForUploadLinkErrSegmentAlreadyUploadedErrProcessingFailedErrNoInitForChunkedUploadErrTooManyProfileImageUploadsErrInitUploadAlreadyCompletedErrTooManyInitUploadsErrQuotaExceededErr = | InitUploadAlreadyCompletedErr | MustHaveSetForUploadLinkErr | NoInitForChunkedUploadErr | ProcessingFailedErr + | QuotaExceededErr | SegmentAlreadyUploadedErr | TooManyInitUploadsErr | TooManyProfileImageUploadsErr; @@ -2432,6 +2442,7 @@ export type MutationCreateSubscriptionArgs = { }; export type MutationCreateUploadStreamArgs = { + expectedDurationSeconds?: InputMaybe; videoMetadata: VideoMetadataInput; }; @@ -2716,6 +2727,7 @@ export type Query = { getMedals: RequestedMedalsGql; getOrderedShots: GetShotsResult; getPlayTime: UserPlayTimeGql; + getQuotaStatus: QuotaStatusGql; getRuns: GetRunsResult; getShotAnnotationTypes: Array; getShots: Array; @@ -2905,6 +2917,31 @@ export type QueryWaitForArgs = { duration: Scalars["Float"]["input"]; }; +export type QuotaExceededErr = { + __typename?: "QuotaExceededErr"; + limit?: Maybe; + message: Scalars["String"]["output"]; + reason: QuotaExceededReasonEnum; + used?: Maybe; +}; + +export enum QuotaExceededReasonEnum { + MonthlyDuration = "MONTHLY_DURATION", + VideoDuration = "VIDEO_DURATION", +} + +export type QuotaStatusGql = { + __typename?: "QuotaStatusGQL"; + canUpload: Scalars["Boolean"]["output"]; + durationLimitSeconds?: Maybe; + durationRemainingSeconds?: Maybe; + durationUsedSeconds: Scalars["Float"]["output"]; + maxVideoDurationSeconds?: Maybe; + periodEnd: Scalars["DateTime"]["output"]; + periodStart: Scalars["DateTime"]["output"]; + tierName: Scalars["String"]["output"]; +}; + export enum ReactionEnum { Bullseye = "BULLSEYE", Heart = "HEART", @@ -6239,7 +6276,15 @@ export type CreateUploadStreamMutation = { __typename?: "Mutation"; createUploadStream: { __typename?: "CreateUploadStreamReturn"; - videoId: number; + value: + | { __typename?: "CreateUploadStreamSuccess"; videoId: number } + | { + __typename?: "QuotaExceededErr"; + reason: QuotaExceededReasonEnum; + message: string; + limit?: number | null; + used?: number | null; + }; }; }; @@ -6274,6 +6319,7 @@ export type GetUploadLinkMutation = { }>; }; } + | { __typename?: "QuotaExceededErr" } | { __typename?: "SegmentAlreadyUploadedErr"; segmentId: number } | { __typename?: "TooManyInitUploadsErr" } | { __typename?: "TooManyProfileImageUploadsErr" }; @@ -6316,6 +6362,7 @@ export type GetHlsInitUploadLinkMutation = { segmentType: StreamSegmentTypeEnum; } | { __typename?: "ProcessingFailedErr" } + | { __typename?: "QuotaExceededErr" } | { __typename?: "SegmentAlreadyUploadedErr" } | { __typename?: "TooManyInitUploadsErr"; linksRequested: number } | { __typename?: "TooManyProfileImageUploadsErr" }; @@ -13201,7 +13248,17 @@ export type FindPrerecordTableLayoutMutationOptions = export const CreateUploadStreamDocument = gql` mutation CreateUploadStream($videoMetadataInput: VideoMetadataInput!) { createUploadStream(videoMetadata: $videoMetadataInput) { - videoId + value { + ... on CreateUploadStreamSuccess { + videoId + } + ... on QuotaExceededErr { + reason + message + limit + used + } + } } } `; diff --git a/src/operations/video_upload.gql b/src/operations/video_upload.gql index 6c14bf0..252f319 100644 --- a/src/operations/video_upload.gql +++ b/src/operations/video_upload.gql @@ -1,6 +1,16 @@ mutation CreateUploadStream($videoMetadataInput: VideoMetadataInput!) { createUploadStream(videoMetadata: $videoMetadataInput) { - videoId + value { + ... on CreateUploadStreamSuccess { + videoId + } + ... on QuotaExceededErr { + reason + message + limit + used + } + } } } diff --git a/src/schema.gql b/src/schema.gql index 33a9be9..0750ea6 100644 --- a/src/schema.gql +++ b/src/schema.gql @@ -97,6 +97,7 @@ type Query { ): UserRelationshipsResult! getAvailableSubscriptionOptions: StripeSubscriptionOptionsGQL! getUserSubscriptionStatus: UserSubscriptionStatusGQL! + getQuotaStatus: QuotaStatusGQL! getPlayTime(userId: Int!, filters: VideoFilterInput = null): UserPlayTimeGQL! getUserVideos( userId: Int = null @@ -977,6 +978,17 @@ enum StripeSubscriptionStatusEnum { PAUSED } +type QuotaStatusGQL { + tierName: String! + periodStart: DateTime! + periodEnd: DateTime! + durationUsedSeconds: Float! + durationLimitSeconds: Int + maxVideoDurationSeconds: Int + durationRemainingSeconds: Float + canUpload: Boolean! +} + type UserPlayTimeGQL { totalSeconds: Float! } @@ -1082,6 +1094,7 @@ type Mutation { findPrerecordTableLayout(b64Image: String!, videoId: Int!): HomographyInfoGQL createUploadStream( videoMetadata: VideoMetadataInput! + expectedDurationSeconds: Float = null ): CreateUploadStreamReturn! getUploadLink(videoId: Int!, segmentIndex: Int!): GetUploadLinkReturn! getHlsInitUploadLink(videoId: Int!): GetUploadLinkReturn! @@ -1219,9 +1232,29 @@ input CancellationFeedbackMetadataInput { } type CreateUploadStreamReturn { + value: CreateUploadStreamSuccessQuotaExceededErr! +} + +union CreateUploadStreamSuccessQuotaExceededErr = + CreateUploadStreamSuccess + | QuotaExceededErr + +type CreateUploadStreamSuccess { videoId: Int! } +type QuotaExceededErr { + reason: QuotaExceededReasonEnum! + message: String! + limit: Float + used: Float +} + +enum QuotaExceededReasonEnum { + MONTHLY_DURATION + VIDEO_DURATION +} + input VideoMetadataInput { videoName: String = null startTime: DateTime = null @@ -1257,10 +1290,10 @@ type GetUploadLinkReturn { union UploadLinkGetUploadLinkErrors = UploadLink | GetUploadLinkErrors type GetUploadLinkErrors { - error: MustHaveSetForUploadLinkErrSegmentAlreadyUploadedErrProcessingFailedErrNoInitForChunkedUploadErrTooManyProfileImageUploadsErrInitUploadAlreadyCompletedErrTooManyInitUploadsErr! + error: MustHaveSetForUploadLinkErrSegmentAlreadyUploadedErrProcessingFailedErrNoInitForChunkedUploadErrTooManyProfileImageUploadsErrInitUploadAlreadyCompletedErrTooManyInitUploadsErrQuotaExceededErr! } -union MustHaveSetForUploadLinkErrSegmentAlreadyUploadedErrProcessingFailedErrNoInitForChunkedUploadErrTooManyProfileImageUploadsErrInitUploadAlreadyCompletedErrTooManyInitUploadsErr = +union MustHaveSetForUploadLinkErrSegmentAlreadyUploadedErrProcessingFailedErrNoInitForChunkedUploadErrTooManyProfileImageUploadsErrInitUploadAlreadyCompletedErrTooManyInitUploadsErrQuotaExceededErr = MustHaveSetForUploadLinkErr | SegmentAlreadyUploadedErr | ProcessingFailedErr @@ -1268,6 +1301,7 @@ union MustHaveSetForUploadLinkErrSegmentAlreadyUploadedErrProcessingFailedErrNoI | TooManyProfileImageUploadsErr | InitUploadAlreadyCompletedErr | TooManyInitUploadsErr + | QuotaExceededErr type MustHaveSetForUploadLinkErr { resolution: Boolean