feat: Added updatePartial endpoint
This commit is contained in:
@@ -394,6 +394,13 @@ class Channel {
|
||||
return _client.decode(response.data, UpdateChannelResponse.fromJson);
|
||||
}
|
||||
|
||||
/// Edit the channel custom data
|
||||
Future<PartialUpdateChannelResponse> updatePartial(
|
||||
Map<String, dynamic> channelData) async {
|
||||
final response = await _client.patch(_channelURL, data: channelData);
|
||||
return _client.decode(response.data, PartialUpdateChannelResponse.fromJson);
|
||||
}
|
||||
|
||||
/// Delete this channel. Messages are permanently removed.
|
||||
Future<EmptyResponse> delete() async {
|
||||
final response = await _client.delete(_channelURL);
|
||||
|
||||
@@ -247,6 +247,20 @@ class UpdateChannelResponse extends _BaseResponse {
|
||||
_$UpdateChannelResponseFromJson(json);
|
||||
}
|
||||
|
||||
/// Model response for [Channel.updatePartial] api call
|
||||
@JsonSerializable(createToJson: false)
|
||||
class PartialUpdateChannelResponse extends _BaseResponse {
|
||||
/// Updated channel
|
||||
ChannelModel channel;
|
||||
|
||||
/// Channel members
|
||||
List<Member> members;
|
||||
|
||||
/// Create a new instance from a json
|
||||
static PartialUpdateChannelResponse fromJson(Map<String, dynamic> json) =>
|
||||
_$PartialUpdateChannelResponseFromJson(json);
|
||||
}
|
||||
|
||||
/// Model response for [Channel.inviteMembers] api call
|
||||
@JsonSerializable(createToJson: false)
|
||||
class InviteMembersResponse extends _BaseResponse {
|
||||
|
||||
@@ -225,6 +225,23 @@ UpdateChannelResponse _$UpdateChannelResponseFromJson(Map json) {
|
||||
));
|
||||
}
|
||||
|
||||
PartialUpdateChannelResponse _$PartialUpdateChannelResponseFromJson(Map json) {
|
||||
return PartialUpdateChannelResponse()
|
||||
..duration = json['duration'] as String
|
||||
..channel = json['channel'] == null
|
||||
? null
|
||||
: ChannelModel.fromJson((json['channel'] as Map)?.map(
|
||||
(k, e) => MapEntry(k as String, e),
|
||||
))
|
||||
..members = (json['members'] as List)
|
||||
?.map((e) => e == null
|
||||
? null
|
||||
: Member.fromJson((e as Map)?.map(
|
||||
(k, e) => MapEntry(k as String, e),
|
||||
)))
|
||||
?.toList();
|
||||
}
|
||||
|
||||
InviteMembersResponse _$InviteMembersResponseFromJson(Map json) {
|
||||
return InviteMembersResponse()
|
||||
..duration = json['duration'] as String
|
||||
|
||||
Reference in New Issue
Block a user