update method

Future<Channel> update(
  1. Snowflake id,
  2. UpdateBuilder<Channel> builder,
  3. {String? auditLogReason}
)

Update a channel using the provided builder.

Implementation

Future<Channel> update(Snowflake id, UpdateBuilder<Channel> builder, {String? auditLogReason}) async {
  final route = HttpRoute()..channels(id: id.toString());
  final request = BasicRequest(
    route,
    method: 'PATCH',
    body: jsonEncode(builder.build()),
    auditLogReason: auditLogReason,
  );

  final response = await client.httpHandler.executeSafe(request);
  final channel = parse(response.jsonBody as Map<String, Object?>);

  client.updateCacheWith(channel);
  return channel;
}