getCanPassAccount method

Future<CanPassAccount> getCanPassAccount(
  1. String? accessToken
)

Implementation

Future<CanPassAccount> getCanPassAccount(String? accessToken) async {
  final HttpLink httpLink = HttpLink(Constants.graphQL);
  final AuthLink authLink = AuthLink(
    getToken: () async => 'Bearer $accessToken',
  );
  final Link link = authLink.concat(httpLink);

  final accountMap = (await GraphQLClient(
    cache: GraphQLCache(),
    link: link,
  ).query(QueryOptions(
    document: gql(Constants.readAccountQuery),
    variables: {
      'nRepositories': 50,
    },
    pollInterval: Duration(seconds: 10),
  )))
      .data!['me'];
  return CanPassAccount.fromJson(accountMap);
}