All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.leanix.mtm.api.ContractsApi Maven / Gradle / Ivy

There is a newer version: 1.7.25
Show newest version
package net.leanix.mtm.api;

import net.leanix.dropkit.apiclient.ApiException;
import net.leanix.dropkit.apiclient.ApiClient;
import net.leanix.dropkit.apiclient.Configuration;
import net.leanix.dropkit.apiclient.Pair;

import javax.ws.rs.core.GenericType;

import net.leanix.mtm.api.models.Contract;
import net.leanix.mtm.api.models.ContractListResponse;
import net.leanix.mtm.api.models.ContractResponse;
import net.leanix.mtm.api.models.CustomFeatureListResponse;
import net.leanix.mtm.api.models.EventListResponse;
import net.leanix.mtm.api.models.SettingListResponse;
import net.leanix.mtm.api.models.WorkspaceListResponse;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


public class ContractsApi {
  private ApiClient apiClient;

  public ContractsApi() {
    this(Configuration.getDefaultApiClient());
  }

  public ContractsApi(ApiClient apiClient) {
    this.apiClient = apiClient;
  }

  public ApiClient getApiClient() {
    return apiClient;
  }

  public void setApiClient(ApiClient apiClient) {
    this.apiClient = apiClient;
  }

  /**
   * createContract
   * Add a contract
   * @param body contract data (optional)
   * @return ContractResponse
   * @throws ApiException if fails to make API call
   */
  public ContractResponse createContract(Contract body) throws ApiException {
    Object localVarPostBody = body;
    
    // create path and map variables
    String localVarPath = "/contracts";

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();


    
    
    final String[] localVarAccepts = {
      "application/json"
    };
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {
      "application/json"
    };
    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] { "token" };

    GenericType localVarReturnType = new GenericType() {};
    return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
      }
  /**
   * deleteContract
   * Delete a contract.
   * @param id Contract UUID (required)
   * @return ContractResponse
   * @throws ApiException if fails to make API call
   */
  public ContractResponse deleteContract(String id) throws ApiException {
    Object localVarPostBody = null;
    
    // verify the required parameter 'id' is set
    if (id == null) {
      throw new ApiException(400, "Missing the required parameter 'id' when calling deleteContract");
    }
    
    // create path and map variables
    String localVarPath = "/contracts/{id}"
      .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();


    
    
    final String[] localVarAccepts = {
      "application/json"
    };
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {
      "application/json"
    };
    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] { "token" };

    GenericType localVarReturnType = new GenericType() {};
    return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
      }
  /**
   * getContract
   * Get a contract
   * @param id Contract UUID (required)
   * @return ContractResponse
   * @throws ApiException if fails to make API call
   */
  public ContractResponse getContract(String id) throws ApiException {
    Object localVarPostBody = null;
    
    // verify the required parameter 'id' is set
    if (id == null) {
      throw new ApiException(400, "Missing the required parameter 'id' when calling getContract");
    }
    
    // create path and map variables
    String localVarPath = "/contracts/{id}"
      .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();


    
    
    final String[] localVarAccepts = {
      "application/json"
    };
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {
      "application/json"
    };
    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] { "token" };

    GenericType localVarReturnType = new GenericType() {};
    return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
      }
  /**
   * getContracts
   * Retrieves all contracts
   * @param q Search for account, type or status (optional)
   * @param page The page number to access (1 indexed, defaults to 1) (optional, default to 1)
   * @param size The page size requested (defaults to 30, max 100) (optional, default to 30)
   * @param sort Comma-separated list of sorting (optional) (optional)
   * @return ContractListResponse
   * @throws ApiException if fails to make API call
   */
  public ContractListResponse getContracts(String q, Integer page, Integer size, String sort) throws ApiException {
    Object localVarPostBody = null;
    
    // create path and map variables
    String localVarPath = "/contracts";

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();

    localVarQueryParams.addAll(apiClient.parameterToPairs("", "q", q));
    localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page));
    localVarQueryParams.addAll(apiClient.parameterToPairs("", "size", size));
    localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort", sort));

    
    
    final String[] localVarAccepts = {
      "application/json"
    };
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {
      "application/json"
    };
    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] { "token" };

    GenericType localVarReturnType = new GenericType() {};
    return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
      }
  /**
   * getCustomFeatures
   * Endpoint to list the contract specific custom features.
   * @param id Contract UUID (required)
   * @return CustomFeatureListResponse
   * @throws ApiException if fails to make API call
   */
  public CustomFeatureListResponse getCustomFeatures(String id) throws ApiException {
    Object localVarPostBody = null;
    
    // verify the required parameter 'id' is set
    if (id == null) {
      throw new ApiException(400, "Missing the required parameter 'id' when calling getCustomFeatures");
    }
    
    // create path and map variables
    String localVarPath = "/contracts/{id}/customFeatures"
      .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();


    
    
    final String[] localVarAccepts = {
      "application/json"
    };
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {
      "application/json"
    };
    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] { "token" };

    GenericType localVarReturnType = new GenericType() {};
    return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
      }
  /**
   * getEvents
   * Retrieves all events for the contract
   * @param id Contract UUID (required)
   * @param since time limit, list only newer events (date must be ISO 8601 formatted) (optional)
   * @param page The page number to access (1 indexed, defaults to 1) (optional, default to 1)
   * @param size The page size requested (defaults to 100, max 100) (optional, default to 100)
   * @param sort Comma-separated list of sorting (optional) (optional)
   * @return EventListResponse
   * @throws ApiException if fails to make API call
   */
  public EventListResponse getEvents(String id, String since, Integer page, Integer size, String sort) throws ApiException {
    Object localVarPostBody = null;
    
    // verify the required parameter 'id' is set
    if (id == null) {
      throw new ApiException(400, "Missing the required parameter 'id' when calling getEvents");
    }
    
    // create path and map variables
    String localVarPath = "/contracts/{id}/events"
      .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();

    localVarQueryParams.addAll(apiClient.parameterToPairs("", "since", since));
    localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page));
    localVarQueryParams.addAll(apiClient.parameterToPairs("", "size", size));
    localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort", sort));

    
    
    final String[] localVarAccepts = {
      "application/json"
    };
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {
      "application/json"
    };
    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] { "token" };

    GenericType localVarReturnType = new GenericType() {};
    return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
      }
  /**
   * getSettings
   * Endpoint to list the contract specific settings.
   * @param id Contract UUID (required)
   * @param type Setting type (optional)
   * @return SettingListResponse
   * @throws ApiException if fails to make API call
   */
  public SettingListResponse getSettings(String id, String type) throws ApiException {
    Object localVarPostBody = null;
    
    // verify the required parameter 'id' is set
    if (id == null) {
      throw new ApiException(400, "Missing the required parameter 'id' when calling getSettings");
    }
    
    // create path and map variables
    String localVarPath = "/contracts/{id}/settings"
      .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();

    localVarQueryParams.addAll(apiClient.parameterToPairs("", "type", type));

    
    
    final String[] localVarAccepts = {
      "application/json"
    };
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {
      "application/json"
    };
    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] { "token" };

    GenericType localVarReturnType = new GenericType() {};
    return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
      }
  /**
   * getWorkspaces
   * Get the workspaces of a contract
   * @param id Contract UUID (required)
   * @return WorkspaceListResponse
   * @throws ApiException if fails to make API call
   */
  public WorkspaceListResponse getWorkspaces(String id) throws ApiException {
    Object localVarPostBody = null;
    
    // verify the required parameter 'id' is set
    if (id == null) {
      throw new ApiException(400, "Missing the required parameter 'id' when calling getWorkspaces");
    }
    
    // create path and map variables
    String localVarPath = "/contracts/{id}/workspaces"
      .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();


    
    
    final String[] localVarAccepts = {
      "application/json"
    };
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {
      "application/json"
    };
    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] { "token" };

    GenericType localVarReturnType = new GenericType() {};
    return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
      }
  /**
   * updateContract
   * Update a contract
   * @param id Contract UUID (required)
   * @param body  (required)
   * @return ContractResponse
   * @throws ApiException if fails to make API call
   */
  public ContractResponse updateContract(String id, Contract body) throws ApiException {
    Object localVarPostBody = body;
    
    // verify the required parameter 'id' is set
    if (id == null) {
      throw new ApiException(400, "Missing the required parameter 'id' when calling updateContract");
    }
    
    // verify the required parameter 'body' is set
    if (body == null) {
      throw new ApiException(400, "Missing the required parameter 'body' when calling updateContract");
    }
    
    // create path and map variables
    String localVarPath = "/contracts/{id}"
      .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();


    
    
    final String[] localVarAccepts = {
      "application/json"
    };
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {
      "application/json"
    };
    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] { "token" };

    GenericType localVarReturnType = new GenericType() {};
    return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
      }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy