All files / src/api/cloud-sync data-brokers.js

100% Statements 4/4
100% Branches 0/0
100% Functions 4/4
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34                                      3x   1x       1x       1x        
// @flow
 
import { type Caller } from '.';
 
/**
 * Parameters passed while creating relationship data.
 */
type CreateDataBrokerValues = any;
 
/**
 * Data brokers API.
 */
export interface DataBrokersAPI {
  list(): Promise<any[]>;
  create(values: CreateDataBrokerValues): Promise<any>;
  delete(id: string): Promise<any>;
}
 
export default function dataBrokers(call: Caller): DataBrokersAPI {
  return {
    list() {
      return call('GET', 'data-brokers');
    },
 
    create(values) {
      return call('POST', 'data-brokers', values);
    },
 
    delete(id) {
      return call('DELETE', `data-brokers/${id}`);
    },
  };
}