All files / client/methods renamefolder.js

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