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

de.gematik.ti.epa.vzd.gemClient.api.GemCertificateAdministrationApi Maven / Gradle / Ivy

There is a newer version: 1.0.1
Show newest version
/*
 * Copyright (c) 2020 gematik GmbH
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *    http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package de.gematik.ti.epa.vzd.gemClient.api;

import de.gematik.ti.epa.vzd.client.api.CertificateAdministrationApi;
import de.gematik.ti.epa.vzd.client.invoker.ApiCallback;
import de.gematik.ti.epa.vzd.client.invoker.ApiException;
import de.gematik.ti.epa.vzd.client.invoker.Pair;
import de.gematik.ti.epa.vzd.client.invoker.auth.OAuth;
import de.gematik.ti.epa.vzd.client.model.UserCertificate;
import de.gematik.ti.epa.vzd.gemClient.invoker.GemApiClient;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Overrides all functions of CertificateAdministration api that build calls for the different commands to add the OAuth2 Token to the header
 */
public class GemCertificateAdministrationApi extends CertificateAdministrationApi {

  private GemApiClient localVarApiClient;

  public GemCertificateAdministrationApi(GemApiClient apiClient) {
    this.localVarApiClient = apiClient;
  }

  @Override
  public okhttp3.Call readDirectoryCertificatesCall(String uid, String certificateEntryID,
      String entryType, String telematikID, String professionOID, String usage,
      final ApiCallback _callback) throws ApiException {
    Object localVarPostBody = null;

    // create path and map variables
    String localVarPath = "/DirectoryEntries/Certificates";

    List localVarQueryParams = new ArrayList();
    List localVarCollectionQueryParams = new ArrayList();
    if (uid != null) {
      localVarQueryParams.addAll(localVarApiClient.parameterToPair("uid", uid));
    }

    if (certificateEntryID != null) {
      localVarQueryParams.addAll(
          localVarApiClient.parameterToPair("certificateEntryID", certificateEntryID));
    }

    if (entryType != null) {
      localVarQueryParams.addAll(localVarApiClient.parameterToPair("entryType", entryType));
    }

    if (telematikID != null) {
      localVarQueryParams
          .addAll(localVarApiClient.parameterToPair("telematikID", telematikID));
    }

    if (professionOID != null) {
      localVarQueryParams
          .addAll(localVarApiClient.parameterToPair("professionOID", professionOID));
    }

    if (usage != null) {
      localVarQueryParams.addAll(localVarApiClient.parameterToPair("usage", usage));
    }

    Map localVarHeaderParams = new HashMap();
    Map localVarCookieParams = new HashMap();
    Map localVarFormParams = new HashMap();
    final String[] localVarAccepts = {"application/json"};

    final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
    if (localVarAccept != null) {
      localVarHeaderParams.put("Accept", localVarAccept);
    }
    //Setze Auth token
    final OAuth oAuth2Token = (OAuth) localVarApiClient.getAuthentication("OAuth");
    localVarHeaderParams.put("Authorization", "Bearer " + oAuth2Token.getAccessToken());

    final String[] localVarContentTypes = {

    };
    final String localVarContentType = localVarApiClient
        .selectHeaderContentType(localVarContentTypes);
    localVarHeaderParams.put("Content-Type", localVarContentType);

    String[] localVarAuthNames = new String[]{"OAuth2"};
    return localVarApiClient
        .buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams,
            localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams,
            localVarAuthNames, _callback);
  }

  @Override
  public okhttp3.Call addDirectoryEntryCertificateCall(String uid,
      UserCertificate userCertificate, final ApiCallback _callback) throws ApiException {
    Object localVarPostBody = userCertificate;

    // create path and map variables
    String localVarPath = "/DirectoryEntries/{uid}/Certificates"
        .replaceAll("\\{" + "uid" + "\\}", localVarApiClient.escapeString(uid.toString()));

    List localVarQueryParams = new ArrayList();
    List localVarCollectionQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarCookieParams = new HashMap();
    Map localVarFormParams = new HashMap();
    final String[] localVarAccepts = {
        "application/json"
    };
    final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
    if (localVarAccept != null) {
      localVarHeaderParams.put("Accept", localVarAccept);
    }

    //Setze Auth token
    final OAuth oAuth2Token = (OAuth) localVarApiClient.getAuthentication("OAuth");
    localVarHeaderParams.put("Authorization", "Bearer " + oAuth2Token.getAccessToken());

    final String[] localVarContentTypes = {
        "application/json"
    };
    final String localVarContentType = localVarApiClient
        .selectHeaderContentType(localVarContentTypes);
    localVarHeaderParams.put("Content-Type", localVarContentType);

    String[] localVarAuthNames = new String[]{"OAuth2"};
    return localVarApiClient
        .buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams,
            localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams,
            localVarAuthNames, _callback);
  }

  @Override
  public okhttp3.Call deleteDirectoryEntryCertificateCall(String uid, String certificateEntryID,
      final ApiCallback _callback) throws ApiException {
    Object localVarPostBody = null;

    // create path and map variables
    String localVarPath = "/DirectoryEntries/{uid}/Certificates/{certificateEntryID}"
        .replaceAll("\\{" + "uid" + "\\}", localVarApiClient.escapeString(uid.toString()))
        .replaceAll("\\{" + "certificateEntryID" + "\\}",
            localVarApiClient.escapeString(certificateEntryID.toString()));

    List localVarQueryParams = new ArrayList();
    List localVarCollectionQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarCookieParams = new HashMap();
    Map localVarFormParams = new HashMap();
    final String[] localVarAccepts = {
        "application/json"
    };
    final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
    if (localVarAccept != null) {
      localVarHeaderParams.put("Accept", localVarAccept);
    }

    final String[] localVarContentTypes = {

    };
    final String localVarContentType = localVarApiClient
        .selectHeaderContentType(localVarContentTypes);
    localVarHeaderParams.put("Content-Type", localVarContentType);

    //Set OAuth2 token
    final OAuth oAuth2Token = (OAuth) localVarApiClient.getAuthentication("OAuth");
    localVarHeaderParams.put("Authorization", "Bearer " + oAuth2Token.getAccessToken());

    String[] localVarAuthNames = new String[]{"OAuth2"};
    return localVarApiClient
        .buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams,
            localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams,
            localVarAuthNames, _callback);
  }

  @Override
  public okhttp3.Call modifyDirectoryEntryCertificateCall(String uid, String certificateEntryID,
      UserCertificate userCertificate, final ApiCallback _callback) throws ApiException {
    Object localVarPostBody = userCertificate;

    // create path and map variables
    String localVarPath = "/DirectoryEntries/{uid}/Certificates/{certificateEntryID}"
        .replaceAll("\\{" + "uid" + "\\}", localVarApiClient.escapeString(uid.toString()))
        .replaceAll("\\{" + "certificateEntryID" + "\\}",
            localVarApiClient.escapeString(certificateEntryID.toString()));

    List localVarQueryParams = new ArrayList();
    List localVarCollectionQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarCookieParams = new HashMap();
    Map localVarFormParams = new HashMap();
    final String[] localVarAccepts = {
        "application/json"
    };
    final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
    if (localVarAccept != null) {
      localVarHeaderParams.put("Accept", localVarAccept);
    }

    final String[] localVarContentTypes = {
        "application/json"
    };
    final String localVarContentType = localVarApiClient
        .selectHeaderContentType(localVarContentTypes);
    localVarHeaderParams.put("Content-Type", localVarContentType);

    //Set OAuth2 token
    final OAuth oAuth2Token = (OAuth) localVarApiClient.getAuthentication("OAuth");
    localVarHeaderParams.put("Authorization", "Bearer " + oAuth2Token.getAccessToken());

    String[] localVarAuthNames = new String[]{"OAuth2"};
    return localVarApiClient
        .buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams,
            localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams,
            localVarAuthNames, _callback);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy