updateFeatureFlag method
Future<Response<SuccessResponse> >
updateFeatureFlag({
- required String featureFlagKey,
- required String name,
- required String description,
- required String type,
- required String allowOverrideLevel,
- required String defaultValue,
- CancelToken? cancelToken,
- Map<
String, dynamic> ? headers, - Map<
String, dynamic> ? extra, - ValidateStatus? validateStatus,
- ProgressCallback? onSendProgress,
- ProgressCallback? onReceiveProgress,
Replace Feature Flag Update feature flag.
Parameters:
featureFlagKey
- The key identifier for the feature flag.name
- The name of the flag.description
- Description of the flag purpose.type
- The variable typeallowOverrideLevel
- Allow the flag to be overridden at a different level.defaultValue
- Default value for the flag used by environments and organizations.cancelToken
- ACancelToken
that can be used to cancel the operationheaders
- Can be used to add additional headers to the requestextras
- Can be used to add flags to the requestvalidateStatus
- AValidateStatus
callback that can be used to determine request success based on the HTTP status of the responseonSendProgress
- AProgressCallback
that can be used to get the send progressonReceiveProgress
- AProgressCallback
that can be used to get the receive progress
Returns a Future containing a Response
with a SuccessResponse as data
Throws DioException
if API call or serialization fails
Implementation
Future<Response<SuccessResponse>> updateFeatureFlag({
required String featureFlagKey,
required String name,
required String description,
required String type,
required String allowOverrideLevel,
required String defaultValue,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final path = r'/api/v1/feature_flags/{feature_flag_key}'.replaceAll('{' r'feature_flag_key' '}', encodeQueryParameter(_serializers, featureFlagKey, const FullType(String)).toString());
final options = Options(
method: r'PUT',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'http',
'scheme': 'bearer',
'name': 'kindeBearerAuth',
},
],
...?extra,
},
validateStatus: validateStatus,
);
final queryParameters = <String, dynamic>{
r'name': encodeQueryParameter(_serializers, name, const FullType(String)),
r'description': encodeQueryParameter(_serializers, description, const FullType(String)),
r'type': encodeQueryParameter(_serializers, type, const FullType(String)),
r'allow_override_level': encodeQueryParameter(_serializers, allowOverrideLevel, const FullType(String)),
r'default_value': encodeQueryParameter(_serializers, defaultValue, const FullType(String)),
};
final response = await _dio.request<Object>(
path,
options: options,
queryParameters: queryParameters,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
SuccessResponse? responseData;
try {
final rawResponse = response.data;
responseData = rawResponse == null ? null : _serializers.deserialize(
rawResponse,
specifiedType: const FullType(SuccessResponse),
) as SuccessResponse;
} catch (error, stackTrace) {
throw DioException(
requestOptions: response.requestOptions,
response: response,
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
return Response<SuccessResponse>(
data: responseData,
headers: response.headers,
isRedirect: response.isRedirect,
requestOptions: response.requestOptions,
redirects: response.redirects,
statusCode: response.statusCode,
statusMessage: response.statusMessage,
extra: response.extra,
);
}