createChannel method

Future<Channel> createChannel(
  1. String guildId, {
  2. required String name,
  3. int? type,
  4. String? topic,
  5. int? bitrate,
  6. int? userLimit,
  7. int? rateLimitPerUser,
  8. int? position,
  9. List<Overwrite>? permissionOverwrites,
  10. String? parentId,
  11. bool? nsfw,
})

Implementation

Future<Channel> createChannel(
  String guildId, {
  required String name,
  int? type,
  String? topic,
  int? bitrate,
  int? userLimit,
  int? rateLimitPerUser,
  int? position,
  List<Overwrite>? permissionOverwrites,
  String? parentId,
  bool? nsfw,
}) {
  var endpoint = '/guilds/$guildId/channels';
  return _http.request(
    endpoint,
    converter: Channel.fromJson,
    method: 'post',
    body: {
      'name': name,
      'type': type,
      'topic': topic,
      'bitrate': bitrate,
      'user_limit': userLimit,
      'rate_limit_per_user': rateLimitPerUser,
      'position': position,
      'permission_overwrites': permissionOverwrites,
      'parent_id': parentId,
      'nsfw': nsfw,
    }..filterNullValues(),
  );
}