insomnia/packages/insomnia-app/app/plugins/context/data.js
Gregory Schier 4901f03041 Add Prettier
2018-06-25 13:42:50 -04:00

38 lines
920 B
JavaScript

// @flow
import {
exportHAR,
exportJSON,
importRaw,
importUri
} from '../../common/import';
export function init(): { import: Object, export: Object } {
return {
import: {
async uri(
uri: string,
options: { workspaceId?: string } = {}
): Promise<void> {
await importUri(options.workspaceId || null, uri);
},
async raw(
text: string,
options: { workspaceId?: string } = {}
): Promise<void> {
await importRaw(options.workspaceId || null, text);
}
},
export: {
async insomnia(
options: { includePrivate?: boolean } = {}
): Promise<string> {
options = options || {};
return exportJSON(null, options.includePrivate);
},
async har(options: { includePrivate?: boolean } = {}): Promise<string> {
return exportHAR(null, options.includePrivate);
}
}
};
}