All files / client/methods createfolder.js

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