createInvitation method

Uri createInvitation({
  1. List<ClientPermission> permissions = const [],
  2. List<ClientScope> scope = const [],
})

Implementation

Uri createInvitation ({ List<ClientPermission> permissions = const [], List<ClientScope> scope = const [] }) {
  int _permissions = permissions.fold(0, (acc, element) => acc += element.value);

  return Uri(
    host: 'discord.com',
    scheme: 'https',
    path: '/api/oauth2/authorize',
    queryParameters: {
      'client_id': user.id,
      'permissions': _permissions.toString(),
      'scope': scope.map((scope) => scope.value).join(' ')
    }
  );
}