Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add missing properties to ExportChannelStatusResponse #1138

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
12 changes: 10 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,10 +381,18 @@ export type ExportUsersResponse = {
task_id: string;
};

export type ExportChannelsResult = {
path?: string;
s3_bucket_name?: string;
url?: string;
};

export type ExportChannelStatusResponse = {
status: string;
task_id: string;
created_at?: string;
error?: {};
result?: {};
error?: ExportChannelsResult | null;
result?: {} | null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

result should use ExportChannelsResult

and error should use ErrorResult

where ErrorResult is

type?: string;
description?: string;
stacktrace?: string;
version?: string;

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. That was embarrassing :)

Applied your suggestion with the difference that I've called the error type ExportChannelError since I thought ErrorResult would be too generic. Can change if you actually want it to be that generic.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, also I think null is unnecessary here . ExportChannelError sounds good to me 👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and we would need to make it

 status?: string;
 task_id?: string;

Copy link
Author

@rchl rchl Nov 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and we would need to make it

 status?: string;
 task_id?: string;

Don't fully understand. Add those to the ExportChannelError or change required to optional in ExportChannelStatusResponse?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could see the null value when testing exporting locally.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Status {
  task_id: 'c1e57bb1-04f1-4284-af61-455c3990b631',
  status: 'waiting',
  created_at: '2023-11-30T12:42:46.266232Z',
  updated_at: '2023-11-30T12:42:46.266232Z',
  duration: '16.19ms',
  result: null
}
Status {
  task_id: 'c1e57bb1-04f1-4284-af61-455c3990b631',
  status: 'pending',
  created_at: '2023-11-30T12:42:46.266232Z',
  updated_at: '2023-11-30T12:42:46.501436Z',
  duration: '3.45ms',
  result: null
}
Status {
  task_id: 'c1e57bb1-04f1-4284-af61-455c3990b631',
  status: 'completed',
  created_at: '2023-11-30T12:42:46.266232Z',
  updated_at: '2023-11-30T12:42:46.689775Z',
  duration: '2.00ms',
  result: {
    url: 'https://...'
  }
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added duration though since it was missing.
I don't know how to get ExportChannelError but I've added there too as I'm assuming it would also be present.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW. I wonder what makes you think that task_id and status are optional. Did you verify internally that it can be the case that those are missing? I would think that the response would be pretty useless without those.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're closing on a year here.
If you don't care then I can just close it.

updated_at?: string;
};

Expand Down