Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* LaunchDarkly REST API
* Build custom integrations with the LaunchDarkly REST API
*
* OpenAPI spec version: 2.0.0
* Contact: [email protected]
*
* 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.
*/
package io.swagger.client.api;
import io.swagger.client.ApiCallback;
import io.swagger.client.ApiClient;
import io.swagger.client.ApiException;
import io.swagger.client.ApiResponse;
import io.swagger.client.Configuration;
import io.swagger.client.Pair;
import io.swagger.client.ProgressRequestBody;
import io.swagger.client.ProgressResponseBody;
import com.google.gson.reflect.TypeToken;
import java.io.IOException;
import io.swagger.client.model.FeatureFlag;
import io.swagger.client.model.FeatureFlagBody;
import io.swagger.client.model.FeatureFlagStatus;
import io.swagger.client.model.FeatureFlagStatuses;
import io.swagger.client.model.FeatureFlags;
import io.swagger.client.model.PatchDelta;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class FlagsApi {
private ApiClient apiClient;
public FlagsApi() {
this(Configuration.getDefaultApiClient());
}
public FlagsApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Build call for deleteFeatureFlag
* @param projectKey The project key, used to tie the flags together under one project so they can be managed together. (required)
* @param featureFlagKey The feature flag's key. The key identifies the flag in your code. (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call deleteFeatureFlagCall(String projectKey, String featureFlagKey, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/flags/{projectKey}/{featureFlagKey}"
.replaceAll("\\{" + "projectKey" + "\\}", apiClient.escapeString(projectKey.toString()))
.replaceAll("\\{" + "featureFlagKey" + "\\}", apiClient.escapeString(featureFlagKey.toString()));
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "Token" };
return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call deleteFeatureFlagValidateBeforeCall(String projectKey, String featureFlagKey, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'projectKey' is set
if (projectKey == null) {
throw new ApiException("Missing the required parameter 'projectKey' when calling deleteFeatureFlag(Async)");
}
// verify the required parameter 'featureFlagKey' is set
if (featureFlagKey == null) {
throw new ApiException("Missing the required parameter 'featureFlagKey' when calling deleteFeatureFlag(Async)");
}
com.squareup.okhttp.Call call = deleteFeatureFlagCall(projectKey, featureFlagKey, progressListener, progressRequestListener);
return call;
}
/**
* Delete a feature flag by ID
*
* @param projectKey The project key, used to tie the flags together under one project so they can be managed together. (required)
* @param featureFlagKey The feature flag's key. The key identifies the flag in your code. (required)
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void deleteFeatureFlag(String projectKey, String featureFlagKey) throws ApiException {
deleteFeatureFlagWithHttpInfo(projectKey, featureFlagKey);
}
/**
* Delete a feature flag by ID
*
* @param projectKey The project key, used to tie the flags together under one project so they can be managed together. (required)
* @param featureFlagKey The feature flag's key. The key identifies the flag in your code. (required)
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse deleteFeatureFlagWithHttpInfo(String projectKey, String featureFlagKey) throws ApiException {
com.squareup.okhttp.Call call = deleteFeatureFlagValidateBeforeCall(projectKey, featureFlagKey, null, null);
return apiClient.execute(call);
}
/**
* Delete a feature flag by ID (asynchronously)
*
* @param projectKey The project key, used to tie the flags together under one project so they can be managed together. (required)
* @param featureFlagKey The feature flag's key. The key identifies the flag in your code. (required)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call deleteFeatureFlagAsync(String projectKey, String featureFlagKey, final ApiCallback callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = deleteFeatureFlagValidateBeforeCall(projectKey, featureFlagKey, progressListener, progressRequestListener);
apiClient.executeAsync(call, callback);
return call;
}
/**
* Build call for getFeatureFlag
* @param projectKey The project key, used to tie the flags together under one project so they can be managed together. (required)
* @param featureFlagKey The feature flag's key. The key identifies the flag in your code. (required)
* @param environmentKeyQuery The environment key (optional)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call getFeatureFlagCall(String projectKey, String featureFlagKey, String environmentKeyQuery, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/flags/{projectKey}/{featureFlagKey}"
.replaceAll("\\{" + "projectKey" + "\\}", apiClient.escapeString(projectKey.toString()))
.replaceAll("\\{" + "featureFlagKey" + "\\}", apiClient.escapeString(featureFlagKey.toString()));
List localVarQueryParams = new ArrayList();
if (environmentKeyQuery != null)
localVarQueryParams.addAll(apiClient.parameterToPairs("", "environmentKeyQuery", environmentKeyQuery));
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "Token" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call getFeatureFlagValidateBeforeCall(String projectKey, String featureFlagKey, String environmentKeyQuery, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'projectKey' is set
if (projectKey == null) {
throw new ApiException("Missing the required parameter 'projectKey' when calling getFeatureFlag(Async)");
}
// verify the required parameter 'featureFlagKey' is set
if (featureFlagKey == null) {
throw new ApiException("Missing the required parameter 'featureFlagKey' when calling getFeatureFlag(Async)");
}
com.squareup.okhttp.Call call = getFeatureFlagCall(projectKey, featureFlagKey, environmentKeyQuery, progressListener, progressRequestListener);
return call;
}
/**
* Get a single feature flag by key.
*
* @param projectKey The project key, used to tie the flags together under one project so they can be managed together. (required)
* @param featureFlagKey The feature flag's key. The key identifies the flag in your code. (required)
* @param environmentKeyQuery The environment key (optional)
* @return FeatureFlag
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public FeatureFlag getFeatureFlag(String projectKey, String featureFlagKey, String environmentKeyQuery) throws ApiException {
ApiResponse resp = getFeatureFlagWithHttpInfo(projectKey, featureFlagKey, environmentKeyQuery);
return resp.getData();
}
/**
* Get a single feature flag by key.
*
* @param projectKey The project key, used to tie the flags together under one project so they can be managed together. (required)
* @param featureFlagKey The feature flag's key. The key identifies the flag in your code. (required)
* @param environmentKeyQuery The environment key (optional)
* @return ApiResponse<FeatureFlag>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getFeatureFlagWithHttpInfo(String projectKey, String featureFlagKey, String environmentKeyQuery) throws ApiException {
com.squareup.okhttp.Call call = getFeatureFlagValidateBeforeCall(projectKey, featureFlagKey, environmentKeyQuery, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Get a single feature flag by key. (asynchronously)
*
* @param projectKey The project key, used to tie the flags together under one project so they can be managed together. (required)
* @param featureFlagKey The feature flag's key. The key identifies the flag in your code. (required)
* @param environmentKeyQuery The environment key (optional)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call getFeatureFlagAsync(String projectKey, String featureFlagKey, String environmentKeyQuery, final ApiCallback callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = getFeatureFlagValidateBeforeCall(projectKey, featureFlagKey, environmentKeyQuery, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getFeatureFlagStatus
* @param projectKey The project key, used to tie the flags together under one project so they can be managed together. (required)
* @param environmentKey The environment key (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call getFeatureFlagStatusCall(String projectKey, String environmentKey, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/flag-statuses/{projectKey}/{environmentKey}"
.replaceAll("\\{" + "projectKey" + "\\}", apiClient.escapeString(projectKey.toString()))
.replaceAll("\\{" + "environmentKey" + "\\}", apiClient.escapeString(environmentKey.toString()));
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "Token" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call getFeatureFlagStatusValidateBeforeCall(String projectKey, String environmentKey, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'projectKey' is set
if (projectKey == null) {
throw new ApiException("Missing the required parameter 'projectKey' when calling getFeatureFlagStatus(Async)");
}
// verify the required parameter 'environmentKey' is set
if (environmentKey == null) {
throw new ApiException("Missing the required parameter 'environmentKey' when calling getFeatureFlagStatus(Async)");
}
com.squareup.okhttp.Call call = getFeatureFlagStatusCall(projectKey, environmentKey, progressListener, progressRequestListener);
return call;
}
/**
* Get a list of statuses for all feature flags
*
* @param projectKey The project key, used to tie the flags together under one project so they can be managed together. (required)
* @param environmentKey The environment key (required)
* @return FeatureFlagStatuses
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public FeatureFlagStatuses getFeatureFlagStatus(String projectKey, String environmentKey) throws ApiException {
ApiResponse resp = getFeatureFlagStatusWithHttpInfo(projectKey, environmentKey);
return resp.getData();
}
/**
* Get a list of statuses for all feature flags
*
* @param projectKey The project key, used to tie the flags together under one project so they can be managed together. (required)
* @param environmentKey The environment key (required)
* @return ApiResponse<FeatureFlagStatuses>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getFeatureFlagStatusWithHttpInfo(String projectKey, String environmentKey) throws ApiException {
com.squareup.okhttp.Call call = getFeatureFlagStatusValidateBeforeCall(projectKey, environmentKey, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Get a list of statuses for all feature flags (asynchronously)
*
* @param projectKey The project key, used to tie the flags together under one project so they can be managed together. (required)
* @param environmentKey The environment key (required)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call getFeatureFlagStatusAsync(String projectKey, String environmentKey, final ApiCallback callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = getFeatureFlagStatusValidateBeforeCall(projectKey, environmentKey, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getFeatureFlagStatuses
* @param projectKey The project key, used to tie the flags together under one project so they can be managed together. (required)
* @param environmentKey The environment key (required)
* @param featureFlagKey The feature flag's key. The key identifies the flag in your code. (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call getFeatureFlagStatusesCall(String projectKey, String environmentKey, String featureFlagKey, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/flag-statuses/{projectKey}/{environmentKey}/{featureFlagKey}"
.replaceAll("\\{" + "projectKey" + "\\}", apiClient.escapeString(projectKey.toString()))
.replaceAll("\\{" + "environmentKey" + "\\}", apiClient.escapeString(environmentKey.toString()))
.replaceAll("\\{" + "featureFlagKey" + "\\}", apiClient.escapeString(featureFlagKey.toString()));
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "Token" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call getFeatureFlagStatusesValidateBeforeCall(String projectKey, String environmentKey, String featureFlagKey, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'projectKey' is set
if (projectKey == null) {
throw new ApiException("Missing the required parameter 'projectKey' when calling getFeatureFlagStatuses(Async)");
}
// verify the required parameter 'environmentKey' is set
if (environmentKey == null) {
throw new ApiException("Missing the required parameter 'environmentKey' when calling getFeatureFlagStatuses(Async)");
}
// verify the required parameter 'featureFlagKey' is set
if (featureFlagKey == null) {
throw new ApiException("Missing the required parameter 'featureFlagKey' when calling getFeatureFlagStatuses(Async)");
}
com.squareup.okhttp.Call call = getFeatureFlagStatusesCall(projectKey, environmentKey, featureFlagKey, progressListener, progressRequestListener);
return call;
}
/**
* Get a list of statuses for all feature flags
*
* @param projectKey The project key, used to tie the flags together under one project so they can be managed together. (required)
* @param environmentKey The environment key (required)
* @param featureFlagKey The feature flag's key. The key identifies the flag in your code. (required)
* @return FeatureFlagStatus
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public FeatureFlagStatus getFeatureFlagStatuses(String projectKey, String environmentKey, String featureFlagKey) throws ApiException {
ApiResponse resp = getFeatureFlagStatusesWithHttpInfo(projectKey, environmentKey, featureFlagKey);
return resp.getData();
}
/**
* Get a list of statuses for all feature flags
*
* @param projectKey The project key, used to tie the flags together under one project so they can be managed together. (required)
* @param environmentKey The environment key (required)
* @param featureFlagKey The feature flag's key. The key identifies the flag in your code. (required)
* @return ApiResponse<FeatureFlagStatus>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getFeatureFlagStatusesWithHttpInfo(String projectKey, String environmentKey, String featureFlagKey) throws ApiException {
com.squareup.okhttp.Call call = getFeatureFlagStatusesValidateBeforeCall(projectKey, environmentKey, featureFlagKey, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Get a list of statuses for all feature flags (asynchronously)
*
* @param projectKey The project key, used to tie the flags together under one project so they can be managed together. (required)
* @param environmentKey The environment key (required)
* @param featureFlagKey The feature flag's key. The key identifies the flag in your code. (required)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call getFeatureFlagStatusesAsync(String projectKey, String environmentKey, String featureFlagKey, final ApiCallback callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = getFeatureFlagStatusesValidateBeforeCall(projectKey, environmentKey, featureFlagKey, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getFeatureFlags
* @param projectKey The project key, used to tie the flags together under one project so they can be managed together. (required)
* @param environmentKeyQuery The environment key (optional)
* @param tag Filter by tag. A tag can be used to group flags across projects. (optional)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call getFeatureFlagsCall(String projectKey, String environmentKeyQuery, String tag, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/flags/{projectKey}"
.replaceAll("\\{" + "projectKey" + "\\}", apiClient.escapeString(projectKey.toString()));
List localVarQueryParams = new ArrayList();
if (environmentKeyQuery != null)
localVarQueryParams.addAll(apiClient.parameterToPairs("", "environmentKeyQuery", environmentKeyQuery));
if (tag != null)
localVarQueryParams.addAll(apiClient.parameterToPairs("", "tag", tag));
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "Token" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call getFeatureFlagsValidateBeforeCall(String projectKey, String environmentKeyQuery, String tag, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'projectKey' is set
if (projectKey == null) {
throw new ApiException("Missing the required parameter 'projectKey' when calling getFeatureFlags(Async)");
}
com.squareup.okhttp.Call call = getFeatureFlagsCall(projectKey, environmentKeyQuery, tag, progressListener, progressRequestListener);
return call;
}
/**
* Get a list of all features in the given project.
*
* @param projectKey The project key, used to tie the flags together under one project so they can be managed together. (required)
* @param environmentKeyQuery The environment key (optional)
* @param tag Filter by tag. A tag can be used to group flags across projects. (optional)
* @return FeatureFlags
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public FeatureFlags getFeatureFlags(String projectKey, String environmentKeyQuery, String tag) throws ApiException {
ApiResponse resp = getFeatureFlagsWithHttpInfo(projectKey, environmentKeyQuery, tag);
return resp.getData();
}
/**
* Get a list of all features in the given project.
*
* @param projectKey The project key, used to tie the flags together under one project so they can be managed together. (required)
* @param environmentKeyQuery The environment key (optional)
* @param tag Filter by tag. A tag can be used to group flags across projects. (optional)
* @return ApiResponse<FeatureFlags>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getFeatureFlagsWithHttpInfo(String projectKey, String environmentKeyQuery, String tag) throws ApiException {
com.squareup.okhttp.Call call = getFeatureFlagsValidateBeforeCall(projectKey, environmentKeyQuery, tag, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Get a list of all features in the given project. (asynchronously)
*
* @param projectKey The project key, used to tie the flags together under one project so they can be managed together. (required)
* @param environmentKeyQuery The environment key (optional)
* @param tag Filter by tag. A tag can be used to group flags across projects. (optional)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call getFeatureFlagsAsync(String projectKey, String environmentKeyQuery, String tag, final ApiCallback callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = getFeatureFlagsValidateBeforeCall(projectKey, environmentKeyQuery, tag, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for patchFeatureFlag
* @param projectKey The project key, used to tie the flags together under one project so they can be managed together. (required)
* @param featureFlagKey The feature flag's key. The key identifies the flag in your code. (required)
* @param patchDelta http://jsonpatch.com/ (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call patchFeatureFlagCall(String projectKey, String featureFlagKey, List patchDelta, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = patchDelta;
// create path and map variables
String localVarPath = "/flags/{projectKey}/{featureFlagKey}"
.replaceAll("\\{" + "projectKey" + "\\}", apiClient.escapeString(projectKey.toString()))
.replaceAll("\\{" + "featureFlagKey" + "\\}", apiClient.escapeString(featureFlagKey.toString()));
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "Token" };
return apiClient.buildCall(localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call patchFeatureFlagValidateBeforeCall(String projectKey, String featureFlagKey, List patchDelta, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'projectKey' is set
if (projectKey == null) {
throw new ApiException("Missing the required parameter 'projectKey' when calling patchFeatureFlag(Async)");
}
// verify the required parameter 'featureFlagKey' is set
if (featureFlagKey == null) {
throw new ApiException("Missing the required parameter 'featureFlagKey' when calling patchFeatureFlag(Async)");
}
// verify the required parameter 'patchDelta' is set
if (patchDelta == null) {
throw new ApiException("Missing the required parameter 'patchDelta' when calling patchFeatureFlag(Async)");
}
com.squareup.okhttp.Call call = patchFeatureFlagCall(projectKey, featureFlagKey, patchDelta, progressListener, progressRequestListener);
return call;
}
/**
* Modify a feature flag by ID
*
* @param projectKey The project key, used to tie the flags together under one project so they can be managed together. (required)
* @param featureFlagKey The feature flag's key. The key identifies the flag in your code. (required)
* @param patchDelta http://jsonpatch.com/ (required)
* @return FeatureFlag
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public FeatureFlag patchFeatureFlag(String projectKey, String featureFlagKey, List patchDelta) throws ApiException {
ApiResponse resp = patchFeatureFlagWithHttpInfo(projectKey, featureFlagKey, patchDelta);
return resp.getData();
}
/**
* Modify a feature flag by ID
*
* @param projectKey The project key, used to tie the flags together under one project so they can be managed together. (required)
* @param featureFlagKey The feature flag's key. The key identifies the flag in your code. (required)
* @param patchDelta http://jsonpatch.com/ (required)
* @return ApiResponse<FeatureFlag>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse patchFeatureFlagWithHttpInfo(String projectKey, String featureFlagKey, List patchDelta) throws ApiException {
com.squareup.okhttp.Call call = patchFeatureFlagValidateBeforeCall(projectKey, featureFlagKey, patchDelta, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Modify a feature flag by ID (asynchronously)
*
* @param projectKey The project key, used to tie the flags together under one project so they can be managed together. (required)
* @param featureFlagKey The feature flag's key. The key identifies the flag in your code. (required)
* @param patchDelta http://jsonpatch.com/ (required)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call patchFeatureFlagAsync(String projectKey, String featureFlagKey, List patchDelta, final ApiCallback callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = patchFeatureFlagValidateBeforeCall(projectKey, featureFlagKey, patchDelta, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for postFeatureFlag
* @param projectKey The project key, used to tie the flags together under one project so they can be managed together. (required)
* @param featureFlagBody Create a new feature flag (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call postFeatureFlagCall(String projectKey, FeatureFlagBody featureFlagBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = featureFlagBody;
// create path and map variables
String localVarPath = "/flags/{projectKey}"
.replaceAll("\\{" + "projectKey" + "\\}", apiClient.escapeString(projectKey.toString()));
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "Token" };
return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call postFeatureFlagValidateBeforeCall(String projectKey, FeatureFlagBody featureFlagBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'projectKey' is set
if (projectKey == null) {
throw new ApiException("Missing the required parameter 'projectKey' when calling postFeatureFlag(Async)");
}
// verify the required parameter 'featureFlagBody' is set
if (featureFlagBody == null) {
throw new ApiException("Missing the required parameter 'featureFlagBody' when calling postFeatureFlag(Async)");
}
com.squareup.okhttp.Call call = postFeatureFlagCall(projectKey, featureFlagBody, progressListener, progressRequestListener);
return call;
}
/**
* Create a feature flag
*
* @param projectKey The project key, used to tie the flags together under one project so they can be managed together. (required)
* @param featureFlagBody Create a new feature flag (required)
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void postFeatureFlag(String projectKey, FeatureFlagBody featureFlagBody) throws ApiException {
postFeatureFlagWithHttpInfo(projectKey, featureFlagBody);
}
/**
* Create a feature flag
*
* @param projectKey The project key, used to tie the flags together under one project so they can be managed together. (required)
* @param featureFlagBody Create a new feature flag (required)
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse postFeatureFlagWithHttpInfo(String projectKey, FeatureFlagBody featureFlagBody) throws ApiException {
com.squareup.okhttp.Call call = postFeatureFlagValidateBeforeCall(projectKey, featureFlagBody, null, null);
return apiClient.execute(call);
}
/**
* Create a feature flag (asynchronously)
*
* @param projectKey The project key, used to tie the flags together under one project so they can be managed together. (required)
* @param featureFlagBody Create a new feature flag (required)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call postFeatureFlagAsync(String projectKey, FeatureFlagBody featureFlagBody, final ApiCallback callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = postFeatureFlagValidateBeforeCall(projectKey, featureFlagBody, progressListener, progressRequestListener);
apiClient.executeAsync(call, callback);
return call;
}
}