Add new ImageTest (FINERACT-1218)

This commit is contained in:
Michael Vorburger
2020-10-27 05:13:16 +02:00
committed by Petri Tuomola
parent 8a26685d79
commit 91e77f5fe0
6 changed files with 213 additions and 2 deletions
@@ -0,0 +1,56 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 org.apache.fineract.client.services;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.DELETE;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.PUT;
/**
* Client API (Retrofit) for /images.
*
* This class entirely hand-written, inspired by DocumentsApiFixed, and from /images methods which currently end up in
* DefaultApi (see <a href="https://issues.apache.org/jira/browse/FINERACT-1222">FINERACT-1222</a>), but fixed for bugs
* in the code generation (see <a href="https://issues.apache.org/jira/browse/FINERACT-1227">FINERACT-1227</a>).
*
* @author Michael Vorburger.ch
*/
public interface ImagesApi {
@POST("{entityType}/{entityId}/images")
@retrofit2.http.Multipart
Call<Void> create(@retrofit2.http.Path("entityType") String entityType, @retrofit2.http.Path("entityId") Long entityId,
@retrofit2.http.Part okhttp3.MultipartBody.Part file);
@GET("{entityType}/{entityId}/images")
Call<ResponseBody> get(@retrofit2.http.Path("entityType") String entityType, @retrofit2.http.Path("entityId") Long entityId,
@retrofit2.http.Query("maxWidth") Integer maxWidth, @retrofit2.http.Query("maxHeight") Integer maxHeight,
@retrofit2.http.Query("output") String output);
@PUT("{entityType}/{entityId}/images")
@retrofit2.http.Multipart
Call<Void> update(@retrofit2.http.Path("entityType") String entityType, @retrofit2.http.Path("entityId") Long entityId,
@retrofit2.http.Part okhttp3.MultipartBody.Part file);
@DELETE("{entityType}/{entityId}/images")
Call<Void> delete(@retrofit2.http.Path("entityType") String entityType, @retrofit2.http.Path("entityId") Long entityId);
}
@@ -69,6 +69,7 @@ import org.apache.fineract.client.services.GlobalConfigurationApi;
import org.apache.fineract.client.services.GroupsApi;
import org.apache.fineract.client.services.HolidaysApi;
import org.apache.fineract.client.services.HooksApi;
import org.apache.fineract.client.services.ImagesApi;
import org.apache.fineract.client.services.InterestRateChartApi;
import org.apache.fineract.client.services.InterestRateSlabAKAInterestBandsApi;
import org.apache.fineract.client.services.JournalEntriesApi;
@@ -194,6 +195,7 @@ public final class FineractClient {
public final GroupsApi groups;
public final HolidaysApi holidays;
public final HooksApi hooks;
public final ImagesApi images;
public final InterestRateChartApi interestRateCharts;
public final InterestRateSlabAKAInterestBandsApi interestRateChartLabs;
public final JournalEntriesApi journalEntries;
@@ -301,6 +303,7 @@ public final class FineractClient {
groups = retrofit.create(GroupsApi.class);
holidays = retrofit.create(HolidaysApi.class);
hooks = retrofit.create(HooksApi.class);
images = retrofit.create(ImagesApi.class);
interestRateCharts = retrofit.create(InterestRateChartApi.class);
interestRateChartLabs = retrofit.create(InterestRateSlabAKAInterestBandsApi.class);
journalEntries = retrofit.create(JournalEntriesApi.class);