feat: add optional organization id field to create app request (#2513)

This commit is contained in:
Bryan Oltman
2024-10-07 12:21:50 -04:00
committed by GitHub
parent 1c41b82314
commit afb1dea7a5
2 changed files with 15 additions and 2 deletions
@@ -8,7 +8,10 @@ part 'create_app_request.g.dart';
@JsonSerializable()
class CreateAppRequest {
/// {@macro create_app_request}
const CreateAppRequest({required this.displayName});
const CreateAppRequest({
required this.displayName,
this.organizationId,
});
/// Converts a Map<String, dynamic> to a [CreateAppRequest]
factory CreateAppRequest.fromJson(Map<String, dynamic> json) =>
@@ -19,4 +22,8 @@ class CreateAppRequest {
/// The display name of the app.
final String displayName;
/// The id of organization that this app will belong to. If no id is provided,
/// this app will belong to the user's personal organization.
final int? organizationId;
}
@@ -15,13 +15,19 @@ CreateAppRequest _$CreateAppRequestFromJson(Map<String, dynamic> json) =>
($checkedConvert) {
final val = CreateAppRequest(
displayName: $checkedConvert('display_name', (v) => v as String),
organizationId:
$checkedConvert('organization_id', (v) => (v as num?)?.toInt()),
);
return val;
},
fieldKeyMap: const {'displayName': 'display_name'},
fieldKeyMap: const {
'displayName': 'display_name',
'organizationId': 'organization_id'
},
);
Map<String, dynamic> _$CreateAppRequestToJson(CreateAppRequest instance) =>
<String, dynamic>{
'display_name': instance.displayName,
'organization_id': instance.organizationId,
};