buildApiProviderProperties function
Build API provider properties.
Implementation
List<StatusProperty> buildApiProviderProperties({
required String apiProvider,
String? baseUrl,
String? region,
String? gcpProject,
bool skipAuth = false,
}) {
final properties = <StatusProperty>[];
if (apiProvider != 'firstParty') {
final label = switch (apiProvider) {
'bedrock' => 'AWS Bedrock',
'vertex' => 'Google Vertex AI',
'foundry' => 'Microsoft Foundry',
_ => apiProvider,
};
properties.add(StatusProperty(label: NeomageTranslationConstants.apiProviderLabel.tr, value: label));
}
if (baseUrl != null) {
final urlLabel = switch (apiProvider) {
'bedrock' => 'Bedrock base URL',
'vertex' => 'Vertex base URL',
_ => 'Anthropic base URL',
};
properties.add(StatusProperty(label: urlLabel, value: baseUrl));
}
if (region != null) {
final regionLabel = apiProvider == 'bedrock'
? 'AWS region'
: 'Default region';
properties.add(StatusProperty(label: regionLabel, value: region));
}
if (gcpProject != null) {
properties.add(StatusProperty(label: NeomageTranslationConstants.gcpProject.tr, value: gcpProject));
}
if (skipAuth) {
properties.add(
StatusProperty(value: '${apiProvider.toUpperCase()} auth skipped'),
);
}
return properties;
}