All files / client/methods movefile.js

16.67% Statements 1/6
100% Branches 0/0
33.33% Functions 1/3
16.67% Lines 1/6
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20          19x                            
/* @flow */
 
import invariant from "invariant";
import type { MethodApi } from "../types";
 
export default ({ client }: MethodApi) => (fileid: number, tofolderid: number): Promise<boolean> => {
  invariant(typeof fileid === "number", "`fileid` must be number.");
  invariant(fileid !== 0, "`fileid` cannot be 0.");
  invariant(tofolderid, "`tofolderid` is required.");
 
  return client
    .api("renamefile", {
      params: {
        fileid: fileid,
        tofolderid: tofolderid
      }
    })
    .then(response => response.metadata);
};