createStageInstance method

Future<StageInstance> createStageInstance(
  1. Snowflake channelId,
  2. StageInstanceBuilder builder,
  3. {String? auditLogReason}
)

Start a stage instance in a channel.

Implementation

Future<StageInstance> createStageInstance(Snowflake channelId, StageInstanceBuilder builder, {String? auditLogReason}) async {
  final route = HttpRoute()..stageInstances();
  final request = BasicRequest(
    route,
    method: 'POST',
    body: jsonEncode({'channel_id': channelId.toString(), ...builder.build()}),
    auditLogReason: auditLogReason,
  );

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

  client.updateCacheWith(stageInstance);
  return stageInstance;
}