createReadOnlySession method

Future<TCreateReadOnlySessionResponse> createReadOnlySession({
  1. required TCreateReadOnlySessionBody input,
})

Create a read only session for a user (valid for 1 hour).

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

See also: stampCreateReadOnlySession.

Implementation

Future<TCreateReadOnlySessionResponse> createReadOnlySession({
  required TCreateReadOnlySessionBody 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_ONLY_SESSION',
  );
  return await request<Map<String, dynamic>, TCreateReadOnlySessionResponse>(
      "/public/v1/submit/create_read_only_session",
      body,
      (json) => TCreateReadOnlySessionResponse.fromJson(
          transformActivityResponse(json, 'CreateReadOnlySession')));
}