createReadWriteSession method

Future<TCreateReadWriteSessionResponse> createReadWriteSession({
  1. required TCreateReadWriteSessionBody input,
})

Create a read write session for a user.

Sign the provided TCreateReadWriteSessionBody with the client's stamp function and submit the request (POST /public/v1/submit/create_read_write_session).

See also: stampCreateReadWriteSession.

Implementation

Future<TCreateReadWriteSessionResponse> createReadWriteSession({
  required TCreateReadWriteSessionBody input,
}) async {
  final body = packActivityBody(
    bodyJson: input.toJson(),
    fallbackOrganizationId: input.organizationId ??
        config.organizationId ??
        (throw Exception(
            "Missing organization ID, please pass in a sub-organizationId or instantiate the client with one.")),
    activityType: 'ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION_V2',
  );
  return await request<Map<String, dynamic>, TCreateReadWriteSessionResponse>(
      "/public/v1/submit/create_read_write_session",
      body,
      (json) => TCreateReadWriteSessionResponse.fromJson(
          transformActivityResponse(json, 'CreateReadWriteSession')));
}