heroiclabs / nakama-dart

Pure Dart Client for Nakama Server
https://heroiclabs.com/docs/nakama/client-libraries/dart
157 stars 48 forks source link

Name filter doesn't work in ListGroups method #83

Closed ilmalte closed 6 months ago

ilmalte commented 6 months ago

Describe the bug If I pass only the parameters session and name to the listGroups method, the backend throws an exception saying: GrpcError (gRPC Error (code: 3, codeName: INVALID_ARGUMENT, message: name filter cannot be combined with any other filter, details: [], rawResponse: null, trailers: {}))

Reproduction Code Example:

 var listGroups = await NakamaClient.instance!.listGroups(
        session: session,
        name: "everyone",
      );

Expected behavior I expect to retrieve a list of groups, filtered based on the name passed as filter.

Additional context Considering the error message, it seems like only the name should be passed as filter and cannot be combined. By using the API explorer through the console interface of Nakama, the endpoint works fine when the name only is passed (and the others are null). I expect this issue to be in both client files: nakama_grpc_client.dart and nakama_api_client.dart

  @override
  Future<model.GroupList> listGroups({
    required model.Session session,
    String? name,
    String? cursor,
    String? langTag,
    int? members,
    bool? open,
    int limit = defaultLimit,
  }) async {
   final res = await _client.listGroups(
      api.ListGroupsRequest(
        name: name,
        cursor: cursor,
        langTag: langTag,
        limit: api.Int32Value(value: limit),
        members: api.Int32Value(value: members),
        open: api.BoolValue(value: open),
      );
      options: _getSessionCallOptions(session),
    );

    return model.GroupList.fromDto(res);
  }

I also tried to manually pass null to all the parameters but in the name and I confirm this is the behavior the backend expects.

zhangyc commented 6 months ago

It seems that this library still cannot run stably.

obrunsmann commented 6 months ago

Fixed in v1.0.5