// Generated by protoc-gen-twirp_typescript. DO NOT EDIT
import {code} from './targets.pb';
import {createTwirpAdapter} from 'pbjs-twirp';
import Axios from 'axios';

const getServiceMethodName = (fn: any): string => {
	if (fn === code.justin.tv.eventbus.controlplane.Targets.prototype.create) {
		return 'Create';
    }
	if (fn === code.justin.tv.eventbus.controlplane.Targets.prototype.getTargetsForService) {
		return 'GetTargetsForService';
    }
	if (fn === code.justin.tv.eventbus.controlplane.Targets.prototype.delete) {
		return 'Delete';
    }
	if (fn === code.justin.tv.eventbus.controlplane.Targets.prototype.validate) {
		return 'Validate';
    }

    throw new Error('Unknown Method');
};


export const TargetsPathPrefix = '/twirp/code.justin.tv.eventbus.controlplane.Targets/';

export const createTargets = (baseURL: string, options = {}): code.justin.tv.eventbus.controlplane.Targets => {
    const defaultOpts = {
        baseURL: baseURL + TargetsPathPrefix,
        headers: {
          Accept: 'application/protobuf'
        }
    };
    const axiosOpts = { ...defaultOpts, ...options };
    
    const axios = Axios.create(axiosOpts);

    return code.justin.tv.eventbus.controlplane.Targets.create(createTwirpAdapter(axios, getServiceMethodName));
};
