/// <reference path="./custom.d.ts" />
// tslint:disable
/**
 * backend/api/v2beta1/pipeline.proto
 * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
 *
 * OpenAPI spec version: version not set
 *
 *
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen.git
 * Do not edit the class manually.
 */

import * as url from 'url';
import * as portableFetch from 'portable-fetch';
import { Configuration } from './configuration';

const BASE_PATH = 'http://localhost'.replace(/\/+$/, '');

/**
 *
 * @export
 */
export const COLLECTION_FORMATS = {
  csv: ',',
  ssv: ' ',
  tsv: '\t',
  pipes: '|',
};

/**
 *
 * @export
 * @interface FetchAPI
 */
export interface FetchAPI {
  (url: string, init?: any): Promise<Response>;
}

/**
 *
 * @export
 * @interface FetchArgs
 */
export interface FetchArgs {
  url: string;
  options: any;
}

/**
 *
 * @export
 * @class BaseAPI
 */
export class BaseAPI {
  protected configuration: Configuration;

  constructor(
    configuration?: Configuration,
    protected basePath: string = BASE_PATH,
    protected fetch: FetchAPI = portableFetch,
  ) {
    if (configuration) {
      this.configuration = configuration;
      this.basePath = configuration.basePath || this.basePath;
    }
  }
}

/**
 *
 * @export
 * @class RequiredError
 * @extends {Error}
 */
export class RequiredError extends Error {
  name: 'RequiredError';
  constructor(public field: string, msg?: string) {
    super(msg);
  }
}

/**
 * The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details.  You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
 * @export
 * @interface GooglerpcStatus
 */
export interface GooglerpcStatus {
  /**
   * The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].
   * @type {number}
   * @memberof GooglerpcStatus
   */
  code?: number;
  /**
   * A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.
   * @type {string}
   * @memberof GooglerpcStatus
   */
  message?: string;
  /**
   * A list of messages that carry the error details.  There is a common set of message types for APIs to use.
   * @type {Array<ProtobufAny>}
   * @memberof GooglerpcStatus
   */
  details?: Array<ProtobufAny>;
}

/**
 * `Any` contains an arbitrary serialized protocol buffer message along with a URL that describes the type of the serialized message.  Protobuf library provides support to pack/unpack Any values in the form of utility functions or additional generated methods of the Any type.  Example 1: Pack and unpack a message in C++.      Foo foo = ...;     Any any;     any.PackFrom(foo);     ...     if (any.UnpackTo(&foo)) {       ...     }  Example 2: Pack and unpack a message in Java.      Foo foo = ...;     Any any = Any.pack(foo);     ...     if (any.is(Foo.class)) {       foo = any.unpack(Foo.class);     }   Example 3: Pack and unpack a message in Python.      foo = Foo(...)     any = Any()     any.Pack(foo)     ...     if any.Is(Foo.DESCRIPTOR):       any.Unpack(foo)       ...   Example 4: Pack and unpack a message in Go       foo := &pb.Foo{...}      any, err := anypb.New(foo)      if err != nil {        ...      }      ...      foo := &pb.Foo{}      if err := any.UnmarshalTo(foo); err != nil {        ...      }  The pack methods provided by protobuf library will by default use 'type.googleapis.com/full.type.name' as the type URL and the unpack methods only use the fully qualified type name after the last '/' in the type URL, for example \"foo.bar.com/x/y.z\" will yield type name \"y.z\".   JSON ==== The JSON representation of an `Any` value uses the regular representation of the deserialized, embedded message, with an additional field `@type` which contains the type URL. Example:      package google.profile;     message Person {       string first_name = 1;       string last_name = 2;     }      {       \"@type\": \"type.googleapis.com/google.profile.Person\",       \"firstName\": <string>,       \"lastName\": <string>     }  If the embedded message type is well-known and has a custom JSON representation, that representation will be embedded adding a field `value` which holds the custom JSON in addition to the `@type` field. Example (for message [google.protobuf.Duration][]):      {       \"@type\": \"type.googleapis.com/google.protobuf.Duration\",       \"value\": \"1.212s\"     }
 * @export
 * @interface ProtobufAny
 */
export interface ProtobufAny {
  /**
   * A URL/resource name that uniquely identifies the type of the serialized protocol buffer message. This string must contain at least one \"/\" character. The last segment of the URL's path must represent the fully qualified name of the type (as in `path/google.protobuf.Duration`). The name should be in a canonical form (e.g., leading \".\" is not accepted).  In practice, teams usually precompile into the binary all types that they expect it to use in the context of Any. However, for URLs which use the scheme `http`, `https`, or no scheme, one can optionally set up a type server that maps type URLs to message definitions as follows:  * If no scheme is provided, `https` is assumed. * An HTTP GET on the URL must yield a [google.protobuf.Type][]   value in binary format, or produce an error. * Applications are allowed to cache lookup results based on the   URL, or have them precompiled into a binary to avoid any   lookup. Therefore, binary compatibility needs to be preserved   on changes to types. (Use versioned type names to manage   breaking changes.)  Note: this functionality is not currently available in the official protobuf release, and it is not used for type URLs beginning with type.googleapis.com.  Schemes other than `http`, `https` (or the empty scheme) might be used with implementation specific semantics.
   * @type {string}
   * @memberof ProtobufAny
   */
  type_url?: string;
  /**
   * Must be a valid serialized protocol buffer of the above specified type.
   * @type {string}
   * @memberof ProtobufAny
   */
  value?: string;
}

/**
 * `NullValue` is a singleton enumeration to represent the null value for the `Value` type union.   The JSON representation for `NullValue` is JSON `null`.   - NULL_VALUE: Null value.
 * @export
 * @enum {string}
 */
export enum ProtobufNullValue {
  NULLVALUE = <any>'NULL_VALUE',
}

/**
 *
 * @export
 * @interface V2beta1ListPipelineVersionsResponse
 */
export interface V2beta1ListPipelineVersionsResponse {
  /**
   * Returned pipeline versions.
   * @type {Array<V2beta1PipelineVersion>}
   * @memberof V2beta1ListPipelineVersionsResponse
   */
  pipeline_versions?: Array<V2beta1PipelineVersion>;
  /**
   * The token to list the next page of pipeline versions.
   * @type {string}
   * @memberof V2beta1ListPipelineVersionsResponse
   */
  next_page_token?: string;
  /**
   * The total number of pipeline versions for the given query.
   * @type {number}
   * @memberof V2beta1ListPipelineVersionsResponse
   */
  total_size?: number;
}

/**
 *
 * @export
 * @interface V2beta1ListPipelinesResponse
 */
export interface V2beta1ListPipelinesResponse {
  /**
   * Returned pipelines.
   * @type {Array<V2beta1Pipeline>}
   * @memberof V2beta1ListPipelinesResponse
   */
  pipelines?: Array<V2beta1Pipeline>;
  /**
   * The total number of pipelines for the given query.
   * @type {number}
   * @memberof V2beta1ListPipelinesResponse
   */
  total_size?: number;
  /**
   * The token to list the next page of pipelines. This token can be used on the next ListPipelinesRequest.
   * @type {string}
   * @memberof V2beta1ListPipelinesResponse
   */
  next_page_token?: string;
}

/**
 *
 * @export
 * @interface V2beta1Pipeline
 */
export interface V2beta1Pipeline {
  /**
   * Output. Unique pipeline ID. Generated by API server.
   * @type {string}
   * @memberof V2beta1Pipeline
   */
  pipeline_id?: string;
  /**
   * Required input field. Pipeline display name provided by user.
   * @type {string}
   * @memberof V2beta1Pipeline
   */
  display_name?: string;
  /**
   * Required input field. Pipeline name provided by user.
   * @type {string}
   * @memberof V2beta1Pipeline
   */
  name?: string;
  /**
   * Optional input field. A short description of the pipeline.
   * @type {string}
   * @memberof V2beta1Pipeline
   */
  description?: string;
  /**
   * Output. Creation time of the pipeline.
   * @type {Date}
   * @memberof V2beta1Pipeline
   */
  created_at?: Date;
  /**
   * Input. A namespace this pipeline belongs to. Causes error if user is not authorized to access the specified namespace. If not specified in CreatePipeline, default namespace is used.
   * @type {string}
   * @memberof V2beta1Pipeline
   */
  namespace?: string;
  /**
   * In case any error happens retrieving a pipeline field, only pipeline ID, and the error message is returned. Client has the flexibility of choosing how to handle the error. This is especially useful during listing call.
   * @type {GooglerpcStatus}
   * @memberof V2beta1Pipeline
   */
  error?: GooglerpcStatus;
}

/**
 *
 * @export
 * @interface V2beta1PipelineVersion
 */
export interface V2beta1PipelineVersion {
  /**
   * Required input field. Unique ID of the parent pipeline.
   * @type {string}
   * @memberof V2beta1PipelineVersion
   */
  pipeline_id?: string;
  /**
   * Output. Unique pipeline version ID. Generated by API server.
   * @type {string}
   * @memberof V2beta1PipelineVersion
   */
  pipeline_version_id?: string;
  /**
   * Required input field. Pipeline version name provided by user.
   * @type {string}
   * @memberof V2beta1PipelineVersion
   */
  display_name?: string;
  /**
   * Required input field. Pipeline version name provided by user.
   * @type {string}
   * @memberof V2beta1PipelineVersion
   */
  name?: string;
  /**
   * Optional input field. Short description of the pipeline version.
   * @type {string}
   * @memberof V2beta1PipelineVersion
   */
  description?: string;
  /**
   * Output. Creation time of the pipeline version.
   * @type {Date}
   * @memberof V2beta1PipelineVersion
   */
  created_at?: Date;
  /**
   * Input. Required. The URL to the source of the pipeline version. This is required when creating the pipeine version through CreatePipelineVersion API.
   * @type {V2beta1Url}
   * @memberof V2beta1PipelineVersion
   */
  package_url?: V2beta1Url;
  /**
   * Input. Optional. The URL to the code source of the pipeline version. The code is usually the Python definition of the pipeline and potentially related the component definitions. This allows users to trace back to how the pipeline YAML was created.
   * @type {string}
   * @memberof V2beta1PipelineVersion
   */
  code_source_url?: string;
  /**
   * Output. The pipeline spec for the pipeline version.
   * @type {any}
   * @memberof V2beta1PipelineVersion
   */
  pipeline_spec?: any;
  /**
   * In case any error happens retrieving a pipeline version field, only pipeline ID, pipeline version ID, and the error message are returned.  Client has the flexibility of choosing how to handle the error.  This is especially useful during List() calls.
   * @type {GooglerpcStatus}
   * @memberof V2beta1PipelineVersion
   */
  error?: GooglerpcStatus;
}

/**
 *
 * @export
 * @interface V2beta1Url
 */
export interface V2beta1Url {
  /**
   * URL of the pipeline version definition.
   * @type {string}
   * @memberof V2beta1Url
   */
  pipeline_url?: string;
}

/**
 * PipelineServiceApi - fetch parameter creator
 * @export
 */
export const PipelineServiceApiFetchParamCreator = function(configuration?: Configuration) {
  return {
    /**
     *
     * @summary Creates a pipeline.
     * @param {V2beta1Pipeline} body Required input. Pipeline that needs to be created.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    createPipeline(body: V2beta1Pipeline, options: any = {}): FetchArgs {
      // verify required parameter 'body' is not null or undefined
      if (body === null || body === undefined) {
        throw new RequiredError(
          'body',
          'Required parameter body was null or undefined when calling createPipeline.',
        );
      }
      const localVarPath = `/apis/v2beta1/pipelines`;
      const localVarUrlObj = url.parse(localVarPath, true);
      const localVarRequestOptions = Object.assign({ method: 'POST' }, options);
      const localVarHeaderParameter = {} as any;
      const localVarQueryParameter = {} as any;

      // authentication Bearer required
      if (configuration && configuration.apiKey) {
        const localVarApiKeyValue =
          typeof configuration.apiKey === 'function'
            ? configuration.apiKey('authorization')
            : configuration.apiKey;
        localVarHeaderParameter['authorization'] = localVarApiKeyValue;
      }

      localVarHeaderParameter['Content-Type'] = 'application/json';

      localVarUrlObj.query = Object.assign(
        {},
        localVarUrlObj.query,
        localVarQueryParameter,
        options.query,
      );
      // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
      delete localVarUrlObj.search;
      localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);
      const needsSerialization =
        <any>'V2beta1Pipeline' !== 'string' ||
        localVarRequestOptions.headers['Content-Type'] === 'application/json';
      localVarRequestOptions.body = needsSerialization ? JSON.stringify(body || {}) : body || '';

      return {
        url: url.format(localVarUrlObj),
        options: localVarRequestOptions,
      };
    },
    /**
     *
     * @summary Adds a pipeline version to the specified pipeline ID.
     * @param {string} pipeline_id Required input. ID of the parent pipeline.
     * @param {V2beta1PipelineVersion} body Required input. Pipeline version ID to be created.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    createPipelineVersion(
      pipeline_id: string,
      body: V2beta1PipelineVersion,
      options: any = {},
    ): FetchArgs {
      // verify required parameter 'pipeline_id' is not null or undefined
      if (pipeline_id === null || pipeline_id === undefined) {
        throw new RequiredError(
          'pipeline_id',
          'Required parameter pipeline_id was null or undefined when calling createPipelineVersion.',
        );
      }
      // verify required parameter 'body' is not null or undefined
      if (body === null || body === undefined) {
        throw new RequiredError(
          'body',
          'Required parameter body was null or undefined when calling createPipelineVersion.',
        );
      }
      const localVarPath = `/apis/v2beta1/pipelines/{pipeline_id}/versions`.replace(
        `{${'pipeline_id'}}`,
        encodeURIComponent(String(pipeline_id)),
      );
      const localVarUrlObj = url.parse(localVarPath, true);
      const localVarRequestOptions = Object.assign({ method: 'POST' }, options);
      const localVarHeaderParameter = {} as any;
      const localVarQueryParameter = {} as any;

      // authentication Bearer required
      if (configuration && configuration.apiKey) {
        const localVarApiKeyValue =
          typeof configuration.apiKey === 'function'
            ? configuration.apiKey('authorization')
            : configuration.apiKey;
        localVarHeaderParameter['authorization'] = localVarApiKeyValue;
      }

      localVarHeaderParameter['Content-Type'] = 'application/json';

      localVarUrlObj.query = Object.assign(
        {},
        localVarUrlObj.query,
        localVarQueryParameter,
        options.query,
      );
      // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
      delete localVarUrlObj.search;
      localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);
      const needsSerialization =
        <any>'V2beta1PipelineVersion' !== 'string' ||
        localVarRequestOptions.headers['Content-Type'] === 'application/json';
      localVarRequestOptions.body = needsSerialization ? JSON.stringify(body || {}) : body || '';

      return {
        url: url.format(localVarUrlObj),
        options: localVarRequestOptions,
      };
    },
    /**
     *
     * @summary Deletes an empty pipeline by ID. Returns error if the pipeline has pipeline versions.
     * @param {string} pipeline_id Required input. ID of the pipeline to be deleted.
     * @param {boolean} [cascade] Optional input. If true, deletes pipeline versions along with the pipeline.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    deletePipeline(pipeline_id: string, cascade?: boolean, options?: any): FetchArgs {
      // Set default options if not provided
      const requestOptions = options || {};
      // verify required parameter 'pipeline_id' is not null or undefined
      if (pipeline_id === null || pipeline_id === undefined) {
        throw new RequiredError(
          'pipeline_id',
          'Required parameter pipeline_id was null or undefined when calling deletePipeline.',
        );
      }
      const localVarPath = `/apis/v2beta1/pipelines/{pipeline_id}`.replace(
        `{${'pipeline_id'}}`,
        encodeURIComponent(String(pipeline_id)),
      );
      const localVarUrlObj = url.parse(localVarPath, true);
      const localVarRequestOptions = Object.assign({ method: 'DELETE' }, requestOptions);
      const localVarHeaderParameter = {} as any;
      const localVarQueryParameter = {} as any;

      if (cascade !== undefined) {
        localVarQueryParameter['cascade'] = cascade;
      }

      // authentication Bearer required
      if (configuration && configuration.apiKey) {
        const localVarApiKeyValue =
          typeof configuration.apiKey === 'function'
            ? configuration.apiKey('authorization')
            : configuration.apiKey;
        localVarHeaderParameter['authorization'] = localVarApiKeyValue;
      }

      localVarUrlObj.query = Object.assign(
        {},
        localVarUrlObj.query,
        localVarQueryParameter,
        requestOptions.query,
      );
      // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
      delete localVarUrlObj.search;
      localVarRequestOptions.headers = Object.assign(
        {},
        localVarHeaderParameter,
        requestOptions.headers,
      );

      return {
        url: url.format(localVarUrlObj),
        options: localVarRequestOptions,
      };
    },
    /**
     *
     * @summary Deletes a specific pipeline version by pipeline version ID and pipeline ID.
     * @param {string} pipeline_id Required input. ID of the parent pipeline.
     * @param {string} pipeline_version_id Required input. The ID of the pipeline version to be deleted.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    deletePipelineVersion(
      pipeline_id: string,
      pipeline_version_id: string,
      options: any = {},
    ): FetchArgs {
      // verify required parameter 'pipeline_id' is not null or undefined
      if (pipeline_id === null || pipeline_id === undefined) {
        throw new RequiredError(
          'pipeline_id',
          'Required parameter pipeline_id was null or undefined when calling deletePipelineVersion.',
        );
      }
      // verify required parameter 'pipeline_version_id' is not null or undefined
      if (pipeline_version_id === null || pipeline_version_id === undefined) {
        throw new RequiredError(
          'pipeline_version_id',
          'Required parameter pipeline_version_id was null or undefined when calling deletePipelineVersion.',
        );
      }
      const localVarPath = `/apis/v2beta1/pipelines/{pipeline_id}/versions/{pipeline_version_id}`
        .replace(`{${'pipeline_id'}}`, encodeURIComponent(String(pipeline_id)))
        .replace(`{${'pipeline_version_id'}}`, encodeURIComponent(String(pipeline_version_id)));
      const localVarUrlObj = url.parse(localVarPath, true);
      const localVarRequestOptions = Object.assign({ method: 'DELETE' }, options);
      const localVarHeaderParameter = {} as any;
      const localVarQueryParameter = {} as any;

      // authentication Bearer required
      if (configuration && configuration.apiKey) {
        const localVarApiKeyValue =
          typeof configuration.apiKey === 'function'
            ? configuration.apiKey('authorization')
            : configuration.apiKey;
        localVarHeaderParameter['authorization'] = localVarApiKeyValue;
      }

      localVarUrlObj.query = Object.assign(
        {},
        localVarUrlObj.query,
        localVarQueryParameter,
        options.query,
      );
      // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
      delete localVarUrlObj.search;
      localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);

      return {
        url: url.format(localVarUrlObj),
        options: localVarRequestOptions,
      };
    },
    /**
     *
     * @summary Finds a specific pipeline by ID.
     * @param {string} pipeline_id Required input. The ID of the pipeline to be retrieved.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    getPipeline(pipeline_id: string, options: any = {}): FetchArgs {
      // verify required parameter 'pipeline_id' is not null or undefined
      if (pipeline_id === null || pipeline_id === undefined) {
        throw new RequiredError(
          'pipeline_id',
          'Required parameter pipeline_id was null or undefined when calling getPipeline.',
        );
      }
      const localVarPath = `/apis/v2beta1/pipelines/{pipeline_id}`.replace(
        `{${'pipeline_id'}}`,
        encodeURIComponent(String(pipeline_id)),
      );
      const localVarUrlObj = url.parse(localVarPath, true);
      const localVarRequestOptions = Object.assign({ method: 'GET' }, options);
      const localVarHeaderParameter = {} as any;
      const localVarQueryParameter = {} as any;

      // authentication Bearer required
      if (configuration && configuration.apiKey) {
        const localVarApiKeyValue =
          typeof configuration.apiKey === 'function'
            ? configuration.apiKey('authorization')
            : configuration.apiKey;
        localVarHeaderParameter['authorization'] = localVarApiKeyValue;
      }

      localVarUrlObj.query = Object.assign(
        {},
        localVarUrlObj.query,
        localVarQueryParameter,
        options.query,
      );
      // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
      delete localVarUrlObj.search;
      localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);

      return {
        url: url.format(localVarUrlObj),
        options: localVarRequestOptions,
      };
    },
    /**
     *
     * @summary Finds a specific pipeline by name and namespace.
     * @param {string} name Required input. Name of the pipeline to be retrieved.
     * @param {string} [namespace] Optional input. Namespace of the pipeline.  It could be empty if default namespaces needs to be used or if multi-user  support is turned off.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    getPipelineByName(name: string, namespace?: string, options: any = {}): FetchArgs {
      // verify required parameter 'name' is not null or undefined
      if (name === null || name === undefined) {
        throw new RequiredError(
          'name',
          'Required parameter name was null or undefined when calling getPipelineByName.',
        );
      }
      const localVarPath = `/apis/v2beta1/pipelines/names/{name}`.replace(
        `{${'name'}}`,
        encodeURIComponent(String(name)),
      );
      const localVarUrlObj = url.parse(localVarPath, true);
      const localVarRequestOptions = Object.assign({ method: 'GET' }, options);
      const localVarHeaderParameter = {} as any;
      const localVarQueryParameter = {} as any;

      // authentication Bearer required
      if (configuration && configuration.apiKey) {
        const localVarApiKeyValue =
          typeof configuration.apiKey === 'function'
            ? configuration.apiKey('authorization')
            : configuration.apiKey;
        localVarHeaderParameter['authorization'] = localVarApiKeyValue;
      }

      if (namespace !== undefined) {
        localVarQueryParameter['namespace'] = namespace;
      }

      localVarUrlObj.query = Object.assign(
        {},
        localVarUrlObj.query,
        localVarQueryParameter,
        options.query,
      );
      // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
      delete localVarUrlObj.search;
      localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);

      return {
        url: url.format(localVarUrlObj),
        options: localVarRequestOptions,
      };
    },
    /**
     *
     * @summary Gets a pipeline version by pipeline version ID and pipeline ID.
     * @param {string} pipeline_id Required input. ID of the parent pipeline.
     * @param {string} pipeline_version_id Required input. ID of the pipeline version to be retrieved.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    getPipelineVersion(
      pipeline_id: string,
      pipeline_version_id: string,
      options: any = {},
    ): FetchArgs {
      // verify required parameter 'pipeline_id' is not null or undefined
      if (pipeline_id === null || pipeline_id === undefined) {
        throw new RequiredError(
          'pipeline_id',
          'Required parameter pipeline_id was null or undefined when calling getPipelineVersion.',
        );
      }
      // verify required parameter 'pipeline_version_id' is not null or undefined
      if (pipeline_version_id === null || pipeline_version_id === undefined) {
        throw new RequiredError(
          'pipeline_version_id',
          'Required parameter pipeline_version_id was null or undefined when calling getPipelineVersion.',
        );
      }
      const localVarPath = `/apis/v2beta1/pipelines/{pipeline_id}/versions/{pipeline_version_id}`
        .replace(`{${'pipeline_id'}}`, encodeURIComponent(String(pipeline_id)))
        .replace(`{${'pipeline_version_id'}}`, encodeURIComponent(String(pipeline_version_id)));
      const localVarUrlObj = url.parse(localVarPath, true);
      const localVarRequestOptions = Object.assign({ method: 'GET' }, options);
      const localVarHeaderParameter = {} as any;
      const localVarQueryParameter = {} as any;

      // authentication Bearer required
      if (configuration && configuration.apiKey) {
        const localVarApiKeyValue =
          typeof configuration.apiKey === 'function'
            ? configuration.apiKey('authorization')
            : configuration.apiKey;
        localVarHeaderParameter['authorization'] = localVarApiKeyValue;
      }

      localVarUrlObj.query = Object.assign(
        {},
        localVarUrlObj.query,
        localVarQueryParameter,
        options.query,
      );
      // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
      delete localVarUrlObj.search;
      localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);

      return {
        url: url.format(localVarUrlObj),
        options: localVarRequestOptions,
      };
    },
    /**
     *
     * @summary Lists all pipeline versions of a given pipeline ID.
     * @param {string} pipeline_id Required input. ID of the parent pipeline.
     * @param {string} [page_token] A page token to request the results page.
     * @param {number} [page_size] The number of pipeline versions to be listed per page. If there are more pipeline versions than this number, the response message will contain a valid value in the nextPageToken field.
     * @param {string} [sort_by] Sorting order in form of \&quot;field_name\&quot;, \&quot;field_name asc\&quot; or \&quot;field_name desc\&quot;. Ascending by default.
     * @param {string} [filter] A url-encoded, JSON-serialized filter protocol buffer (see [filter.proto](https://github.com/kubeflow/pipelines/blob/master/backend/api/filter.proto)).
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    listPipelineVersions(
      pipeline_id: string,
      page_token?: string,
      page_size?: number,
      sort_by?: string,
      filter?: string,
      options: any = {},
    ): FetchArgs {
      // verify required parameter 'pipeline_id' is not null or undefined
      if (pipeline_id === null || pipeline_id === undefined) {
        throw new RequiredError(
          'pipeline_id',
          'Required parameter pipeline_id was null or undefined when calling listPipelineVersions.',
        );
      }
      const localVarPath = `/apis/v2beta1/pipelines/{pipeline_id}/versions`.replace(
        `{${'pipeline_id'}}`,
        encodeURIComponent(String(pipeline_id)),
      );
      const localVarUrlObj = url.parse(localVarPath, true);
      const localVarRequestOptions = Object.assign({ method: 'GET' }, options);
      const localVarHeaderParameter = {} as any;
      const localVarQueryParameter = {} as any;

      // authentication Bearer required
      if (configuration && configuration.apiKey) {
        const localVarApiKeyValue =
          typeof configuration.apiKey === 'function'
            ? configuration.apiKey('authorization')
            : configuration.apiKey;
        localVarHeaderParameter['authorization'] = localVarApiKeyValue;
      }

      if (page_token !== undefined) {
        localVarQueryParameter['page_token'] = page_token;
      }

      if (page_size !== undefined) {
        localVarQueryParameter['page_size'] = page_size;
      }

      if (sort_by !== undefined) {
        localVarQueryParameter['sort_by'] = sort_by;
      }

      if (filter !== undefined) {
        localVarQueryParameter['filter'] = filter;
      }

      localVarUrlObj.query = Object.assign(
        {},
        localVarUrlObj.query,
        localVarQueryParameter,
        options.query,
      );
      // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
      delete localVarUrlObj.search;
      localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);

      return {
        url: url.format(localVarUrlObj),
        options: localVarRequestOptions,
      };
    },
    /**
     *
     * @summary Finds all pipelines within a namespace.
     * @param {string} [namespace] Optional input. Namespace for the pipelines.
     * @param {string} [page_token] A page token to request the results page.
     * @param {number} [page_size] The number of pipelines to be listed per page. If there are more pipelines than this number, the response message will contain a valid value in the nextPageToken field.
     * @param {string} [sort_by] Sorting order in form of \&quot;field_name\&quot;, \&quot;field_name asc\&quot; or \&quot;field_name desc\&quot;. Ascending by default.
     * @param {string} [filter] A url-encoded, JSON-serialized filter protocol buffer (see [filter.proto](https://github.com/kubeflow/pipelines/blob/master/backend/api/filter.proto)).
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    listPipelines(
      namespace?: string,
      page_token?: string,
      page_size?: number,
      sort_by?: string,
      filter?: string,
      options: any = {},
    ): FetchArgs {
      const localVarPath = `/apis/v2beta1/pipelines`;
      const localVarUrlObj = url.parse(localVarPath, true);
      const localVarRequestOptions = Object.assign({ method: 'GET' }, options);
      const localVarHeaderParameter = {} as any;
      const localVarQueryParameter = {} as any;

      // authentication Bearer required
      if (configuration && configuration.apiKey) {
        const localVarApiKeyValue =
          typeof configuration.apiKey === 'function'
            ? configuration.apiKey('authorization')
            : configuration.apiKey;
        localVarHeaderParameter['authorization'] = localVarApiKeyValue;
      }

      if (namespace !== undefined) {
        localVarQueryParameter['namespace'] = namespace;
      }

      if (page_token !== undefined) {
        localVarQueryParameter['page_token'] = page_token;
      }

      if (page_size !== undefined) {
        localVarQueryParameter['page_size'] = page_size;
      }

      if (sort_by !== undefined) {
        localVarQueryParameter['sort_by'] = sort_by;
      }

      if (filter !== undefined) {
        localVarQueryParameter['filter'] = filter;
      }

      localVarUrlObj.query = Object.assign(
        {},
        localVarUrlObj.query,
        localVarQueryParameter,
        options.query,
      );
      // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
      delete localVarUrlObj.search;
      localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);

      return {
        url: url.format(localVarUrlObj),
        options: localVarRequestOptions,
      };
    },
  };
};

/**
 * PipelineServiceApi - functional programming interface
 * @export
 */
export const PipelineServiceApiFp = function(configuration?: Configuration) {
  return {
    /**
     *
     * @summary Creates a pipeline.
     * @param {V2beta1Pipeline} body Required input. Pipeline that needs to be created.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    createPipeline(
      body: V2beta1Pipeline,
      options?: any,
    ): (fetch?: FetchAPI, basePath?: string) => Promise<V2beta1Pipeline> {
      const localVarFetchArgs = PipelineServiceApiFetchParamCreator(configuration).createPipeline(
        body,
        options,
      );
      return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => {
        return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(response => {
          if (response.status >= 200 && response.status < 300) {
            return response.json();
          } else {
            throw response;
          }
        });
      };
    },
    /**
     *
     * @summary Adds a pipeline version to the specified pipeline ID.
     * @param {string} pipeline_id Required input. ID of the parent pipeline.
     * @param {V2beta1PipelineVersion} body Required input. Pipeline version ID to be created.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    createPipelineVersion(
      pipeline_id: string,
      body: V2beta1PipelineVersion,
      options?: any,
    ): (fetch?: FetchAPI, basePath?: string) => Promise<V2beta1PipelineVersion> {
      const localVarFetchArgs = PipelineServiceApiFetchParamCreator(
        configuration,
      ).createPipelineVersion(pipeline_id, body, options);
      return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => {
        return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(response => {
          if (response.status >= 200 && response.status < 300) {
            return response.json();
          } else {
            throw response;
          }
        });
      };
    },
    /**
     *
     * @summary Deletes an empty pipeline by ID. Returns error if the pipeline has pipeline versions.
     * @param {string} pipeline_id Required input. ID of the pipeline to be deleted.
     * @param {boolean} [cascade] Optional input. If true, deletes pipeline versions along with the pipeline.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    deletePipeline(
      pipeline_id: string,
      cascade?: boolean,
      options?: any,
    ): (fetch?: FetchAPI, basePath?: string) => Promise<any> {
      const localVarFetchArgs = PipelineServiceApiFetchParamCreator(configuration).deletePipeline(
        pipeline_id,
        cascade,
        options,
      );
      return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => {
        return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(response => {
          if (response.status >= 200 && response.status < 300) {
            return response.json();
          } else {
            throw response;
          }
        });
      };
    },
    /**
     *
     * @summary Deletes a specific pipeline version by pipeline version ID and pipeline ID.
     * @param {string} pipeline_id Required input. ID of the parent pipeline.
     * @param {string} pipeline_version_id Required input. The ID of the pipeline version to be deleted.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    deletePipelineVersion(
      pipeline_id: string,
      pipeline_version_id: string,
      options?: any,
    ): (fetch?: FetchAPI, basePath?: string) => Promise<any> {
      const localVarFetchArgs = PipelineServiceApiFetchParamCreator(
        configuration,
      ).deletePipelineVersion(pipeline_id, pipeline_version_id, options);
      return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => {
        return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(response => {
          if (response.status >= 200 && response.status < 300) {
            return response.json();
          } else {
            throw response;
          }
        });
      };
    },
    /**
     *
     * @summary Finds a specific pipeline by ID.
     * @param {string} pipeline_id Required input. The ID of the pipeline to be retrieved.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    getPipeline(
      pipeline_id: string,
      options?: any,
    ): (fetch?: FetchAPI, basePath?: string) => Promise<V2beta1Pipeline> {
      const localVarFetchArgs = PipelineServiceApiFetchParamCreator(configuration).getPipeline(
        pipeline_id,
        options,
      );
      return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => {
        return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(response => {
          if (response.status >= 200 && response.status < 300) {
            return response.json();
          } else {
            throw response;
          }
        });
      };
    },
    /**
     *
     * @summary Finds a specific pipeline by name and namespace.
     * @param {string} name Required input. Name of the pipeline to be retrieved.
     * @param {string} [namespace] Optional input. Namespace of the pipeline.  It could be empty if default namespaces needs to be used or if multi-user  support is turned off.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    getPipelineByName(
      name: string,
      namespace?: string,
      options?: any,
    ): (fetch?: FetchAPI, basePath?: string) => Promise<V2beta1Pipeline> {
      const localVarFetchArgs = PipelineServiceApiFetchParamCreator(
        configuration,
      ).getPipelineByName(name, namespace, options);
      return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => {
        return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(response => {
          if (response.status >= 200 && response.status < 300) {
            return response.json();
          } else {
            throw response;
          }
        });
      };
    },
    /**
     *
     * @summary Gets a pipeline version by pipeline version ID and pipeline ID.
     * @param {string} pipeline_id Required input. ID of the parent pipeline.
     * @param {string} pipeline_version_id Required input. ID of the pipeline version to be retrieved.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    getPipelineVersion(
      pipeline_id: string,
      pipeline_version_id: string,
      options?: any,
    ): (fetch?: FetchAPI, basePath?: string) => Promise<V2beta1PipelineVersion> {
      const localVarFetchArgs = PipelineServiceApiFetchParamCreator(
        configuration,
      ).getPipelineVersion(pipeline_id, pipeline_version_id, options);
      return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => {
        return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(response => {
          if (response.status >= 200 && response.status < 300) {
            return response.json();
          } else {
            throw response;
          }
        });
      };
    },
    /**
     *
     * @summary Lists all pipeline versions of a given pipeline ID.
     * @param {string} pipeline_id Required input. ID of the parent pipeline.
     * @param {string} [page_token] A page token to request the results page.
     * @param {number} [page_size] The number of pipeline versions to be listed per page. If there are more pipeline versions than this number, the response message will contain a valid value in the nextPageToken field.
     * @param {string} [sort_by] Sorting order in form of \&quot;field_name\&quot;, \&quot;field_name asc\&quot; or \&quot;field_name desc\&quot;. Ascending by default.
     * @param {string} [filter] A url-encoded, JSON-serialized filter protocol buffer (see [filter.proto](https://github.com/kubeflow/pipelines/blob/master/backend/api/filter.proto)).
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    listPipelineVersions(
      pipeline_id: string,
      page_token?: string,
      page_size?: number,
      sort_by?: string,
      filter?: string,
      options?: any,
    ): (fetch?: FetchAPI, basePath?: string) => Promise<V2beta1ListPipelineVersionsResponse> {
      const localVarFetchArgs = PipelineServiceApiFetchParamCreator(
        configuration,
      ).listPipelineVersions(pipeline_id, page_token, page_size, sort_by, filter, options);
      return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => {
        return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(response => {
          if (response.status >= 200 && response.status < 300) {
            return response.json();
          } else {
            throw response;
          }
        });
      };
    },
    /**
     *
     * @summary Finds all pipelines within a namespace.
     * @param {string} [namespace] Optional input. Namespace for the pipelines.
     * @param {string} [page_token] A page token to request the results page.
     * @param {number} [page_size] The number of pipelines to be listed per page. If there are more pipelines than this number, the response message will contain a valid value in the nextPageToken field.
     * @param {string} [sort_by] Sorting order in form of \&quot;field_name\&quot;, \&quot;field_name asc\&quot; or \&quot;field_name desc\&quot;. Ascending by default.
     * @param {string} [filter] A url-encoded, JSON-serialized filter protocol buffer (see [filter.proto](https://github.com/kubeflow/pipelines/blob/master/backend/api/filter.proto)).
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    listPipelines(
      namespace?: string,
      page_token?: string,
      page_size?: number,
      sort_by?: string,
      filter?: string,
      options?: any,
    ): (fetch?: FetchAPI, basePath?: string) => Promise<V2beta1ListPipelinesResponse> {
      const localVarFetchArgs = PipelineServiceApiFetchParamCreator(configuration).listPipelines(
        namespace,
        page_token,
        page_size,
        sort_by,
        filter,
        options,
      );
      return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => {
        return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(response => {
          if (response.status >= 200 && response.status < 300) {
            return response.json();
          } else {
            throw response;
          }
        });
      };
    },
  };
};

/**
 * PipelineServiceApi - factory interface
 * @export
 */
export const PipelineServiceApiFactory = function(
  configuration?: Configuration,
  fetch?: FetchAPI,
  basePath?: string,
) {
  return {
    /**
     *
     * @summary Creates a pipeline.
     * @param {V2beta1Pipeline} body Required input. Pipeline that needs to be created.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    createPipeline(body: V2beta1Pipeline, options?: any) {
      return PipelineServiceApiFp(configuration).createPipeline(body, options)(fetch, basePath);
    },
    /**
     *
     * @summary Adds a pipeline version to the specified pipeline ID.
     * @param {string} pipeline_id Required input. ID of the parent pipeline.
     * @param {V2beta1PipelineVersion} body Required input. Pipeline version ID to be created.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    createPipelineVersion(pipeline_id: string, body: V2beta1PipelineVersion, options?: any) {
      return PipelineServiceApiFp(configuration).createPipelineVersion(
        pipeline_id,
        body,
        options,
      )(fetch, basePath);
    },
    /**
     *
     * @summary Deletes an empty pipeline by ID. Returns error if the pipeline has pipeline versions.
     * @param {string} pipeline_id Required input. ID of the pipeline to be deleted.
     * @param {boolean} [cascade] Optional input. If true, deletes pipeline versions along with the pipeline.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    deletePipeline(pipeline_id: string, cascade?: boolean, options?: any) {
      return PipelineServiceApiFp(configuration).deletePipeline(
        pipeline_id,
        cascade,
        options,
      )(fetch, basePath);
    },
    /**
     *
     * @summary Deletes a specific pipeline version by pipeline version ID and pipeline ID.
     * @param {string} pipeline_id Required input. ID of the parent pipeline.
     * @param {string} pipeline_version_id Required input. The ID of the pipeline version to be deleted.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    deletePipelineVersion(pipeline_id: string, pipeline_version_id: string, options?: any) {
      return PipelineServiceApiFp(configuration).deletePipelineVersion(
        pipeline_id,
        pipeline_version_id,
        options,
      )(fetch, basePath);
    },
    /**
     *
     * @summary Finds a specific pipeline by ID.
     * @param {string} pipeline_id Required input. The ID of the pipeline to be retrieved.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    getPipeline(pipeline_id: string, options?: any) {
      return PipelineServiceApiFp(configuration).getPipeline(pipeline_id, options)(fetch, basePath);
    },
    /**
     *
     * @summary Finds a specific pipeline by name and namespace.
     * @param {string} name Required input. Name of the pipeline to be retrieved.
     * @param {string} [namespace] Optional input. Namespace of the pipeline.  It could be empty if default namespaces needs to be used or if multi-user  support is turned off.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    getPipelineByName(name: string, namespace?: string, options?: any) {
      return PipelineServiceApiFp(configuration).getPipelineByName(
        name,
        namespace,
        options,
      )(fetch, basePath);
    },
    /**
     *
     * @summary Gets a pipeline version by pipeline version ID and pipeline ID.
     * @param {string} pipeline_id Required input. ID of the parent pipeline.
     * @param {string} pipeline_version_id Required input. ID of the pipeline version to be retrieved.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    getPipelineVersion(pipeline_id: string, pipeline_version_id: string, options?: any) {
      return PipelineServiceApiFp(configuration).getPipelineVersion(
        pipeline_id,
        pipeline_version_id,
        options,
      )(fetch, basePath);
    },
    /**
     *
     * @summary Lists all pipeline versions of a given pipeline ID.
     * @param {string} pipeline_id Required input. ID of the parent pipeline.
     * @param {string} [page_token] A page token to request the results page.
     * @param {number} [page_size] The number of pipeline versions to be listed per page. If there are more pipeline versions than this number, the response message will contain a valid value in the nextPageToken field.
     * @param {string} [sort_by] Sorting order in form of \&quot;field_name\&quot;, \&quot;field_name asc\&quot; or \&quot;field_name desc\&quot;. Ascending by default.
     * @param {string} [filter] A url-encoded, JSON-serialized filter protocol buffer (see [filter.proto](https://github.com/kubeflow/pipelines/blob/master/backend/api/filter.proto)).
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    listPipelineVersions(
      pipeline_id: string,
      page_token?: string,
      page_size?: number,
      sort_by?: string,
      filter?: string,
      options?: any,
    ) {
      return PipelineServiceApiFp(configuration).listPipelineVersions(
        pipeline_id,
        page_token,
        page_size,
        sort_by,
        filter,
        options,
      )(fetch, basePath);
    },
    /**
     *
     * @summary Finds all pipelines within a namespace.
     * @param {string} [namespace] Optional input. Namespace for the pipelines.
     * @param {string} [page_token] A page token to request the results page.
     * @param {number} [page_size] The number of pipelines to be listed per page. If there are more pipelines than this number, the response message will contain a valid value in the nextPageToken field.
     * @param {string} [sort_by] Sorting order in form of \&quot;field_name\&quot;, \&quot;field_name asc\&quot; or \&quot;field_name desc\&quot;. Ascending by default.
     * @param {string} [filter] A url-encoded, JSON-serialized filter protocol buffer (see [filter.proto](https://github.com/kubeflow/pipelines/blob/master/backend/api/filter.proto)).
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    listPipelines(
      namespace?: string,
      page_token?: string,
      page_size?: number,
      sort_by?: string,
      filter?: string,
      options?: any,
    ) {
      return PipelineServiceApiFp(configuration).listPipelines(
        namespace,
        page_token,
        page_size,
        sort_by,
        filter,
        options,
      )(fetch, basePath);
    },
  };
};

/**
 * PipelineServiceApi - object-oriented interface
 * @export
 * @class PipelineServiceApi
 * @extends {BaseAPI}
 */
export class PipelineServiceApi extends BaseAPI {
  /**
   *
   * @summary Creates a pipeline.
   * @param {V2beta1Pipeline} body Required input. Pipeline that needs to be created.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof PipelineServiceApi
   */
  public createPipeline(body: V2beta1Pipeline, options?: any) {
    return PipelineServiceApiFp(this.configuration).createPipeline(body, options)(
      this.fetch,
      this.basePath,
    );
  }

  /**
   *
   * @summary Adds a pipeline version to the specified pipeline ID.
   * @param {string} pipeline_id Required input. ID of the parent pipeline.
   * @param {V2beta1PipelineVersion} body Required input. Pipeline version ID to be created.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof PipelineServiceApi
   */
  public createPipelineVersion(pipeline_id: string, body: V2beta1PipelineVersion, options?: any) {
    return PipelineServiceApiFp(this.configuration).createPipelineVersion(
      pipeline_id,
      body,
      options,
    )(this.fetch, this.basePath);
  }

  /**
   *
   * @summary Deletes an empty pipeline by ID. Returns error if the pipeline has pipeline versions.
   * @param {string} pipeline_id Required input. ID of the pipeline to be deleted.
   * @param {boolean} [cascade] Optional input. If true, deletes pipeline versions along with the pipeline.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof PipelineServiceApi
   */
  public deletePipeline(pipeline_id: string, cascade?: boolean, options?: any) {
    return PipelineServiceApiFp(this.configuration).deletePipeline(
      pipeline_id,
      cascade,
      options,
    )(this.fetch, this.basePath);
  }

  /**
   *
   * @summary Deletes a specific pipeline version by pipeline version ID and pipeline ID.
   * @param {string} pipeline_id Required input. ID of the parent pipeline.
   * @param {string} pipeline_version_id Required input. The ID of the pipeline version to be deleted.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof PipelineServiceApi
   */
  public deletePipelineVersion(pipeline_id: string, pipeline_version_id: string, options?: any) {
    return PipelineServiceApiFp(this.configuration).deletePipelineVersion(
      pipeline_id,
      pipeline_version_id,
      options,
    )(this.fetch, this.basePath);
  }

  /**
   *
   * @summary Finds a specific pipeline by ID.
   * @param {string} pipeline_id Required input. The ID of the pipeline to be retrieved.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof PipelineServiceApi
   */
  public getPipeline(pipeline_id: string, options?: any) {
    return PipelineServiceApiFp(this.configuration).getPipeline(pipeline_id, options)(
      this.fetch,
      this.basePath,
    );
  }

  /**
   *
   * @summary Finds a specific pipeline by name and namespace.
   * @param {string} name Required input. Name of the pipeline to be retrieved.
   * @param {string} [namespace] Optional input. Namespace of the pipeline.  It could be empty if default namespaces needs to be used or if multi-user  support is turned off.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof PipelineServiceApi
   */
  public getPipelineByName(name: string, namespace?: string, options?: any) {
    return PipelineServiceApiFp(this.configuration).getPipelineByName(
      name,
      namespace,
      options,
    )(this.fetch, this.basePath);
  }

  /**
   *
   * @summary Gets a pipeline version by pipeline version ID and pipeline ID.
   * @param {string} pipeline_id Required input. ID of the parent pipeline.
   * @param {string} pipeline_version_id Required input. ID of the pipeline version to be retrieved.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof PipelineServiceApi
   */
  public getPipelineVersion(pipeline_id: string, pipeline_version_id: string, options?: any) {
    return PipelineServiceApiFp(this.configuration).getPipelineVersion(
      pipeline_id,
      pipeline_version_id,
      options,
    )(this.fetch, this.basePath);
  }

  /**
   *
   * @summary Lists all pipeline versions of a given pipeline ID.
   * @param {string} pipeline_id Required input. ID of the parent pipeline.
   * @param {string} [page_token] A page token to request the results page.
   * @param {number} [page_size] The number of pipeline versions to be listed per page. If there are more pipeline versions than this number, the response message will contain a valid value in the nextPageToken field.
   * @param {string} [sort_by] Sorting order in form of \&quot;field_name\&quot;, \&quot;field_name asc\&quot; or \&quot;field_name desc\&quot;. Ascending by default.
   * @param {string} [filter] A url-encoded, JSON-serialized filter protocol buffer (see [filter.proto](https://github.com/kubeflow/pipelines/blob/master/backend/api/filter.proto)).
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof PipelineServiceApi
   */
  public listPipelineVersions(
    pipeline_id: string,
    page_token?: string,
    page_size?: number,
    sort_by?: string,
    filter?: string,
    options?: any,
  ) {
    return PipelineServiceApiFp(this.configuration).listPipelineVersions(
      pipeline_id,
      page_token,
      page_size,
      sort_by,
      filter,
      options,
    )(this.fetch, this.basePath);
  }

  /**
   *
   * @summary Finds all pipelines within a namespace.
   * @param {string} [namespace] Optional input. Namespace for the pipelines.
   * @param {string} [page_token] A page token to request the results page.
   * @param {number} [page_size] The number of pipelines to be listed per page. If there are more pipelines than this number, the response message will contain a valid value in the nextPageToken field.
   * @param {string} [sort_by] Sorting order in form of \&quot;field_name\&quot;, \&quot;field_name asc\&quot; or \&quot;field_name desc\&quot;. Ascending by default.
   * @param {string} [filter] A url-encoded, JSON-serialized filter protocol buffer (see [filter.proto](https://github.com/kubeflow/pipelines/blob/master/backend/api/filter.proto)).
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof PipelineServiceApi
   */
  public listPipelines(
    namespace?: string,
    page_token?: string,
    page_size?: number,
    sort_by?: string,
    filter?: string,
    options?: any,
  ) {
    return PipelineServiceApiFp(this.configuration).listPipelines(
      namespace,
      page_token,
      page_size,
      sort_by,
      filter,
      options,
    )(this.fetch, this.basePath);
  }
}
