{"size": 709, "ext": "js", "max_stars_repo_path": "src/patch.js", "max_stars_repo_name": "felipellrocha/pensieve", "max_stars_repo_stars_event_min_datetime": "2019-05-17T06:35:07.000Z", "max_stars_repo_stars_event_max_datetime": "2019-06-10T08:44:08.000Z", "max_issues_repo_path": "src/patch.js", "max_issues_repo_name": "felipellrocha/pensieve", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/patch.js", "max_forks_repo_name": "felipellrocha/pensieve", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 7, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.3214285714, "max_line_length": 58, "alphanum_fraction": 0.7038081805}
const k8s = require("@kubernetes/client-node");

/*

const patch: any = { spec: { replicas: 0 } };
*/

class PatchedAppsV1Api extends k8s.Core_v1Api {
  patchApiCall(patchOperation) {
    const oldDefaultHeaders = this.defaultHeaders;
    this.defaultHeaders = {
      "Content-Type": "application/json-patch+json",
      ...this.defaultHeaders
    };
    const returnValue = patchOperation();
    this.defaultHeaders = oldDefaultHeaders;
    return returnValue;
  }

  patchService(name, namespace, patch) {
    const patchDeploymentOperation = () =>
      this.patchNamespacedService(name, namespace, patch);
    return this.patchApiCall(patchDeploymentOperation);
  }
}

module.exports = PatchedAppsV1Api;
