Merge pull request 'Adds proper error return to stuff involving upload links' (#39) from mk/add-error-return-to-upload-links into master

Reviewed-on: #39
Reviewed-by: loewy <loewymalkov@gmail.com>
This commit is contained in:
countablecloud 2024-08-16 19:02:31 -06:00
commit 5350c46e0a
4 changed files with 289 additions and 46 deletions

View File

@ -1102,11 +1102,15 @@ export type GetShotsPagination = {
startFrameAfter: Scalars["Int"]["input"]; startFrameAfter: Scalars["Int"]["input"];
}; };
export type GetUploadLinkErrors = {
__typename?: "GetUploadLinkErrors";
error: MustHaveSetForUploadLinkErrSegmentAlreadyUploadedErrProcessingFailedErrNoInitForChunkedUploadErrTooManyProfileImageUploadsErr;
};
export type GetUploadLinkReturn = { export type GetUploadLinkReturn = {
__typename?: "GetUploadLinkReturn"; __typename?: "GetUploadLinkReturn";
headers: Array<Maybe<Header>>; stream?: Maybe<UploadStreamGql>;
uploadCompletionCursor?: Maybe<Scalars["Int"]["output"]>; value: UploadLinkGetUploadLinkErrors;
uploadUrl: Scalars["String"]["output"];
}; };
export type HlsPlaylistGql = { export type HlsPlaylistGql = {
@ -1149,6 +1153,20 @@ export type MakePercentageIntervalGql = {
makePercentage: Scalars["Float"]["output"]; makePercentage: Scalars["Float"]["output"];
}; };
export type MustHaveSetForUploadLinkErr = {
__typename?: "MustHaveSetForUploadLinkErr";
framesPerSecond?: Maybe<Scalars["Boolean"]["output"]>;
resolution?: Maybe<Scalars["Boolean"]["output"]>;
};
export type MustHaveSetForUploadLinkErrSegmentAlreadyUploadedErrProcessingFailedErrNoInitForChunkedUploadErrTooManyProfileImageUploadsErr =
| MustHaveSetForUploadLinkErr
| NoInitForChunkedUploadErr
| ProcessingFailedErr
| SegmentAlreadyUploadedErr
| TooManyProfileImageUploadsErr;
export type Mutation = { export type Mutation = {
__typename?: "Mutation"; __typename?: "Mutation";
addAnnotationToShot: Scalars["Boolean"]["output"]; addAnnotationToShot: Scalars["Boolean"]["output"];
@ -1214,6 +1232,11 @@ export type MutationSetSegmentDurationArgs = {
videoId: Scalars["Int"]["input"]; videoId: Scalars["Int"]["input"];
}; };
export type NoInitForChunkedUploadErr = {
__typename?: "NoInitForChunkedUploadErr";
segmentType: StreamSegmentTypeEnum;
};
export type PageInfoGql = { export type PageInfoGql = {
__typename?: "PageInfoGQL"; __typename?: "PageInfoGQL";
endCursor?: Maybe<Scalars["String"]["output"]>; endCursor?: Maybe<Scalars["String"]["output"]>;
@ -1243,6 +1266,11 @@ export type PocketingIntentionFeaturesGql = {
targetPocketDistance?: Maybe<Scalars["Float"]["output"]>; targetPocketDistance?: Maybe<Scalars["Float"]["output"]>;
}; };
export type ProcessingFailedErr = {
__typename?: "ProcessingFailedErr";
processing: VideoProcessingGql;
};
export enum ProcessingStatusEnum { export enum ProcessingStatusEnum {
Created = "CREATED", Created = "CREATED",
Failed = "FAILED", Failed = "FAILED",
@ -1335,6 +1363,11 @@ export type RangeFilter = {
lessThanInclusive?: Scalars["Boolean"]["input"]; lessThanInclusive?: Scalars["Boolean"]["input"];
}; };
export type SegmentAlreadyUploadedErr = {
__typename?: "SegmentAlreadyUploadedErr";
segmentId: Scalars["Int"]["output"];
};
export type SerializedShotPathsGql = { export type SerializedShotPathsGql = {
__typename?: "SerializedShotPathsGQL"; __typename?: "SerializedShotPathsGQL";
b64EncodedBuffer?: Maybe<Scalars["String"]["output"]>; b64EncodedBuffer?: Maybe<Scalars["String"]["output"]>;
@ -1408,6 +1441,19 @@ export type TargetMetricsGql = {
makePercentage?: Maybe<Scalars["Float"]["output"]>; makePercentage?: Maybe<Scalars["Float"]["output"]>;
}; };
export type TooManyProfileImageUploadsErr = {
__typename?: "TooManyProfileImageUploadsErr";
linksRequested: Scalars["Int"]["output"];
};
export type UploadLink = {
__typename?: "UploadLink";
headers: Array<Maybe<Header>>;
uploadUrl: Scalars["String"]["output"];
};
export type UploadLinkGetUploadLinkErrors = GetUploadLinkErrors | UploadLink;
export type UploadSegmentGql = { export type UploadSegmentGql = {
__typename?: "UploadSegmentGQL"; __typename?: "UploadSegmentGQL";
durationInSeconds?: Maybe<Scalars["Float"]["output"]>; durationInSeconds?: Maybe<Scalars["Float"]["output"]>;
@ -1732,6 +1778,21 @@ export type GetProfileImageUploadLinkMutation = {
__typename?: "Mutation"; __typename?: "Mutation";
getProfileImageUploadLink: { getProfileImageUploadLink: {
__typename?: "GetUploadLinkReturn"; __typename?: "GetUploadLinkReturn";
value:
| {
__typename?: "GetUploadLinkErrors";
error:
| { __typename?: "MustHaveSetForUploadLinkErr" }
| { __typename?: "NoInitForChunkedUploadErr" }
| { __typename?: "ProcessingFailedErr" }
| { __typename?: "SegmentAlreadyUploadedErr" }
| {
__typename?: "TooManyProfileImageUploadsErr";
linksRequested: number;
};
}
| {
__typename?: "UploadLink";
uploadUrl: string; uploadUrl: string;
headers: Array<{ headers: Array<{
__typename?: "Header"; __typename?: "Header";
@ -1739,6 +1800,7 @@ export type GetProfileImageUploadLinkMutation = {
value: string; value: string;
} | null>; } | null>;
}; };
};
}; };
export type EditProfileImageUriMutationVariables = Exact<{ export type EditProfileImageUriMutationVariables = Exact<{
@ -2096,6 +2158,32 @@ export type GetUploadLinkMutation = {
__typename?: "Mutation"; __typename?: "Mutation";
getUploadLink: { getUploadLink: {
__typename?: "GetUploadLinkReturn"; __typename?: "GetUploadLinkReturn";
value:
| {
__typename?: "GetUploadLinkErrors";
error:
| {
__typename?: "MustHaveSetForUploadLinkErr";
resolution?: boolean | null;
framesPerSecond?: boolean | null;
}
| { __typename?: "NoInitForChunkedUploadErr" }
| {
__typename?: "ProcessingFailedErr";
processing: {
__typename?: "VideoProcessingGQL";
status: ProcessingStatusEnum;
errors: Array<{
__typename?: "VideoProcessingErrorGQL";
message: string;
}>;
};
}
| { __typename?: "SegmentAlreadyUploadedErr"; segmentId: number }
| { __typename?: "TooManyProfileImageUploadsErr" };
}
| {
__typename?: "UploadLink";
uploadUrl: string; uploadUrl: string;
headers: Array<{ headers: Array<{
__typename?: "Header"; __typename?: "Header";
@ -2103,6 +2191,11 @@ export type GetUploadLinkMutation = {
value: string; value: string;
} | null>; } | null>;
}; };
stream?: {
__typename?: "UploadStreamGQL";
uploadCompletionCursor: number;
} | null;
};
}; };
export type GetHlsInitUploadLinkMutationVariables = Exact<{ export type GetHlsInitUploadLinkMutationVariables = Exact<{
@ -2113,6 +2206,21 @@ export type GetHlsInitUploadLinkMutation = {
__typename?: "Mutation"; __typename?: "Mutation";
getHlsInitUploadLink: { getHlsInitUploadLink: {
__typename?: "GetUploadLinkReturn"; __typename?: "GetUploadLinkReturn";
value:
| {
__typename?: "GetUploadLinkErrors";
error:
| { __typename?: "MustHaveSetForUploadLinkErr" }
| {
__typename?: "NoInitForChunkedUploadErr";
segmentType: StreamSegmentTypeEnum;
}
| { __typename?: "ProcessingFailedErr" }
| { __typename?: "SegmentAlreadyUploadedErr" }
| { __typename?: "TooManyProfileImageUploadsErr" };
}
| {
__typename?: "UploadLink";
uploadUrl: string; uploadUrl: string;
headers: Array<{ headers: Array<{
__typename?: "Header"; __typename?: "Header";
@ -2120,6 +2228,7 @@ export type GetHlsInitUploadLinkMutation = {
value: string; value: string;
} | null>; } | null>;
}; };
};
}; };
export type SetSegmentDurationMutationVariables = Exact<{ export type SetSegmentDurationMutationVariables = Exact<{
@ -2729,12 +2838,23 @@ export type GetShotAnnotationTypesQueryResult = Apollo.QueryResult<
export const GetProfileImageUploadLinkDocument = gql` export const GetProfileImageUploadLinkDocument = gql`
mutation getProfileImageUploadLink($fileExt: String = ".png") { mutation getProfileImageUploadLink($fileExt: String = ".png") {
getProfileImageUploadLink(fileExt: $fileExt) { getProfileImageUploadLink(fileExt: $fileExt) {
value {
... on UploadLink {
uploadUrl uploadUrl
headers { headers {
key key
value value
} }
} }
... on GetUploadLinkErrors {
error {
... on TooManyProfileImageUploadsErr {
linksRequested
}
}
}
}
}
} }
`; `;
export type GetProfileImageUploadLinkMutationFn = Apollo.MutationFunction< export type GetProfileImageUploadLinkMutationFn = Apollo.MutationFunction<
@ -3996,12 +4116,38 @@ export type CreateUploadStreamMutationOptions = Apollo.BaseMutationOptions<
export const GetUploadLinkDocument = gql` export const GetUploadLinkDocument = gql`
mutation GetUploadLink($videoId: Int!, $segmentIndex: Int!) { mutation GetUploadLink($videoId: Int!, $segmentIndex: Int!) {
getUploadLink(videoId: $videoId, segmentIndex: $segmentIndex) { getUploadLink(videoId: $videoId, segmentIndex: $segmentIndex) {
value {
... on UploadLink {
uploadUrl uploadUrl
headers { headers {
key key
value value
} }
} }
... on GetUploadLinkErrors {
error {
... on MustHaveSetForUploadLinkErr {
resolution
framesPerSecond
}
... on SegmentAlreadyUploadedErr {
segmentId
}
... on ProcessingFailedErr {
processing {
status
errors {
message
}
}
}
}
}
}
stream {
uploadCompletionCursor
}
}
} }
`; `;
export type GetUploadLinkMutationFn = Apollo.MutationFunction< export type GetUploadLinkMutationFn = Apollo.MutationFunction<
@ -4051,12 +4197,23 @@ export type GetUploadLinkMutationOptions = Apollo.BaseMutationOptions<
export const GetHlsInitUploadLinkDocument = gql` export const GetHlsInitUploadLinkDocument = gql`
mutation GetHlsInitUploadLink($videoId: Int!) { mutation GetHlsInitUploadLink($videoId: Int!) {
getHlsInitUploadLink(videoId: $videoId) { getHlsInitUploadLink(videoId: $videoId) {
value {
... on UploadLink {
uploadUrl uploadUrl
headers { headers {
key key
value value
} }
} }
... on GetUploadLinkErrors {
error {
... on NoInitForChunkedUploadErr {
segmentType
}
}
}
}
}
} }
`; `;
export type GetHlsInitUploadLinkMutationFn = Apollo.MutationFunction< export type GetHlsInitUploadLinkMutationFn = Apollo.MutationFunction<

View File

@ -1,11 +1,22 @@
mutation getProfileImageUploadLink($fileExt: String = ".png") { mutation getProfileImageUploadLink($fileExt: String = ".png") {
getProfileImageUploadLink(fileExt: $fileExt) { getProfileImageUploadLink(fileExt: $fileExt) {
value {
... on UploadLink {
uploadUrl uploadUrl
headers { headers {
key key
value value
} }
} }
... on GetUploadLinkErrors {
error {
... on TooManyProfileImageUploadsErr {
linksRequested
}
}
}
}
}
} }
mutation editProfileImageUri($profileImageUri: String!) { mutation editProfileImageUri($profileImageUri: String!) {

View File

@ -6,22 +6,59 @@ mutation CreateUploadStream($videoMetadataInput: VideoMetadataInput!) {
mutation GetUploadLink($videoId: Int!, $segmentIndex: Int!) { mutation GetUploadLink($videoId: Int!, $segmentIndex: Int!) {
getUploadLink(videoId: $videoId, segmentIndex: $segmentIndex) { getUploadLink(videoId: $videoId, segmentIndex: $segmentIndex) {
value {
... on UploadLink {
uploadUrl uploadUrl
headers { headers {
key key
value value
} }
} }
... on GetUploadLinkErrors {
error {
... on MustHaveSetForUploadLinkErr {
resolution
framesPerSecond
}
... on SegmentAlreadyUploadedErr {
segmentId
}
... on ProcessingFailedErr {
processing {
status
errors {
message
}
}
}
}
}
}
stream {
uploadCompletionCursor
}
}
} }
mutation GetHlsInitUploadLink($videoId: Int!) { mutation GetHlsInitUploadLink($videoId: Int!) {
getHlsInitUploadLink(videoId: $videoId) { getHlsInitUploadLink(videoId: $videoId) {
value {
... on UploadLink {
uploadUrl uploadUrl
headers { headers {
key key
value value
} }
} }
... on GetUploadLinkErrors {
error {
... on NoInitForChunkedUploadErr {
segmentType
}
}
}
}
}
} }
mutation SetSegmentDuration( mutation SetSegmentDuration(

View File

@ -458,9 +458,15 @@ input CreateBucketSetInput {
} }
type GetUploadLinkReturn { type GetUploadLinkReturn {
value: UploadLinkGetUploadLinkErrors!
stream: UploadStreamGQL
}
union UploadLinkGetUploadLinkErrors = UploadLink | GetUploadLinkErrors
type UploadLink {
uploadUrl: String! uploadUrl: String!
headers: [Header]! headers: [Header]!
uploadCompletionCursor: Int
} }
type Header { type Header {
@ -468,6 +474,38 @@ type Header {
value: String! value: String!
} }
type GetUploadLinkErrors {
error: MustHaveSetForUploadLinkErrSegmentAlreadyUploadedErrProcessingFailedErrNoInitForChunkedUploadErrTooManyProfileImageUploadsErr!
}
union MustHaveSetForUploadLinkErrSegmentAlreadyUploadedErrProcessingFailedErrNoInitForChunkedUploadErrTooManyProfileImageUploadsErr =
MustHaveSetForUploadLinkErr
| SegmentAlreadyUploadedErr
| ProcessingFailedErr
| NoInitForChunkedUploadErr
| TooManyProfileImageUploadsErr
type MustHaveSetForUploadLinkErr {
resolution: Boolean
framesPerSecond: Boolean
}
type SegmentAlreadyUploadedErr {
segmentId: Int!
}
type ProcessingFailedErr {
processing: VideoProcessingGQL!
}
type NoInitForChunkedUploadErr {
segmentType: StreamSegmentTypeEnum!
}
type TooManyProfileImageUploadsErr {
linksRequested: Int!
}
type CreateUploadStreamReturn { type CreateUploadStreamReturn {
videoId: Int! videoId: Int!
} }