mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 23:00:30 +00:00
32 lines
973 B
JavaScript
32 lines
973 B
JavaScript
// @flow
|
|
import {
|
|
exportWorkspacesHAR,
|
|
exportWorkspacesData,
|
|
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, format?: 'json' | 'yaml' } = {},
|
|
): Promise<string> {
|
|
options = options || {};
|
|
return exportWorkspacesData(null, !!options.includePrivate, options.format || 'json');
|
|
},
|
|
async har(options: { includePrivate?: boolean } = {}): Promise<string> {
|
|
return exportWorkspacesHAR(null, !!options.includePrivate);
|
|
},
|
|
},
|
|
};
|
|
}
|