Added functionality to create chat
This commit is contained in:
24
lib/api/marianumcloud/talk/createRoom/createRoom.dart
Normal file
24
lib/api/marianumcloud/talk/createRoom/createRoom.dart
Normal file
@ -0,0 +1,24 @@
|
||||
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:http/http.dart';
|
||||
|
||||
import '../talkApi.dart';
|
||||
import 'createRoomParams.dart';
|
||||
class CreateRoom extends TalkApi<void> {
|
||||
CreateRoomParams params;
|
||||
|
||||
CreateRoom(this.params) : super("v4/room", params);
|
||||
|
||||
@override
|
||||
assemble(String raw) {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Response>? request(Uri uri, Object? body, Map<String, String>? headers) {
|
||||
if(body is CreateRoomParams) {
|
||||
return http.post(uri, headers: headers, body: body.toJson().map((key, value) => MapEntry(key, value.toString())));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
27
lib/api/marianumcloud/talk/createRoom/createRoomParams.dart
Normal file
27
lib/api/marianumcloud/talk/createRoom/createRoomParams.dart
Normal file
@ -0,0 +1,27 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import '../../../apiParams.dart';
|
||||
|
||||
part 'createRoomParams.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class CreateRoomParams extends ApiParams {
|
||||
int roomType;
|
||||
String invite;
|
||||
String? source;
|
||||
String? roomName;
|
||||
String? objectType;
|
||||
String? objectId;
|
||||
|
||||
CreateRoomParams({
|
||||
required this.roomType,
|
||||
required this.invite,
|
||||
this.source,
|
||||
this.roomName,
|
||||
this.objectType,
|
||||
this.objectId
|
||||
});
|
||||
|
||||
factory CreateRoomParams.fromJson(Map<String, dynamic> json) => _$CreateRoomParamsFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$CreateRoomParamsToJson(this);
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'createRoomParams.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
CreateRoomParams _$CreateRoomParamsFromJson(Map<String, dynamic> json) =>
|
||||
CreateRoomParams(
|
||||
roomType: json['roomType'] as int,
|
||||
invite: json['invite'] as String,
|
||||
source: json['source'] as String?,
|
||||
roomName: json['roomName'] as String?,
|
||||
objectType: json['objectType'] as String?,
|
||||
objectId: json['objectId'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$CreateRoomParamsToJson(CreateRoomParams instance) =>
|
||||
<String, dynamic>{
|
||||
'roomType': instance.roomType,
|
||||
'invite': instance.invite,
|
||||
'source': instance.source,
|
||||
'roomName': instance.roomName,
|
||||
'objectType': instance.objectType,
|
||||
'objectId': instance.objectId,
|
||||
};
|
Reference in New Issue
Block a user