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

View File

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

View File

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

View File

@ -458,9 +458,15 @@ input CreateBucketSetInput {
}
type GetUploadLinkReturn {
value: UploadLinkGetUploadLinkErrors!
stream: UploadStreamGQL
}
union UploadLinkGetUploadLinkErrors = UploadLink | GetUploadLinkErrors
type UploadLink {
uploadUrl: String!
headers: [Header]!
uploadCompletionCursor: Int
}
type Header {
@ -468,6 +474,38 @@ type Header {
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 {
videoId: Int!
}