add ChannelUpdateResponse type

This commit is contained in:
Sean Yesmunt 2019-07-02 13:47:42 -04:00
parent 8bfef31386
commit 4c6147efcc
3 changed files with 17 additions and 15 deletions

View file

@ -65,9 +65,7 @@ declare type VersionResponse = {
declare type ResolveResponse = { declare type ResolveResponse = {
// Keys are the url(s) passed to resolve // Keys are the url(s) passed to resolve
[string]: [string]: Claim | { error?: {} },
| Claim
| { error?: {} },
}; };
declare type GetResponse = FileListItem; declare type GetResponse = FileListItem;
@ -105,6 +103,10 @@ declare type ChannelCreateResponse = GenericTxResponse & {
outputs: Array<ChannelClaim>, outputs: Array<ChannelClaim>,
}; };
declare type UpdateChannelResponse = GenericTxResponse & {
outputs: Array<ChannelClaim>,
};
declare type CommentCreateResponse = Comment; declare type CommentCreateResponse = Comment;
declare type CommentListResponse = Array<Comment>; declare type CommentListResponse = Array<Comment>;
@ -157,10 +159,10 @@ declare type LbryTypes = {
connectPromise: ?Promise<any>, connectPromise: ?Promise<any>,
connect: () => void, connect: () => void,
daemonConnectionString: string, daemonConnectionString: string,
apiRequestHeaders: {[key: string]: string}, apiRequestHeaders: { [key: string]: string },
setDaemonConnectionString: string => void, setDaemonConnectionString: string => void,
setApiHeader: (string, string) => void, setApiHeader: (string, string) => void,
unsetApiHeader: (string) => void, unsetApiHeader: string => void,
overrides: { [string]: ?Function }, overrides: { [string]: ?Function },
setOverride: (string, Function) => void, setOverride: (string, Function) => void,
getMediaType: (string, ?string) => string, getMediaType: (string, ?string) => string,
@ -176,8 +178,7 @@ declare type LbryTypes = {
claim_search: (params: {}) => Promise<ClaimSearchResponse>, claim_search: (params: {}) => Promise<ClaimSearchResponse>,
claim_list: (params?: {}) => Promise<ClaimListResponse>, claim_list: (params?: {}) => Promise<ClaimListResponse>,
channel_create: (params: {}) => Promise<ChannelCreateResponse>, channel_create: (params: {}) => Promise<ChannelCreateResponse>,
// TODO fix this type: channel_update: (params: {}) => Promise<UpdateChannelResponse>,
channel_update: (params: {}) => Promise<ChannelCreateResponse>,
channel_list: () => Promise<ChannelListResponse>, channel_list: () => Promise<ChannelListResponse>,
stream_abandon: (params: {}) => Promise<GenericTxResponse>, stream_abandon: (params: {}) => Promise<GenericTxResponse>,
channel_abandon: (params: {}) => Promise<GenericTxResponse>, channel_abandon: (params: {}) => Promise<GenericTxResponse>,

15
flow-typed/Lbry.js vendored
View file

@ -65,9 +65,7 @@ declare type VersionResponse = {
declare type ResolveResponse = { declare type ResolveResponse = {
// Keys are the url(s) passed to resolve // Keys are the url(s) passed to resolve
[string]: [string]: Claim | { error?: {} },
| Claim
| { error?: {} },
}; };
declare type GetResponse = FileListItem; declare type GetResponse = FileListItem;
@ -105,6 +103,10 @@ declare type ChannelCreateResponse = GenericTxResponse & {
outputs: Array<ChannelClaim>, outputs: Array<ChannelClaim>,
}; };
declare type ChannelUpdateResponse = GenericTxResponse & {
outputs: Array<ChannelClaim>,
};
declare type CommentCreateResponse = Comment; declare type CommentCreateResponse = Comment;
declare type CommentListResponse = Array<Comment>; declare type CommentListResponse = Array<Comment>;
@ -157,10 +159,10 @@ declare type LbryTypes = {
connectPromise: ?Promise<any>, connectPromise: ?Promise<any>,
connect: () => void, connect: () => void,
daemonConnectionString: string, daemonConnectionString: string,
apiRequestHeaders: {[key: string]: string}, apiRequestHeaders: { [key: string]: string },
setDaemonConnectionString: string => void, setDaemonConnectionString: string => void,
setApiHeader: (string, string) => void, setApiHeader: (string, string) => void,
unsetApiHeader: (string) => void, unsetApiHeader: string => void,
overrides: { [string]: ?Function }, overrides: { [string]: ?Function },
setOverride: (string, Function) => void, setOverride: (string, Function) => void,
getMediaType: (string, ?string) => string, getMediaType: (string, ?string) => string,
@ -176,8 +178,7 @@ declare type LbryTypes = {
claim_search: (params: {}) => Promise<ClaimSearchResponse>, claim_search: (params: {}) => Promise<ClaimSearchResponse>,
claim_list: (params?: {}) => Promise<ClaimListResponse>, claim_list: (params?: {}) => Promise<ClaimListResponse>,
channel_create: (params: {}) => Promise<ChannelCreateResponse>, channel_create: (params: {}) => Promise<ChannelCreateResponse>,
// TODO fix this type: channel_update: (params: {}) => Promise<ChannelUpdateResponse>,
channel_update: (params: {}) => Promise<ChannelCreateResponse>,
channel_list: () => Promise<ChannelListResponse>, channel_list: () => Promise<ChannelListResponse>,
stream_abandon: (params: {}) => Promise<GenericTxResponse>, stream_abandon: (params: {}) => Promise<GenericTxResponse>,
channel_abandon: (params: {}) => Promise<GenericTxResponse>, channel_abandon: (params: {}) => Promise<GenericTxResponse>,

View file

@ -266,7 +266,7 @@ export function doUpdateChannel(params: any) {
}; };
return Lbry.channel_update(updateParams) return Lbry.channel_update(updateParams)
.then((result: ChannelCreateResponse) => { .then((result: ChannelUpdateResponse) => {
const channelClaim = result.outputs[0]; const channelClaim = result.outputs[0];
dispatch({ dispatch({
type: ACTIONS.UPDATE_CHANNEL_COMPLETED, type: ACTIONS.UPDATE_CHANNEL_COMPLETED,