public class OpenApiService extends Object implements OpenApiServiceSubject
| 限定符和类型 | 字段和说明 |
|---|---|
protected static OpenApi |
api |
protected static String |
BASE_URL |
protected static Duration |
DEFAULT_TIMEOUT |
protected static OpenApiServiceSubject |
INSTANCE |
protected static com.fasterxml.jackson.databind.ObjectMapper |
mapper |
| 构造器和说明 |
|---|
OpenApiService() |
| 限定符和类型 | 方法和说明 |
|---|---|
static okhttp3.OkHttpClient |
defaultClient(Duration timeout) |
static okhttp3.OkHttpClient |
defaultClient(Duration timeout,
okhttp3.Interceptor interceptor) |
static com.fasterxml.jackson.databind.ObjectMapper |
defaultObjectMapper()
Shuts down the OkHttp ExecutorService.
|
static retrofit2.Retrofit |
defaultRetrofit(okhttp3.OkHttpClient client,
com.fasterxml.jackson.databind.ObjectMapper mapper) |
static retrofit2.Retrofit |
defaultRetrofit(okhttp3.OkHttpClient client,
com.fasterxml.jackson.databind.ObjectMapper mapper,
String url) |
static <T> T |
execute(io.reactivex.Single<T> apiCall)
Calls the Open AI api, returns the response, and parses error messages if the request fails
|
Object |
get(String suffix) |
Object |
get(String suffix,
String path) |
static OpenApiServiceSubject |
getInstance(String gateway,
Class<? extends OpenApi> cls,
Class<? extends OpenApiServiceSubject> subject)
双检查锁单例
|
Object |
getOnQuery(String suffix,
String query) |
Object |
post(String suffix,
Object obj) |
Object |
post(String suffix,
Object obj,
boolean isFile,
String folder,
okhttp3.MultipartBody.Part... file) |
protected static final Duration DEFAULT_TIMEOUT
protected static final com.fasterxml.jackson.databind.ObjectMapper mapper
protected static OpenApi api
protected static volatile OpenApiServiceSubject INSTANCE
public static OpenApiServiceSubject getInstance(String gateway, Class<? extends OpenApi> cls, Class<? extends OpenApiServiceSubject> subject)
gateway - public Object post(String suffix, Object obj, boolean isFile, String folder, okhttp3.MultipartBody.Part... file)
public static <T> T execute(io.reactivex.Single<T> apiCall)
public static com.fasterxml.jackson.databind.ObjectMapper defaultObjectMapper()
public static okhttp3.OkHttpClient defaultClient(Duration timeout)
public static okhttp3.OkHttpClient defaultClient(Duration timeout, okhttp3.Interceptor interceptor)
public static retrofit2.Retrofit defaultRetrofit(okhttp3.OkHttpClient client,
com.fasterxml.jackson.databind.ObjectMapper mapper)
public static retrofit2.Retrofit defaultRetrofit(okhttp3.OkHttpClient client,
com.fasterxml.jackson.databind.ObjectMapper mapper,
String url)
Copyright © 2023. All rights reserved.