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

const getServiceMethodName = (fn: any): string => {
	if (fn === code.justin.tv.eventbus.controlplane.FeatureFlags.prototype.isEnabled) {
		return 'IsEnabled';
    }
	if (fn === code.justin.tv.eventbus.controlplane.FeatureFlags.prototype.enable) {
		return 'Enable';
    }
	if (fn === code.justin.tv.eventbus.controlplane.FeatureFlags.prototype.disable) {
		return 'Disable';
    }
	if (fn === code.justin.tv.eventbus.controlplane.FeatureFlags.prototype.list) {
		return 'List';
    }
	if (fn === code.justin.tv.eventbus.controlplane.FeatureFlags.prototype.create) {
		return 'Create';
    }
	if (fn === code.justin.tv.eventbus.controlplane.FeatureFlags.prototype.delete) {
		return 'Delete';
    }

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


export const FeatureFlagsPathPrefix = '/twirp/code.justin.tv.eventbus.controlplane.FeatureFlags/';

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

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