verifySession method

Future<Session> verifySession({
  1. required String partialSessionId,
  2. required String code,
})

Implementation

Future<Session> verifySession({
  required String partialSessionId,
  required String code,
}) async {
  final body = <String, dynamic>{
    'code': code,
  };

  final response = await _post(
    path: '/sessions/$partialSessionId/verify',
    body: body,
  );

  final json = jsonDecode(response.body);

  if (response.statusCode >= 400) {
    return Future.error(ApiError.fromJson(json));
  }

  return Session.fromJson(json);
}