diff --git a/lib/nakama.dart b/lib/nakama.dart deleted file mode 100644 index e9f2af7..0000000 --- a/lib/nakama.dart +++ /dev/null @@ -1,33 +0,0 @@ -library nakama; - -export 'package:fixnum/fixnum.dart' show Int64; - -// Enums -export './src/enum/channel_type.dart'; -export './src/enum/friendship_state.dart'; -export './src/enum/group_membership_states.dart'; -export './src/enum/leaderboard_operator.dart'; -export './src/enum/storage_permission.dart'; -// Clients -export './src/nakama_client/nakama_api_client.dart'; -export './src/nakama_client/nakama_client.dart'; -export './src/nakama_client/nakama_grpc_client.dart'; -export './src/nakama_client/stub/nakama_client_stub.dart' - if (dart.library.io) './src/nakama_client/stub/grpc_client.dart' - if (dart.library.js) './src/nakama_client/stub/api_client.dart'; -export './src/nakama_websocket_client.dart'; -// Public models -export 'src/models/account.dart'; -export 'src/models/chat.dart'; -export 'src/models/friends.dart'; -export 'src/models/group.dart'; -export 'src/models/leaderboard.dart'; -export 'src/models/match.dart'; -export 'src/models/matchmaker.dart'; -export 'src/models/notification.dart'; -export 'src/models/party.dart'; -export 'src/models/rpc.dart'; -export 'src/models/session.dart'; -export 'src/models/status.dart'; -export 'src/models/storage.dart'; -export 'src/models/tournament.dart'; diff --git a/lib/satori/README.md b/lib/satori/README.md deleted file mode 100644 index 03518dd..0000000 --- a/lib/satori/README.md +++ /dev/null @@ -1 +0,0 @@ -# Satori Dart/Flutter Client \ No newline at end of file diff --git a/lib/src/api/api.dart b/lib/src/api/api.dart deleted file mode 100644 index 60bd56e..0000000 --- a/lib/src/api/api.dart +++ /dev/null @@ -1,9 +0,0 @@ -library api; - -// In64 used in protobuf -export 'package:fixnum/fixnum.dart' show Int64; - -export './proto/api/api.pb.dart'; -export './proto/google/protobuf/empty.pb.dart'; -export './proto/google/protobuf/timestamp.pb.dart'; -export './proto/google/protobuf/wrappers.pb.dart'; diff --git a/lib/src/api/rtapi.dart b/lib/src/api/rtapi.dart deleted file mode 100644 index 27163e8..0000000 --- a/lib/src/api/rtapi.dart +++ /dev/null @@ -1,9 +0,0 @@ -library api; - -// In64 used in protobuf -export 'package:fixnum/fixnum.dart' show Int64; - -export './proto/google/protobuf/empty.pb.dart'; -export './proto/google/protobuf/timestamp.pb.dart'; -export './proto/google/protobuf/wrappers.pb.dart'; -export './proto/rtapi/realtime.pb.dart'; diff --git a/.metadata b/nakama/.metadata similarity index 100% rename from .metadata rename to nakama/.metadata diff --git a/CHANGELOG.md b/nakama/CHANGELOG.md similarity index 100% rename from CHANGELOG.md rename to nakama/CHANGELOG.md diff --git a/CONTRIBUTING.md b/nakama/CONTRIBUTING.md similarity index 100% rename from CONTRIBUTING.md rename to nakama/CONTRIBUTING.md diff --git a/LICENSE b/nakama/LICENSE similarity index 100% rename from LICENSE rename to nakama/LICENSE diff --git a/README.md b/nakama/README.md similarity index 73% rename from README.md rename to nakama/README.md index 3567ce7..0c220bb 100644 --- a/README.md +++ b/nakama/README.md @@ -116,62 +116,6 @@ Remember to close the connection after disposing of the app widget: NakamaWebsocketClient.instance.close(); ``` -# Satori - -Satori is a liveops server for games that powers actionable analytics, A/B testing and remote configuration. Use the Satori Dart Client to communicate with Satori from within your Dart game. - -Full documentation is online - https://heroiclabs.com/docs/satori/client-libraries/dart/index.html - -## Getting Started - -To integrating Satori within your Dart app through Nakama package you need to import Satori using a prefix to avoid conflict with Nakama types: - -```dart -import 'package:nakama/satori/lib/satori.dart' as satori; -``` - -and then you can access satori client using `satori.` prefix. - -Now to start using Satori, create a client object that accepts the API key you were given as a Satori customer. - -```dart -final client = getSatoriClient( - host: '127.0.0.1', - port: 7450, - ssl: false, - apiKey: 'apikey', -); -``` - -Then authenticate with the server to obtain your session. - -```dart -// Authenticate with the Satori server. -try { - final session = await _satoriClient.authenticate(id: 'your-id'); - print('Authenticated successfully: $session'); -} catch (error) { - print('Authentication failed $error'); -} -``` - -Using the client you can get any experiments or feature flags the user belongs to. - -```dart -final experiments = await _satoriClient.getExperiments(session: session, names: ['experiment1', 'Experiment2']); -final flag = await _satoriClient.getFlag(session: session, name: 'FlagName'); -``` - -You can also send arbitrary events to the server: - -```dart -final event = Event( - name: 'gameLaunched', - value: jsonEncode({'gameId': 'id-1234'}), -); -await _satoriClient.event(session: session, event: event); -``` - ## Documentation **Dart/Flutter SDK Docs:** diff --git a/RELEASEINST.md b/nakama/RELEASEINST.md similarity index 100% rename from RELEASEINST.md rename to nakama/RELEASEINST.md diff --git a/analysis_options.yaml b/nakama/analysis_options.yaml similarity index 100% rename from analysis_options.yaml rename to nakama/analysis_options.yaml diff --git a/build.yaml b/nakama/build.yaml similarity index 100% rename from build.yaml rename to nakama/build.yaml diff --git a/example/.gitignore b/nakama/example/.gitignore similarity index 100% rename from example/.gitignore rename to nakama/example/.gitignore diff --git a/example/.metadata b/nakama/example/.metadata similarity index 100% rename from example/.metadata rename to nakama/example/.metadata diff --git a/example/README.md b/nakama/example/README.md similarity index 100% rename from example/README.md rename to nakama/example/README.md diff --git a/example/analysis_options.yaml b/nakama/example/analysis_options.yaml similarity index 100% rename from example/analysis_options.yaml rename to nakama/example/analysis_options.yaml diff --git a/example/lib/main.dart b/nakama/example/lib/main.dart similarity index 100% rename from example/lib/main.dart rename to nakama/example/lib/main.dart diff --git a/example/lib/widgets/match_area.dart b/nakama/example/lib/widgets/match_area.dart similarity index 100% rename from example/lib/widgets/match_area.dart rename to nakama/example/lib/widgets/match_area.dart diff --git a/example/lib/widgets/matchmaker.dart b/nakama/example/lib/widgets/matchmaker.dart similarity index 100% rename from example/lib/widgets/matchmaker.dart rename to nakama/example/lib/widgets/matchmaker.dart diff --git a/example/lib/widgets/sign_in_box.dart b/nakama/example/lib/widgets/sign_in_box.dart similarity index 100% rename from example/lib/widgets/sign_in_box.dart rename to nakama/example/lib/widgets/sign_in_box.dart diff --git a/example/lib/widgets/welcome.dart b/nakama/example/lib/widgets/welcome.dart similarity index 100% rename from example/lib/widgets/welcome.dart rename to nakama/example/lib/widgets/welcome.dart diff --git a/example/pubspec.lock b/nakama/example/pubspec.lock similarity index 100% rename from example/pubspec.lock rename to nakama/example/pubspec.lock diff --git a/example/pubspec.yaml b/nakama/example/pubspec.yaml similarity index 100% rename from example/pubspec.yaml rename to nakama/example/pubspec.yaml diff --git a/example/web/favicon.png b/nakama/example/web/favicon.png similarity index 100% rename from example/web/favicon.png rename to nakama/example/web/favicon.png diff --git a/example/web/icons/Icon-192.png b/nakama/example/web/icons/Icon-192.png similarity index 100% rename from example/web/icons/Icon-192.png rename to nakama/example/web/icons/Icon-192.png diff --git a/example/web/icons/Icon-512.png b/nakama/example/web/icons/Icon-512.png similarity index 100% rename from example/web/icons/Icon-512.png rename to nakama/example/web/icons/Icon-512.png diff --git a/example/web/index.html b/nakama/example/web/index.html similarity index 100% rename from example/web/index.html rename to nakama/example/web/index.html diff --git a/example/web/manifest.json b/nakama/example/web/manifest.json similarity index 100% rename from example/web/manifest.json rename to nakama/example/web/manifest.json diff --git a/nakama/lib/nakama.dart b/nakama/lib/nakama.dart new file mode 100644 index 0000000..31cc841 --- /dev/null +++ b/nakama/lib/nakama.dart @@ -0,0 +1,31 @@ +library nakama; + +export 'package:fixnum/fixnum.dart' show Int64; + +// Enums +export 'src/enum/channel_type.dart'; +export 'src/enum/friendship_state.dart'; +export 'src/enum/group_membership_states.dart'; +export 'src/enum/leaderboard_operator.dart'; +export 'src/enum/storage_permission.dart'; +// Public models +export 'src/models/account.dart'; +export 'src/models/chat.dart'; +export 'src/models/friends.dart'; +export 'src/models/group.dart'; +export 'src/models/leaderboard.dart'; +export 'src/models/match.dart'; +export 'src/models/matchmaker.dart'; +export 'src/models/notification.dart'; +export 'src/models/party.dart'; +export 'src/models/rpc.dart'; +export 'src/models/session.dart'; +export 'src/models/status.dart'; +export 'src/models/storage.dart'; +export 'src/models/tournament.dart'; +// Clients +export 'src/nakama_client/nakama_api_client.dart'; +export 'src/nakama_client/nakama_client.dart'; +export 'src/nakama_client/nakama_grpc_client.dart'; +export 'src/nakama_client/stub/nakama_client_stub.dart' if (dart.library.io) './src/nakama_client/stub/grpc_client.dart' if (dart.library.js) './src/nakama_client/stub/api_client.dart'; +export 'src/nakama_websocket_client.dart'; diff --git a/nakama/lib/src/api/api.dart b/nakama/lib/src/api/api.dart new file mode 100644 index 0000000..c244bc8 --- /dev/null +++ b/nakama/lib/src/api/api.dart @@ -0,0 +1,9 @@ +library api; + +// In64 used in protobuf +export 'package:fixnum/fixnum.dart' show Int64; + +export 'proto/api/api.pb.dart'; +export 'proto/google/protobuf/empty.pb.dart'; +export 'proto/google/protobuf/timestamp.pb.dart'; +export 'proto/google/protobuf/wrappers.pb.dart'; diff --git a/lib/src/api/proto/api/api.pb.dart b/nakama/lib/src/api/proto/api/api.pb.dart similarity index 100% rename from lib/src/api/proto/api/api.pb.dart rename to nakama/lib/src/api/proto/api/api.pb.dart diff --git a/lib/src/api/proto/api/api.pbenum.dart b/nakama/lib/src/api/proto/api/api.pbenum.dart similarity index 100% rename from lib/src/api/proto/api/api.pbenum.dart rename to nakama/lib/src/api/proto/api/api.pbenum.dart diff --git a/lib/src/api/proto/api/api.pbjson.dart b/nakama/lib/src/api/proto/api/api.pbjson.dart similarity index 100% rename from lib/src/api/proto/api/api.pbjson.dart rename to nakama/lib/src/api/proto/api/api.pbjson.dart diff --git a/lib/src/api/proto/apigrpc/apigrpc.pb.dart b/nakama/lib/src/api/proto/apigrpc/apigrpc.pb.dart similarity index 100% rename from lib/src/api/proto/apigrpc/apigrpc.pb.dart rename to nakama/lib/src/api/proto/apigrpc/apigrpc.pb.dart diff --git a/lib/src/api/proto/apigrpc/apigrpc.pbenum.dart b/nakama/lib/src/api/proto/apigrpc/apigrpc.pbenum.dart similarity index 100% rename from lib/src/api/proto/apigrpc/apigrpc.pbenum.dart rename to nakama/lib/src/api/proto/apigrpc/apigrpc.pbenum.dart diff --git a/lib/src/api/proto/apigrpc/apigrpc.pbgrpc.dart b/nakama/lib/src/api/proto/apigrpc/apigrpc.pbgrpc.dart similarity index 100% rename from lib/src/api/proto/apigrpc/apigrpc.pbgrpc.dart rename to nakama/lib/src/api/proto/apigrpc/apigrpc.pbgrpc.dart diff --git a/lib/src/api/proto/apigrpc/apigrpc.pbjson.dart b/nakama/lib/src/api/proto/apigrpc/apigrpc.pbjson.dart similarity index 100% rename from lib/src/api/proto/apigrpc/apigrpc.pbjson.dart rename to nakama/lib/src/api/proto/apigrpc/apigrpc.pbjson.dart diff --git a/lib/src/api/proto/google/protobuf/empty.pb.dart b/nakama/lib/src/api/proto/google/protobuf/empty.pb.dart similarity index 100% rename from lib/src/api/proto/google/protobuf/empty.pb.dart rename to nakama/lib/src/api/proto/google/protobuf/empty.pb.dart diff --git a/lib/src/api/proto/google/protobuf/empty.pbenum.dart b/nakama/lib/src/api/proto/google/protobuf/empty.pbenum.dart similarity index 100% rename from lib/src/api/proto/google/protobuf/empty.pbenum.dart rename to nakama/lib/src/api/proto/google/protobuf/empty.pbenum.dart diff --git a/lib/src/api/proto/google/protobuf/empty.pbjson.dart b/nakama/lib/src/api/proto/google/protobuf/empty.pbjson.dart similarity index 100% rename from lib/src/api/proto/google/protobuf/empty.pbjson.dart rename to nakama/lib/src/api/proto/google/protobuf/empty.pbjson.dart diff --git a/lib/src/api/proto/google/protobuf/timestamp.pb.dart b/nakama/lib/src/api/proto/google/protobuf/timestamp.pb.dart similarity index 100% rename from lib/src/api/proto/google/protobuf/timestamp.pb.dart rename to nakama/lib/src/api/proto/google/protobuf/timestamp.pb.dart diff --git a/lib/src/api/proto/google/protobuf/timestamp.pbenum.dart b/nakama/lib/src/api/proto/google/protobuf/timestamp.pbenum.dart similarity index 100% rename from lib/src/api/proto/google/protobuf/timestamp.pbenum.dart rename to nakama/lib/src/api/proto/google/protobuf/timestamp.pbenum.dart diff --git a/lib/src/api/proto/google/protobuf/timestamp.pbjson.dart b/nakama/lib/src/api/proto/google/protobuf/timestamp.pbjson.dart similarity index 100% rename from lib/src/api/proto/google/protobuf/timestamp.pbjson.dart rename to nakama/lib/src/api/proto/google/protobuf/timestamp.pbjson.dart diff --git a/lib/src/api/proto/google/protobuf/wrappers.pb.dart b/nakama/lib/src/api/proto/google/protobuf/wrappers.pb.dart similarity index 100% rename from lib/src/api/proto/google/protobuf/wrappers.pb.dart rename to nakama/lib/src/api/proto/google/protobuf/wrappers.pb.dart diff --git a/lib/src/api/proto/google/protobuf/wrappers.pbenum.dart b/nakama/lib/src/api/proto/google/protobuf/wrappers.pbenum.dart similarity index 100% rename from lib/src/api/proto/google/protobuf/wrappers.pbenum.dart rename to nakama/lib/src/api/proto/google/protobuf/wrappers.pbenum.dart diff --git a/lib/src/api/proto/google/protobuf/wrappers.pbjson.dart b/nakama/lib/src/api/proto/google/protobuf/wrappers.pbjson.dart similarity index 100% rename from lib/src/api/proto/google/protobuf/wrappers.pbjson.dart rename to nakama/lib/src/api/proto/google/protobuf/wrappers.pbjson.dart diff --git a/lib/src/api/proto/rtapi/realtime.pb.dart b/nakama/lib/src/api/proto/rtapi/realtime.pb.dart similarity index 100% rename from lib/src/api/proto/rtapi/realtime.pb.dart rename to nakama/lib/src/api/proto/rtapi/realtime.pb.dart diff --git a/lib/src/api/proto/rtapi/realtime.pbenum.dart b/nakama/lib/src/api/proto/rtapi/realtime.pbenum.dart similarity index 100% rename from lib/src/api/proto/rtapi/realtime.pbenum.dart rename to nakama/lib/src/api/proto/rtapi/realtime.pbenum.dart diff --git a/lib/src/api/proto/rtapi/realtime.pbjson.dart b/nakama/lib/src/api/proto/rtapi/realtime.pbjson.dart similarity index 100% rename from lib/src/api/proto/rtapi/realtime.pbjson.dart rename to nakama/lib/src/api/proto/rtapi/realtime.pbjson.dart diff --git a/nakama/lib/src/api/rtapi.dart b/nakama/lib/src/api/rtapi.dart new file mode 100644 index 0000000..e503634 --- /dev/null +++ b/nakama/lib/src/api/rtapi.dart @@ -0,0 +1,9 @@ +library api; + +// In64 used in protobuf +export 'package:fixnum/fixnum.dart' show Int64; + +export 'proto/google/protobuf/empty.pb.dart'; +export 'proto/google/protobuf/timestamp.pb.dart'; +export 'proto/google/protobuf/wrappers.pb.dart'; +export 'proto/rtapi/realtime.pb.dart'; diff --git a/lib/src/enum/channel_type.dart b/nakama/lib/src/enum/channel_type.dart similarity index 100% rename from lib/src/enum/channel_type.dart rename to nakama/lib/src/enum/channel_type.dart diff --git a/lib/src/enum/friendship_state.dart b/nakama/lib/src/enum/friendship_state.dart similarity index 100% rename from lib/src/enum/friendship_state.dart rename to nakama/lib/src/enum/friendship_state.dart diff --git a/lib/src/enum/group_membership_states.dart b/nakama/lib/src/enum/group_membership_states.dart similarity index 100% rename from lib/src/enum/group_membership_states.dart rename to nakama/lib/src/enum/group_membership_states.dart diff --git a/lib/src/enum/leaderboard_operator.dart b/nakama/lib/src/enum/leaderboard_operator.dart similarity index 100% rename from lib/src/enum/leaderboard_operator.dart rename to nakama/lib/src/enum/leaderboard_operator.dart diff --git a/lib/src/enum/storage_permission.dart b/nakama/lib/src/enum/storage_permission.dart similarity index 100% rename from lib/src/enum/storage_permission.dart rename to nakama/lib/src/enum/storage_permission.dart diff --git a/lib/src/models/account.dart b/nakama/lib/src/models/account.dart similarity index 86% rename from lib/src/models/account.dart rename to nakama/lib/src/models/account.dart index 95b5b2f..dd46e38 100644 --- a/lib/src/models/account.dart +++ b/nakama/lib/src/models/account.dart @@ -18,19 +18,15 @@ class Account with _$Account { required User user, }) = _Account; - factory Account.fromJson(Map json) => - _$AccountFromJson(json); + factory Account.fromJson(Map json) => _$AccountFromJson(json); factory Account.fromDto(api.Account dto) => Account( wallet: dto.wallet, email: dto.email, - devices: - dto.devices.map((e) => Device.fromDto(e)).toList(growable: false), + devices: dto.devices.map((e) => Device.fromDto(e)).toList(growable: false), customId: dto.customId, - verifyTime: - dto.verifyTime.hasNanos() ? dto.verifyTime.toDateTime() : null, - disableTime: - dto.disableTime.hasNanos() ? dto.disableTime.toDateTime() : null, + verifyTime: dto.verifyTime.hasNanos() ? dto.verifyTime.toDateTime() : null, + disableTime: dto.disableTime.hasNanos() ? dto.disableTime.toDateTime() : null, user: User.fromDto(dto.user), ); } diff --git a/lib/src/models/account.freezed.dart b/nakama/lib/src/models/account.freezed.dart similarity index 100% rename from lib/src/models/account.freezed.dart rename to nakama/lib/src/models/account.freezed.dart diff --git a/lib/src/models/account.g.dart b/nakama/lib/src/models/account.g.dart similarity index 100% rename from lib/src/models/account.g.dart rename to nakama/lib/src/models/account.g.dart diff --git a/lib/src/models/channel_message.dart b/nakama/lib/src/models/channel_message.dart similarity index 85% rename from lib/src/models/channel_message.dart rename to nakama/lib/src/models/channel_message.dart index ce752a9..5d46c7c 100644 --- a/lib/src/models/channel_message.dart +++ b/nakama/lib/src/models/channel_message.dart @@ -1,8 +1,8 @@ import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:nakama/src/api/api.dart' as api; -part 'channel_message.g.dart'; part 'channel_message.freezed.dart'; +part 'channel_message.g.dart'; @freezed class ChannelMessage with _$ChannelMessage { @@ -24,8 +24,7 @@ class ChannelMessage with _$ChannelMessage { required String userIdTwo, }) = _ChannelMessage; - factory ChannelMessage.fromJson(Map json) => - _$ChannelMessageFromJson(json); + factory ChannelMessage.fromJson(Map json) => _$ChannelMessageFromJson(json); factory ChannelMessage.fromDto(api.ChannelMessage dto) => ChannelMessage( channelId: dto.channelId, @@ -55,14 +54,10 @@ class ChannelMessageList with _$ChannelMessageList { required String cacheableCursor, }) = _ChannelMessageList; - factory ChannelMessageList.fromJson(Map json) => - _$ChannelMessageListFromJson(json); + factory ChannelMessageList.fromJson(Map json) => _$ChannelMessageListFromJson(json); - factory ChannelMessageList.fromDto(api.ChannelMessageList dto) => - ChannelMessageList( - messages: dto.messages - .map((e) => ChannelMessage.fromDto(e)) - .toList(growable: false), + factory ChannelMessageList.fromDto(api.ChannelMessageList dto) => ChannelMessageList( + messages: dto.messages.map((e) => ChannelMessage.fromDto(e)).toList(growable: false), nextCursor: dto.nextCursor, prevCursor: dto.prevCursor, cacheableCursor: dto.cacheableCursor, diff --git a/lib/src/models/channel_message.freezed.dart b/nakama/lib/src/models/channel_message.freezed.dart similarity index 100% rename from lib/src/models/channel_message.freezed.dart rename to nakama/lib/src/models/channel_message.freezed.dart diff --git a/lib/src/models/channel_message.g.dart b/nakama/lib/src/models/channel_message.g.dart similarity index 100% rename from lib/src/models/channel_message.g.dart rename to nakama/lib/src/models/channel_message.g.dart diff --git a/lib/src/models/chat.dart b/nakama/lib/src/models/chat.dart similarity index 95% rename from lib/src/models/chat.dart rename to nakama/lib/src/models/chat.dart index d87c330..7fbb1cd 100644 --- a/lib/src/models/chat.dart +++ b/nakama/lib/src/models/chat.dart @@ -37,9 +37,7 @@ class Channel with _$Channel { factory Channel.fromDto(rtpb.Channel dto) => Channel( id: dto.id, - presences: dto.presences - .map((e) => UserPresence.fromDto(e)) - .toList(growable: false), + presences: dto.presences.map((e) => UserPresence.fromDto(e)).toList(growable: false), self: UserPresence.fromDto(dto.self), roomName: dto.roomName, groupId: dto.groupId, @@ -89,8 +87,7 @@ class ChannelMessageAck with _$ChannelMessageAck { required String userIdTwo, }) = _ChannelMessageAck; - factory ChannelMessageAck.fromDto(rtpb.ChannelMessageAck dto) => - ChannelMessageAck( + factory ChannelMessageAck.fromDto(rtpb.ChannelMessageAck dto) => ChannelMessageAck( channelId: dto.channelId, messageId: dto.messageId, code: dto.code.value, diff --git a/lib/src/models/chat.freezed.dart b/nakama/lib/src/models/chat.freezed.dart similarity index 100% rename from lib/src/models/chat.freezed.dart rename to nakama/lib/src/models/chat.freezed.dart diff --git a/lib/src/models/friends.dart b/nakama/lib/src/models/friends.dart similarity index 92% rename from lib/src/models/friends.dart rename to nakama/lib/src/models/friends.dart index 5a25c05..d0ea190 100644 --- a/lib/src/models/friends.dart +++ b/nakama/lib/src/models/friends.dart @@ -15,8 +15,7 @@ class FriendsList with _$FriendsList { required List friends, }) = _FriendsList; - factory FriendsList.fromJson(Map json) => - _$FriendsListFromJson(json); + factory FriendsList.fromJson(Map json) => _$FriendsListFromJson(json); factory FriendsList.fromDto(api.FriendList dto) => FriendsList( cursor: dto.cursor, diff --git a/lib/src/models/friends.freezed.dart b/nakama/lib/src/models/friends.freezed.dart similarity index 100% rename from lib/src/models/friends.freezed.dart rename to nakama/lib/src/models/friends.freezed.dart diff --git a/lib/src/models/friends.g.dart b/nakama/lib/src/models/friends.g.dart similarity index 100% rename from lib/src/models/friends.g.dart rename to nakama/lib/src/models/friends.g.dart diff --git a/lib/src/models/group.dart b/nakama/lib/src/models/group.dart similarity index 80% rename from lib/src/models/group.dart rename to nakama/lib/src/models/group.dart index 50f88b6..c71ea51 100644 --- a/lib/src/models/group.dart +++ b/nakama/lib/src/models/group.dart @@ -52,8 +52,7 @@ class GroupList with _$GroupList { required List groups, }) = _GroupList; - factory GroupList.fromJson(Map json) => - _$GroupListFromJson(json); + factory GroupList.fromJson(Map json) => _$GroupListFromJson(json); factory GroupList.fromDto(api.GroupList dto) => GroupList( cursor: dto.cursor, @@ -70,14 +69,11 @@ class UserGroupList with _$UserGroupList { required List userGroups, }) = _UserGroupList; - factory UserGroupList.fromJson(Map json) => - _$UserGroupListFromJson(json); + factory UserGroupList.fromJson(Map json) => _$UserGroupListFromJson(json); factory UserGroupList.fromDto(api.UserGroupList dto) => UserGroupList( cursor: dto.cursor, - userGroups: dto.userGroups - .map((e) => UserGroup.fromDto(e)) - .toList(growable: false), + userGroups: dto.userGroups.map((e) => UserGroup.fromDto(e)).toList(growable: false), ); } @@ -90,8 +86,7 @@ class UserGroup with _$UserGroup { required Group group, }) = _UserGroup; - factory UserGroup.fromJson(Map json) => - _$UserGroupFromJson(json); + factory UserGroup.fromJson(Map json) => _$UserGroupFromJson(json); factory UserGroup.fromDto(api.UserGroupList_UserGroup dto) => UserGroup( group: Group.fromDto(dto.group), @@ -108,14 +103,11 @@ class GroupUserList with _$GroupUserList { required List groupUsers, }) = _GroupUserList; - factory GroupUserList.fromJson(Map json) => - _$GroupUserListFromJson(json); + factory GroupUserList.fromJson(Map json) => _$GroupUserListFromJson(json); factory GroupUserList.fromDto(api.GroupUserList dto) => GroupUserList( cursor: dto.cursor, - groupUsers: dto.groupUsers - .map((e) => GroupUser.fromDto(e)) - .toList(growable: false), + groupUsers: dto.groupUsers.map((e) => GroupUser.fromDto(e)).toList(growable: false), ); } @@ -128,8 +120,7 @@ class GroupUser with _$GroupUser { required User user, }) = _GroupUser; - factory GroupUser.fromJson(Map json) => - _$GroupUserFromJson(json); + factory GroupUser.fromJson(Map json) => _$GroupUserFromJson(json); factory GroupUser.fromDto(api.GroupUserList_GroupUser dto) => GroupUser( state: GroupMembershipState.values[dto.state.value], diff --git a/lib/src/models/group.freezed.dart b/nakama/lib/src/models/group.freezed.dart similarity index 100% rename from lib/src/models/group.freezed.dart rename to nakama/lib/src/models/group.freezed.dart diff --git a/lib/src/models/group.g.dart b/nakama/lib/src/models/group.g.dart similarity index 100% rename from lib/src/models/group.g.dart rename to nakama/lib/src/models/group.g.dart diff --git a/lib/src/models/leaderboard.dart b/nakama/lib/src/models/leaderboard.dart similarity index 73% rename from lib/src/models/leaderboard.dart rename to nakama/lib/src/models/leaderboard.dart index 970da39..f8f5b09 100644 --- a/lib/src/models/leaderboard.dart +++ b/nakama/lib/src/models/leaderboard.dart @@ -19,15 +19,11 @@ class LeaderboardRecordList with _$LeaderboardRecordList { String? prevCursor, }) = _LeaderboardRecordList; - factory LeaderboardRecordList.fromJson(Map json) => - _$LeaderboardRecordListFromJson(json); + factory LeaderboardRecordList.fromJson(Map json) => _$LeaderboardRecordListFromJson(json); - factory LeaderboardRecordList.fromDto(api.LeaderboardRecordList dto) => - LeaderboardRecordList( - records: - dto.ownerRecords.map((e) => LeaderboardRecord.fromDto(e)).toList(), - ownerRecords: - dto.ownerRecords.map((e) => LeaderboardRecord.fromDto(e)).toList(), + factory LeaderboardRecordList.fromDto(api.LeaderboardRecordList dto) => LeaderboardRecordList( + records: dto.ownerRecords.map((e) => LeaderboardRecord.fromDto(e)).toList(), + ownerRecords: dto.ownerRecords.map((e) => LeaderboardRecord.fromDto(e)).toList(), nextCursor: dto.nextCursor, prevCursor: dto.prevCursor, ); @@ -52,11 +48,9 @@ class LeaderboardRecord with _$LeaderboardRecord { @Default(0) int maxNumScore, }) = _LeaderboardRecord; - factory LeaderboardRecord.fromJson(Map json) => - _$LeaderboardRecordFromJson(json); + factory LeaderboardRecord.fromJson(Map json) => _$LeaderboardRecordFromJson(json); - factory LeaderboardRecord.fromDto(api.LeaderboardRecord dto) => - LeaderboardRecord( + factory LeaderboardRecord.fromDto(api.LeaderboardRecord dto) => LeaderboardRecord( leaderboardId: dto.leaderboardId, ownerId: dto.ownerId, username: dto.username.value, @@ -64,12 +58,9 @@ class LeaderboardRecord with _$LeaderboardRecord { subscore: dto.subscore.toInt(), numScore: dto.numScore.toInt(), metadata: dto.metadata, - createTime: - dto.createTime.hasNanos() ? dto.createTime.toDateTime() : null, - updateTime: - dto.updateTime.hasNanos() ? dto.updateTime.toDateTime() : null, - expiryTime: - dto.expiryTime.hasNanos() ? dto.expiryTime.toDateTime() : null, + createTime: dto.createTime.hasNanos() ? dto.createTime.toDateTime() : null, + updateTime: dto.updateTime.hasNanos() ? dto.updateTime.toDateTime() : null, + expiryTime: dto.expiryTime.hasNanos() ? dto.expiryTime.toDateTime() : null, rank: dto.rank.toInt(), maxNumScore: dto.maxNumScore.toInt(), ); diff --git a/lib/src/models/leaderboard.freezed.dart b/nakama/lib/src/models/leaderboard.freezed.dart similarity index 100% rename from lib/src/models/leaderboard.freezed.dart rename to nakama/lib/src/models/leaderboard.freezed.dart diff --git a/lib/src/models/leaderboard.g.dart b/nakama/lib/src/models/leaderboard.g.dart similarity index 100% rename from lib/src/models/leaderboard.g.dart rename to nakama/lib/src/models/leaderboard.g.dart diff --git a/lib/src/models/match.dart b/nakama/lib/src/models/match.dart similarity index 89% rename from lib/src/models/match.dart rename to nakama/lib/src/models/match.dart index 359899f..13390f3 100644 --- a/lib/src/models/match.dart +++ b/nakama/lib/src/models/match.dart @@ -3,8 +3,8 @@ import 'package:nakama/nakama.dart'; import 'package:nakama/src/api/api.dart' as api; import 'package:nakama/src/api/rtapi.dart' as rtpb; -part 'match.g.dart'; part 'match.freezed.dart'; +part 'match.g.dart'; @freezed class Match with _$Match { @@ -46,9 +46,7 @@ class Match with _$Match { authoritative: dto.authoritative, label: dto.label.value, size: dto.size, - presences: dto.presences - .map((e) => UserPresence.fromDto(e)) - .toList(growable: false), + presences: dto.presences.map((e) => UserPresence.fromDto(e)).toList(growable: false), ); } @@ -82,8 +80,6 @@ class Party with _$Party { maxSize: dto.maxSize, self: UserPresence.fromDto(dto.self), leader: UserPresence.fromDto(dto.leader), - presences: dto.presences - .map((e) => UserPresence.fromDto(e)) - .toList(growable: false), + presences: dto.presences.map((e) => UserPresence.fromDto(e)).toList(growable: false), ); } diff --git a/lib/src/models/match.freezed.dart b/nakama/lib/src/models/match.freezed.dart similarity index 100% rename from lib/src/models/match.freezed.dart rename to nakama/lib/src/models/match.freezed.dart diff --git a/lib/src/models/match.g.dart b/nakama/lib/src/models/match.g.dart similarity index 100% rename from lib/src/models/match.g.dart rename to nakama/lib/src/models/match.g.dart diff --git a/lib/src/models/matchmaker.dart b/nakama/lib/src/models/matchmaker.dart similarity index 86% rename from lib/src/models/matchmaker.dart rename to nakama/lib/src/models/matchmaker.dart index a586592..843dc3c 100644 --- a/lib/src/models/matchmaker.dart +++ b/nakama/lib/src/models/matchmaker.dart @@ -13,8 +13,7 @@ class MatchmakerTicket with _$MatchmakerTicket { required String ticket, }) = _MatchmakerTicket; - factory MatchmakerTicket.fromDto(rtpb.MatchmakerTicket dto) => - MatchmakerTicket( + factory MatchmakerTicket.fromDto(rtpb.MatchmakerTicket dto) => MatchmakerTicket( ticket: dto.ticket, ); } @@ -31,8 +30,7 @@ class PartyMatchmakerTicket with _$PartyMatchmakerTicket { required String ticket, }) = _PartyMatchmakerTicket; - factory PartyMatchmakerTicket.fromDto(rtpb.PartyMatchmakerTicket dto) => - PartyMatchmakerTicket( + factory PartyMatchmakerTicket.fromDto(rtpb.PartyMatchmakerTicket dto) => PartyMatchmakerTicket( partyId: dto.partyId, ticket: dto.ticket, ); @@ -69,17 +67,12 @@ class ChannelPresenceEvent with _$ChannelPresenceEvent { String? userIdTwo, }) = _ChannelPresenceEvent; - factory ChannelPresenceEvent.fromDto(rtpb.ChannelPresenceEvent dto) => - ChannelPresenceEvent( + factory ChannelPresenceEvent.fromDto(rtpb.ChannelPresenceEvent dto) => ChannelPresenceEvent( channelId: dto.channelId, roomName: dto.roomName, groupId: dto.groupId, - joins: dto.joins - .map((e) => UserPresence.fromDto(e)) - .toList(growable: false), - leaves: dto.leaves - .map((e) => UserPresence.fromDto(e)) - .toList(growable: false), + joins: dto.joins.map((e) => UserPresence.fromDto(e)).toList(growable: false), + leaves: dto.leaves.map((e) => UserPresence.fromDto(e)).toList(growable: false), userIdOne: dto.userIdOne, userIdTwo: dto.userIdTwo, ); @@ -103,8 +96,7 @@ class MatchmakerUser with _$MatchmakerUser { required Map numericProperties, }) = _MatchmakerUser; - factory MatchmakerUser.fromDto(rtpb.MatchmakerMatched_MatchmakerUser dto) => - MatchmakerUser( + factory MatchmakerUser.fromDto(rtpb.MatchmakerMatched_MatchmakerUser dto) => MatchmakerUser( presence: UserPresence.fromDto(dto.presence), partyId: dto.partyId, stringProperties: dto.stringProperties, @@ -133,14 +125,11 @@ class MatchmakerMatched with _$MatchmakerMatched { required MatchmakerUser self, }) = _MatchmakerMatched; - factory MatchmakerMatched.fromDto(rtpb.MatchmakerMatched dto) => - MatchmakerMatched( + factory MatchmakerMatched.fromDto(rtpb.MatchmakerMatched dto) => MatchmakerMatched( ticket: dto.ticket, matchId: dto.matchId, token: dto.token, - users: dto.users - .map((e) => MatchmakerUser.fromDto(e)) - .toList(growable: false), + users: dto.users.map((e) => MatchmakerUser.fromDto(e)).toList(growable: false), self: MatchmakerUser.fromDto(dto.self), ); } @@ -190,14 +179,9 @@ class MatchPresenceEvent with _$MatchPresenceEvent { required List leaves, }) = _MatchPresenceEvent; - factory MatchPresenceEvent.fromDto(rtpb.MatchPresenceEvent dto) => - MatchPresenceEvent( + factory MatchPresenceEvent.fromDto(rtpb.MatchPresenceEvent dto) => MatchPresenceEvent( matchId: dto.matchId, - joins: dto.joins - .map((e) => UserPresence.fromDto(e)) - .toList(growable: false), - leaves: dto.leaves - .map((e) => UserPresence.fromDto(e)) - .toList(growable: false), + joins: dto.joins.map((e) => UserPresence.fromDto(e)).toList(growable: false), + leaves: dto.leaves.map((e) => UserPresence.fromDto(e)).toList(growable: false), ); } diff --git a/lib/src/models/matchmaker.freezed.dart b/nakama/lib/src/models/matchmaker.freezed.dart similarity index 100% rename from lib/src/models/matchmaker.freezed.dart rename to nakama/lib/src/models/matchmaker.freezed.dart diff --git a/lib/src/models/notification.dart b/nakama/lib/src/models/notification.dart similarity index 75% rename from lib/src/models/notification.dart rename to nakama/lib/src/models/notification.dart index 5d6c66f..a3c9f6c 100644 --- a/lib/src/models/notification.dart +++ b/nakama/lib/src/models/notification.dart @@ -1,8 +1,8 @@ import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:nakama/src/api/api.dart' as api; -part 'notification.g.dart'; part 'notification.freezed.dart'; +part 'notification.g.dart'; @freezed class Notification with _$Notification { @@ -18,8 +18,7 @@ class Notification with _$Notification { required bool persistent, }) = _Notification; - factory Notification.fromJson(Map json) => - _$NotificationFromJson(json); + factory Notification.fromJson(Map json) => _$NotificationFromJson(json); factory Notification.fromDto(api.Notification dto) => Notification( id: dto.id, @@ -41,14 +40,10 @@ class NotificationList with _$NotificationList { required List notifications, }) = _NotificationList; - factory NotificationList.fromJson(Map json) => - _$NotificationListFromJson(json); + factory NotificationList.fromJson(Map json) => _$NotificationListFromJson(json); - factory NotificationList.fromDto(api.NotificationList dto) => - NotificationList( + factory NotificationList.fromDto(api.NotificationList dto) => NotificationList( cursor: dto.cacheableCursor, - notifications: dto.notifications - .map((e) => Notification.fromDto(e)) - .toList(growable: false), + notifications: dto.notifications.map((e) => Notification.fromDto(e)).toList(growable: false), ); } diff --git a/lib/src/models/notification.freezed.dart b/nakama/lib/src/models/notification.freezed.dart similarity index 100% rename from lib/src/models/notification.freezed.dart rename to nakama/lib/src/models/notification.freezed.dart diff --git a/lib/src/models/notification.g.dart b/nakama/lib/src/models/notification.g.dart similarity index 100% rename from lib/src/models/notification.g.dart rename to nakama/lib/src/models/notification.g.dart diff --git a/lib/src/models/party.dart b/nakama/lib/src/models/party.dart similarity index 100% rename from lib/src/models/party.dart rename to nakama/lib/src/models/party.dart diff --git a/lib/src/models/party.freezed.dart b/nakama/lib/src/models/party.freezed.dart similarity index 100% rename from lib/src/models/party.freezed.dart rename to nakama/lib/src/models/party.freezed.dart diff --git a/lib/src/models/rpc.dart b/nakama/lib/src/models/rpc.dart similarity index 100% rename from lib/src/models/rpc.dart rename to nakama/lib/src/models/rpc.dart diff --git a/lib/src/models/rpc.freezed.dart b/nakama/lib/src/models/rpc.freezed.dart similarity index 100% rename from lib/src/models/rpc.freezed.dart rename to nakama/lib/src/models/rpc.freezed.dart diff --git a/lib/src/models/session.dart b/nakama/lib/src/models/session.dart similarity index 90% rename from lib/src/models/session.dart rename to nakama/lib/src/models/session.dart index 24c1c9d..0a4738a 100644 --- a/lib/src/models/session.dart +++ b/nakama/lib/src/models/session.dart @@ -29,9 +29,7 @@ class Session with _$Session { token: session.token, refreshToken: session.refreshToken, created: session.created, - vars: token.containsKey('vars') - ? token['vars'] as Map? - : {}, + vars: token.containsKey('vars') ? token['vars'] as Map? : {}, userId: token['uid'] as String, expiresAt: DateTime.fromMillisecondsSinceEpoch( token['exp'] as int, @@ -52,9 +50,7 @@ class Session with _$Session { token: session.token!, refreshToken: session.refreshToken, created: session.created ?? false, - vars: token.containsKey('vars') - ? token['vars'] as Map? - : {}, + vars: token.containsKey('vars') ? token['vars'] as Map? : {}, userId: token['uid'] as String, expiresAt: DateTime.fromMillisecondsSinceEpoch( (token['exp'] as int) * 1000, diff --git a/lib/src/models/session.freezed.dart b/nakama/lib/src/models/session.freezed.dart similarity index 100% rename from lib/src/models/session.freezed.dart rename to nakama/lib/src/models/session.freezed.dart diff --git a/lib/src/models/status.dart b/nakama/lib/src/models/status.dart similarity index 84% rename from lib/src/models/status.dart rename to nakama/lib/src/models/status.dart index 2538cf0..ebb11f1 100644 --- a/lib/src/models/status.dart +++ b/nakama/lib/src/models/status.dart @@ -35,8 +35,7 @@ class UserPresence with _$UserPresence { status: dto.status.value.isNotEmpty ? dto.status.value : null, ); - factory UserPresence.fromJson(Map json) => - _$UserPresenceFromJson(json); + factory UserPresence.fromJson(Map json) => _$UserPresenceFromJson(json); } @freezed @@ -51,14 +50,9 @@ class StatusPresenceEvent with _$StatusPresenceEvent { required List leaves, }) = _StatusPresenceEvent; - factory StatusPresenceEvent.fromDto(rtpb.StatusPresenceEvent dto) => - StatusPresenceEvent( - joins: dto.joins - .map((e) => UserPresence.fromDto(e)) - .toList(growable: false), - leaves: dto.leaves - .map((e) => UserPresence.fromDto(e)) - .toList(growable: false), + factory StatusPresenceEvent.fromDto(rtpb.StatusPresenceEvent dto) => StatusPresenceEvent( + joins: dto.joins.map((e) => UserPresence.fromDto(e)).toList(growable: false), + leaves: dto.leaves.map((e) => UserPresence.fromDto(e)).toList(growable: false), ); } @@ -129,14 +123,9 @@ class StreamPresenceEvent with _$StreamPresenceEvent { required List leaves, }) = _StreamPresenceEvent; - factory StreamPresenceEvent.fromDto(rtpb.StreamPresenceEvent dto) => - StreamPresenceEvent( + factory StreamPresenceEvent.fromDto(rtpb.StreamPresenceEvent dto) => StreamPresenceEvent( stream: RealtimeStream.fromDto(dto.stream), - joins: dto.joins - .map((e) => UserPresence.fromDto(e)) - .toList(growable: false), - leaves: dto.leaves - .map((e) => UserPresence.fromDto(e)) - .toList(growable: false), + joins: dto.joins.map((e) => UserPresence.fromDto(e)).toList(growable: false), + leaves: dto.leaves.map((e) => UserPresence.fromDto(e)).toList(growable: false), ); } diff --git a/lib/src/models/status.freezed.dart b/nakama/lib/src/models/status.freezed.dart similarity index 100% rename from lib/src/models/status.freezed.dart rename to nakama/lib/src/models/status.freezed.dart diff --git a/lib/src/models/status.g.dart b/nakama/lib/src/models/status.g.dart similarity index 100% rename from lib/src/models/status.g.dart rename to nakama/lib/src/models/status.g.dart diff --git a/lib/src/models/storage.dart b/nakama/lib/src/models/storage.dart similarity index 83% rename from lib/src/models/storage.dart rename to nakama/lib/src/models/storage.dart index 78aca91..b245ea8 100644 --- a/lib/src/models/storage.dart +++ b/nakama/lib/src/models/storage.dart @@ -1,8 +1,8 @@ import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:nakama/src/api/api.dart' as api; -part 'storage.g.dart'; part 'storage.freezed.dart'; +part 'storage.g.dart'; @freezed class StorageObject with _$StorageObject { @@ -20,8 +20,7 @@ class StorageObject with _$StorageObject { DateTime? updateTime, }) = _StorageObject; - factory StorageObject.fromJson(Map json) => - _$StorageObjectFromJson(json); + factory StorageObject.fromJson(Map json) => _$StorageObjectFromJson(json); factory StorageObject.fromDto(api.StorageObject dto) => StorageObject( collection: dto.collection, @@ -45,15 +44,11 @@ class StorageObjectList with _$StorageObjectList { required List objects, }) = _StorageObjectList; - factory StorageObjectList.fromJson(Map json) => - _$StorageObjectListFromJson(json); + factory StorageObjectList.fromJson(Map json) => _$StorageObjectListFromJson(json); - factory StorageObjectList.fromDto(api.StorageObjectList dto) => - StorageObjectList( + factory StorageObjectList.fromDto(api.StorageObjectList dto) => StorageObjectList( cursor: dto.cursor, - objects: dto.objects - .map((e) => StorageObject.fromDto(e)) - .toList(growable: false), + objects: dto.objects.map((e) => StorageObject.fromDto(e)).toList(growable: false), ); } @@ -67,11 +62,9 @@ class StorageObjectId with _$StorageObjectId { String? version, }) = _StorageObjectId; - factory StorageObjectId.fromJson(Map json) => - _$StorageObjectIdFromJson(json); + factory StorageObjectId.fromJson(Map json) => _$StorageObjectIdFromJson(json); - factory StorageObjectId.fromDto(api.DeleteStorageObjectId dto) => - StorageObjectId( + factory StorageObjectId.fromDto(api.DeleteStorageObjectId dto) => StorageObjectId( collection: dto.collection, key: dto.key, version: dto.version, diff --git a/lib/src/models/storage.freezed.dart b/nakama/lib/src/models/storage.freezed.dart similarity index 100% rename from lib/src/models/storage.freezed.dart rename to nakama/lib/src/models/storage.freezed.dart diff --git a/lib/src/models/storage.g.dart b/nakama/lib/src/models/storage.g.dart similarity index 100% rename from lib/src/models/storage.g.dart rename to nakama/lib/src/models/storage.g.dart diff --git a/lib/src/models/tournament.dart b/nakama/lib/src/models/tournament.dart similarity index 75% rename from lib/src/models/tournament.dart rename to nakama/lib/src/models/tournament.dart index b6b3305..a68ae1d 100644 --- a/lib/src/models/tournament.dart +++ b/nakama/lib/src/models/tournament.dart @@ -2,8 +2,8 @@ import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:nakama/src/api/api.dart' as api; import 'package:nakama/src/models/leaderboard.dart'; -part 'tournament.g.dart'; part 'tournament.freezed.dart'; +part 'tournament.g.dart'; @freezed class Tournament with _$Tournament { @@ -30,15 +30,13 @@ class Tournament with _$Tournament { int? prevReset, }) = _Tournament; - factory Tournament.fromJson(Map json) => - _$TournamentFromJson(json); + factory Tournament.fromJson(Map json) => _$TournamentFromJson(json); factory Tournament.fromDto(api.Tournament dto) => Tournament( id: dto.id, canEnter: dto.canEnter, category: dto.category, - createTime: - dto.createTime.hasNanos() ? dto.createTime.toDateTime() : null, + createTime: dto.createTime.hasNanos() ? dto.createTime.toDateTime() : null, endTime: dto.endTime.hasNanos() ? dto.endTime.toDateTime() : null, startTime: dto.startTime.hasNanos() ? dto.startTime.toDateTime() : null, description: dto.description, @@ -65,13 +63,10 @@ class TournamentList with _$TournamentList { required List tournaments, }) = _TournamentList; - factory TournamentList.fromJson(Map json) => - _$TournamentListFromJson(json); + factory TournamentList.fromJson(Map json) => _$TournamentListFromJson(json); factory TournamentList.fromDto(api.TournamentList dto) => TournamentList( - tournaments: dto.tournaments - .map((e) => Tournament.fromDto(e)) - .toList(growable: false), + tournaments: dto.tournaments.map((e) => Tournament.fromDto(e)).toList(growable: false), cursor: dto.cursor, ); } @@ -87,17 +82,11 @@ class TournamentRecordList with _$TournamentRecordList { String? previousCursor, }) = _TournamentRecordList; - factory TournamentRecordList.fromJson(Map json) => - _$TournamentRecordListFromJson(json); + factory TournamentRecordList.fromJson(Map json) => _$TournamentRecordListFromJson(json); - factory TournamentRecordList.fromDto(api.TournamentRecordList dto) => - TournamentRecordList( - records: dto.records - .map((e) => LeaderboardRecord.fromDto(e)) - .toList(growable: false), - ownerRecords: dto.ownerRecords - .map((e) => LeaderboardRecord.fromDto(e)) - .toList(growable: false), + factory TournamentRecordList.fromDto(api.TournamentRecordList dto) => TournamentRecordList( + records: dto.records.map((e) => LeaderboardRecord.fromDto(e)).toList(growable: false), + ownerRecords: dto.ownerRecords.map((e) => LeaderboardRecord.fromDto(e)).toList(growable: false), nextCursor: dto.nextCursor, previousCursor: dto.prevCursor, ); diff --git a/lib/src/models/tournament.freezed.dart b/nakama/lib/src/models/tournament.freezed.dart similarity index 100% rename from lib/src/models/tournament.freezed.dart rename to nakama/lib/src/models/tournament.freezed.dart diff --git a/lib/src/models/tournament.g.dart b/nakama/lib/src/models/tournament.g.dart similarity index 100% rename from lib/src/models/tournament.g.dart rename to nakama/lib/src/models/tournament.g.dart diff --git a/lib/src/nakama_client/nakama_api_client.dart b/nakama/lib/src/nakama_client/nakama_api_client.dart similarity index 97% rename from lib/src/nakama_client/nakama_api_client.dart rename to nakama/lib/src/nakama_client/nakama_api_client.dart index fd64bd4..d2d95b6 100644 --- a/lib/src/nakama_client/nakama_api_client.dart +++ b/nakama/lib/src/nakama_client/nakama_api_client.dart @@ -676,14 +676,7 @@ class NakamaRestApiClient extends NakamaBaseClient { }) async { _session = session; - await _api.v2AccountPut( - body: ApiUpdateAccountRequest( - username: username, - displayName: displayName, - avatarUrl: avatarUrl, - langTag: langTag, - location: location, - timezone: timezone)); + await _api.v2AccountPut(body: ApiUpdateAccountRequest(username: username, displayName: displayName, avatarUrl: avatarUrl, langTag: langTag, location: location, timezone: timezone)); } @override @@ -700,9 +693,7 @@ class NakamaRestApiClient extends NakamaBaseClient { usernames: usernames, ); - return res.body!.users! - .map((e) => model.User.fromJson(e.toJson())) - .toList(growable: false); + return res.body!.users!.map((e) => model.User.fromJson(e.toJson())).toList(growable: false); } @override @@ -754,9 +745,7 @@ class NakamaRestApiClient extends NakamaBaseClient { ), ); - return res.body?.objects?.isEmpty != false - ? null - : model.StorageObject.fromJson(res.body!.objects!.first.toJson()); + return res.body?.objects?.isEmpty != false ? null : model.StorageObject.fromJson(res.body!.objects!.first.toJson()); } @override @@ -838,9 +827,7 @@ class NakamaRestApiClient extends NakamaBaseClient { ownerIds: ownerIds, limit: limit, cursor: cursor, - expiry: expiry == null - ? null - : (expiry.millisecondsSinceEpoch ~/ 1000).toString(), + expiry: expiry == null ? null : (expiry.millisecondsSinceEpoch ~/ 1000).toString(), ); return model.LeaderboardRecordList.fromJson(res.body!.toJson()); @@ -862,9 +849,7 @@ class NakamaRestApiClient extends NakamaBaseClient { leaderboardId: leaderboardName, ownerId: ownerId, limit: limit, - expiry: expiry == null - ? null - : (expiry.millisecondsSinceEpoch ~/ 1000).toString(), + expiry: expiry == null ? null : (expiry.millisecondsSinceEpoch ~/ 1000).toString(), ); return model.LeaderboardRecordList.fromJson(res.body!.toJson()); @@ -1219,9 +1204,7 @@ class NakamaRestApiClient extends NakamaBaseClient { query: query, ); - return res.body!.matches! - .map((e) => model.Match.fromJson(e.toJson())) - .toList(growable: false); + return res.body!.matches!.map((e) => model.Match.fromJson(e.toJson())).toList(growable: false); } @override @@ -1252,8 +1235,7 @@ class NakamaRestApiClient extends NakamaBaseClient { categoryStart: categoryStart, categoryEnd: categoryEnd, cursor: cursor, - startTime: - startTime != null ? startTime.millisecondsSinceEpoch ~/ 1000 : null, + startTime: startTime != null ? startTime.millisecondsSinceEpoch ~/ 1000 : null, endTime: endTime != null ? endTime.millisecondsSinceEpoch ~/ 1000 : null, limit: limit, ); diff --git a/lib/src/nakama_client/nakama_client.dart b/nakama/lib/src/nakama_client/nakama_client.dart similarity index 100% rename from lib/src/nakama_client/nakama_client.dart rename to nakama/lib/src/nakama_client/nakama_client.dart diff --git a/lib/src/nakama_client/nakama_grpc_client.dart b/nakama/lib/src/nakama_client/nakama_grpc_client.dart similarity index 96% rename from lib/src/nakama_client/nakama_grpc_client.dart rename to nakama/lib/src/nakama_client/nakama_grpc_client.dart index f8ac7c7..523ae4f 100644 --- a/lib/src/nakama_client/nakama_grpc_client.dart +++ b/nakama/lib/src/nakama_client/nakama_grpc_client.dart @@ -82,9 +82,7 @@ class NakamaGrpcClient extends NakamaBaseClient { host, port: port, options: ChannelOptions( - credentials: ssl == true - ? const ChannelCredentials.secure() - : const ChannelCredentials.insecure(), + credentials: ssl == true ? const ChannelCredentials.secure() : const ChannelCredentials.insecure(), ), ); @@ -691,8 +689,7 @@ class NakamaGrpcClient extends NakamaBaseClient { await _client.updateAccount( api.UpdateAccountRequest( username: username == null ? null : api.StringValue(value: username), - displayName: - displayName == null ? null : api.StringValue(value: displayName), + displayName: displayName == null ? null : api.StringValue(value: displayName), avatarUrl: avatarUrl == null ? null : api.StringValue(value: avatarUrl), langTag: langTag == null ? null : api.StringValue(value: langTag), location: location == null ? null : api.StringValue(value: location), @@ -739,12 +736,8 @@ class NakamaGrpcClient extends NakamaBaseClient { key: key, value: value, version: version, - permissionWrite: writePermission != null - ? api.Int32Value(value: writePermission.index) - : null, - permissionRead: readPermission != null - ? api.Int32Value(value: readPermission.index) - : null, + permissionWrite: writePermission != null ? api.Int32Value(value: writePermission.index) : null, + permissionRead: readPermission != null ? api.Int32Value(value: readPermission.index) : null, ), ], ), @@ -772,9 +765,7 @@ class NakamaGrpcClient extends NakamaBaseClient { options: _getSessionCallOptions(session), ); - return res.objects.isEmpty - ? null - : model.StorageObject.fromDto(res.objects.first); + return res.objects.isEmpty ? null : model.StorageObject.fromDto(res.objects.first); } @override @@ -855,10 +846,7 @@ class NakamaGrpcClient extends NakamaBaseClient { ownerIds: ownerIds, limit: api.Int32Value(value: limit), cursor: cursor, - expiry: expiry == null - ? null - : api.Int64Value( - value: Int64(expiry.millisecondsSinceEpoch ~/ 1000)), + expiry: expiry == null ? null : api.Int64Value(value: Int64(expiry.millisecondsSinceEpoch ~/ 1000)), ), options: _getSessionCallOptions(session), ); @@ -881,10 +869,7 @@ class NakamaGrpcClient extends NakamaBaseClient { leaderboardId: leaderboardName, ownerId: ownerId, limit: api.UInt32Value(value: limit), - expiry: expiry == null - ? null - : api.Int64Value( - value: Int64(expiry.millisecondsSinceEpoch ~/ 1000)), + expiry: expiry == null ? null : api.Int64Value(value: Int64(expiry.millisecondsSinceEpoch ~/ 1000)), ), options: _getSessionCallOptions(session), ); @@ -1270,9 +1255,7 @@ class NakamaGrpcClient extends NakamaBaseClient { options: _getSessionCallOptions(session), ); - return res.matches - .map((e) => model.Match.fromDto(e)) - .toList(growable: false); + return res.matches.map((e) => model.Match.fromDto(e)).toList(growable: false); } @override @@ -1303,14 +1286,8 @@ class NakamaGrpcClient extends NakamaBaseClient { categoryEnd: api.UInt32Value(value: categoryEnd), categoryStart: api.UInt32Value(value: categoryStart), cursor: cursor, - startTime: api.UInt32Value( - value: startTime != null - ? startTime.millisecondsSinceEpoch ~/ 1000 - : null), - endTime: api.UInt32Value( - value: endTime != null - ? endTime.millisecondsSinceEpoch ~/ 1000 - : null), + startTime: api.UInt32Value(value: startTime != null ? startTime.millisecondsSinceEpoch ~/ 1000 : null), + endTime: api.UInt32Value(value: endTime != null ? endTime.millisecondsSinceEpoch ~/ 1000 : null), limit: api.Int32Value(value: limit), ), options: _getSessionCallOptions(session), diff --git a/lib/src/nakama_client/stub/api_client.dart b/nakama/lib/src/nakama_client/stub/api_client.dart similarity index 100% rename from lib/src/nakama_client/stub/api_client.dart rename to nakama/lib/src/nakama_client/stub/api_client.dart diff --git a/lib/src/nakama_client/stub/grpc_client.dart b/nakama/lib/src/nakama_client/stub/grpc_client.dart similarity index 100% rename from lib/src/nakama_client/stub/grpc_client.dart rename to nakama/lib/src/nakama_client/stub/grpc_client.dart diff --git a/lib/src/nakama_client/stub/nakama_client_stub.dart b/nakama/lib/src/nakama_client/stub/nakama_client_stub.dart similarity index 100% rename from lib/src/nakama_client/stub/nakama_client_stub.dart rename to nakama/lib/src/nakama_client/stub/nakama_client_stub.dart diff --git a/lib/src/nakama_websocket_client.dart b/nakama/lib/src/nakama_websocket_client.dart similarity index 82% rename from lib/src/nakama_websocket_client.dart rename to nakama/lib/src/nakama_websocket_client.dart index 4e04f0c..426b24b 100644 --- a/lib/src/nakama_websocket_client.dart +++ b/nakama/lib/src/nakama_websocket_client.dart @@ -26,17 +26,13 @@ class NakamaWebsocketClient { late final WebSocketChannel _channel; - final _onChannelPresenceController = - StreamController.broadcast(); + final _onChannelPresenceController = StreamController.broadcast(); - Stream get onChannelPresence => - _onChannelPresenceController.stream; + Stream get onChannelPresence => _onChannelPresenceController.stream; - final _onMatchmakerMatchedController = - StreamController.broadcast(); + final _onMatchmakerMatchedController = StreamController.broadcast(); - Stream get onMatchmakerMatched => - _onMatchmakerMatchedController.stream; + Stream get onMatchmakerMatched => _onMatchmakerMatchedController.stream; final _onMatchDataController = StreamController.broadcast(); @@ -46,38 +42,29 @@ class NakamaWebsocketClient { Stream get onPartyData => _onPartyDataController.stream; - final _onMatchPresenceController = - StreamController.broadcast(); + final _onMatchPresenceController = StreamController.broadcast(); - Stream get onMatchPresence => - _onMatchPresenceController.stream; + Stream get onMatchPresence => _onMatchPresenceController.stream; final _onNotificationsController = StreamController.broadcast(); Stream get onNotifications => _onNotificationsController.stream; - final _onStatusPresenceController = - StreamController.broadcast(); + final _onStatusPresenceController = StreamController.broadcast(); - Stream get onStatusPresence => - _onStatusPresenceController.stream; + Stream get onStatusPresence => _onStatusPresenceController.stream; - final _onStreamPresenceController = - StreamController.broadcast(); + final _onStreamPresenceController = StreamController.broadcast(); - Stream get onStreamPresence => - _onStreamPresenceController.stream; + Stream get onStreamPresence => _onStreamPresenceController.stream; - final _onStreamDataController = - StreamController.broadcast(); + final _onStreamDataController = StreamController.broadcast(); Stream get onStreamData => _onStreamDataController.stream; - final _onChannelMessageController = - StreamController.broadcast(); + final _onChannelMessageController = StreamController.broadcast(); - Stream get onChannelMessage => - _onChannelMessageController.stream; + Stream get onChannelMessage => _onChannelMessageController.stream; final List _futures = []; @@ -208,38 +195,26 @@ class NakamaWebsocketClient { // map server messages switch (receivedEnvelope.whichMessage()) { case rtpb.Envelope_Message.channelPresenceEvent: - return _onChannelPresenceController.add( - ChannelPresenceEvent.fromDto( - receivedEnvelope.channelPresenceEvent)); + return _onChannelPresenceController.add(ChannelPresenceEvent.fromDto(receivedEnvelope.channelPresenceEvent)); case rtpb.Envelope_Message.matchmakerMatched: - return _onMatchmakerMatchedController.add( - MatchmakerMatched.fromDto(receivedEnvelope.matchmakerMatched)); + return _onMatchmakerMatchedController.add(MatchmakerMatched.fromDto(receivedEnvelope.matchmakerMatched)); case rtpb.Envelope_Message.matchData: - return _onMatchDataController - .add(MatchData.fromDto(receivedEnvelope.matchData)); + return _onMatchDataController.add(MatchData.fromDto(receivedEnvelope.matchData)); case rtpb.Envelope_Message.partyData: - return _onPartyDataController - .add(PartyData.fromDto(receivedEnvelope.partyData)); + return _onPartyDataController.add(PartyData.fromDto(receivedEnvelope.partyData)); case rtpb.Envelope_Message.matchPresenceEvent: - return _onMatchPresenceController.add(MatchPresenceEvent.fromDto( - receivedEnvelope.matchPresenceEvent)); + return _onMatchPresenceController.add(MatchPresenceEvent.fromDto(receivedEnvelope.matchPresenceEvent)); case rtpb.Envelope_Message.notifications: - receivedEnvelope.notifications.notifications - .map((e) => Notification.fromDto(e)) - .forEach((element) => _onNotificationsController.add(element)); + receivedEnvelope.notifications.notifications.map((e) => Notification.fromDto(e)).forEach((element) => _onNotificationsController.add(element)); return; case rtpb.Envelope_Message.statusPresenceEvent: - return _onStatusPresenceController.add(StatusPresenceEvent.fromDto( - receivedEnvelope.statusPresenceEvent)); + return _onStatusPresenceController.add(StatusPresenceEvent.fromDto(receivedEnvelope.statusPresenceEvent)); case rtpb.Envelope_Message.streamPresenceEvent: - return _onStreamPresenceController.add(StreamPresenceEvent.fromDto( - receivedEnvelope.streamPresenceEvent)); + return _onStreamPresenceController.add(StreamPresenceEvent.fromDto(receivedEnvelope.streamPresenceEvent)); case rtpb.Envelope_Message.streamData: - return _onStreamDataController - .add(RealtimeStreamData.fromDto(receivedEnvelope.streamData)); + return _onStreamDataController.add(RealtimeStreamData.fromDto(receivedEnvelope.streamData)); case rtpb.Envelope_Message.channelMessage: - return _onChannelMessageController - .add(receivedEnvelope.channelMessage); + return _onChannelMessageController.add(receivedEnvelope.channelMessage); default: return _log.warning('Not implemented'); } @@ -262,8 +237,7 @@ class NakamaWebsocketClient { return _futures.length - 1; } - Future updateStatus(String status) => _send(rtpb.Envelope( - statusUpdate: rtpb.StatusUpdate(status: api.StringValue(value: status)))); + Future updateStatus(String status) => _send(rtpb.Envelope(statusUpdate: rtpb.StatusUpdate(status: api.StringValue(value: status)))); Future createMatch([String? name]) async { final res = await _send( @@ -288,8 +262,7 @@ class NakamaWebsocketClient { } Future joinParty(String partyId) async { - final res = await _send( - rtpb.Envelope(partyJoin: rtpb.PartyJoin(partyId: partyId))); + final res = await _send(rtpb.Envelope(partyJoin: rtpb.PartyJoin(partyId: partyId))); return Party.fromDto(res); } @@ -336,8 +309,7 @@ class NakamaWebsocketClient { String matchId, { String? token, }) async { - final res = await _send(rtpb.Envelope( - matchJoin: rtpb.MatchJoin(matchId: matchId, token: token))); + final res = await _send(rtpb.Envelope(matchJoin: rtpb.MatchJoin(matchId: matchId, token: token))); return Match.fromRtpb(res); } diff --git a/lib/src/rest/apigrpc.enums.swagger.dart b/nakama/lib/src/rest/apigrpc.enums.swagger.dart similarity index 100% rename from lib/src/rest/apigrpc.enums.swagger.dart rename to nakama/lib/src/rest/apigrpc.enums.swagger.dart diff --git a/lib/src/rest/apigrpc.swagger.chopper.dart b/nakama/lib/src/rest/apigrpc.swagger.chopper.dart similarity index 100% rename from lib/src/rest/apigrpc.swagger.chopper.dart rename to nakama/lib/src/rest/apigrpc.swagger.chopper.dart diff --git a/lib/src/rest/apigrpc.swagger.dart b/nakama/lib/src/rest/apigrpc.swagger.dart similarity index 100% rename from lib/src/rest/apigrpc.swagger.dart rename to nakama/lib/src/rest/apigrpc.swagger.dart diff --git a/lib/src/rest/apigrpc.swagger.g.dart b/nakama/lib/src/rest/apigrpc.swagger.g.dart similarity index 100% rename from lib/src/rest/apigrpc.swagger.g.dart rename to nakama/lib/src/rest/apigrpc.swagger.g.dart diff --git a/lib/src/rest/client_index.dart b/nakama/lib/src/rest/client_index.dart similarity index 100% rename from lib/src/rest/client_index.dart rename to nakama/lib/src/rest/client_index.dart diff --git a/lib/satori/lib/src/rest/client_mapping.dart b/nakama/lib/src/rest/client_mapping.dart similarity index 100% rename from lib/satori/lib/src/rest/client_mapping.dart rename to nakama/lib/src/rest/client_mapping.dart diff --git a/lib/swaggers/apigrpc.swagger b/nakama/lib/swaggers/apigrpc.swagger similarity index 100% rename from lib/swaggers/apigrpc.swagger rename to nakama/lib/swaggers/apigrpc.swagger diff --git a/pubspec.lock b/nakama/pubspec.lock similarity index 100% rename from pubspec.lock rename to nakama/pubspec.lock diff --git a/pubspec.yaml b/nakama/pubspec.yaml similarity index 100% rename from pubspec.yaml rename to nakama/pubspec.yaml diff --git a/test/config.dart b/nakama/test/config.dart similarity index 100% rename from test/config.dart rename to nakama/test/config.dart diff --git a/test/grpc/account_test.dart b/nakama/test/grpc/account_test.dart similarity index 100% rename from test/grpc/account_test.dart rename to nakama/test/grpc/account_test.dart diff --git a/test/grpc/authentication_test.dart b/nakama/test/grpc/authentication_test.dart similarity index 100% rename from test/grpc/authentication_test.dart rename to nakama/test/grpc/authentication_test.dart diff --git a/test/grpc/group_test.dart b/nakama/test/grpc/group_test.dart similarity index 100% rename from test/grpc/group_test.dart rename to nakama/test/grpc/group_test.dart diff --git a/test/grpc/leaderboard_test.dart b/nakama/test/grpc/leaderboard_test.dart similarity index 88% rename from test/grpc/leaderboard_test.dart rename to nakama/test/grpc/leaderboard_test.dart index 8515ac8..93ce0f7 100644 --- a/test/grpc/leaderboard_test.dart +++ b/nakama/test/grpc/leaderboard_test.dart @@ -30,8 +30,7 @@ void main() { }); test('write leaderboard record', () async { - final result = await client.writeLeaderboardRecord( - session: session, leaderboardName: 'test', score: 10); + final result = await client.writeLeaderboardRecord(session: session, leaderboardName: 'test', score: 10); expect(result, isA()); expect(result.score, isNotNull); diff --git a/test/grpc/storage_test.dart b/nakama/test/grpc/storage_test.dart similarity index 100% rename from test/grpc/storage_test.dart rename to nakama/test/grpc/storage_test.dart diff --git a/test/integrity_test.dart b/nakama/test/integrity_test.dart similarity index 100% rename from test/integrity_test.dart rename to nakama/test/integrity_test.dart diff --git a/test/rest/account_test.dart b/nakama/test/rest/account_test.dart similarity index 100% rename from test/rest/account_test.dart rename to nakama/test/rest/account_test.dart diff --git a/test/rest/authentication_test.dart b/nakama/test/rest/authentication_test.dart similarity index 100% rename from test/rest/authentication_test.dart rename to nakama/test/rest/authentication_test.dart diff --git a/test/rest/group_test.dart b/nakama/test/rest/group_test.dart similarity index 100% rename from test/rest/group_test.dart rename to nakama/test/rest/group_test.dart diff --git a/test/rest/leaderboard_test.dart b/nakama/test/rest/leaderboard_test.dart similarity index 88% rename from test/rest/leaderboard_test.dart rename to nakama/test/rest/leaderboard_test.dart index c03b19f..4a0de09 100644 --- a/test/rest/leaderboard_test.dart +++ b/nakama/test/rest/leaderboard_test.dart @@ -29,8 +29,7 @@ void main() { }); test('write leaderboard record', () async { - final result = await client.writeLeaderboardRecord( - session: session, leaderboardName: 'test', score: 10); + final result = await client.writeLeaderboardRecord(session: session, leaderboardName: 'test', score: 10); expect(result, isA()); expect(result.score, isNotNull); diff --git a/test/rest/storage_test.dart b/nakama/test/rest/storage_test.dart similarity index 100% rename from test/rest/storage_test.dart rename to nakama/test/rest/storage_test.dart diff --git a/test/rt/chat_test.dart b/nakama/test/rt/chat_test.dart similarity index 97% rename from test/rt/chat_test.dart rename to nakama/test/rt/chat_test.dart index 57b1b48..f750a1c 100644 --- a/test/rt/chat_test.dart +++ b/nakama/test/rt/chat_test.dart @@ -196,8 +196,7 @@ void main() { ); // Send 40 test messages - for (final msg - in List.generate(40, (index) => {'message': 'PING $index'})) { + for (final msg in List.generate(40, (index) => {'message': 'PING $index'})) { await a.sendMessage(channelId: senderChannelForA.id, content: msg); } @@ -230,8 +229,7 @@ void main() { ); // Send 40 test messages - for (final msg - in List.generate(40, (index) => {'message': 'PING $index'})) { + for (final msg in List.generate(40, (index) => {'message': 'PING $index'})) { await a.sendMessage(channelId: senderChannelForA.id, content: msg); } @@ -265,8 +263,7 @@ void main() { ); // Send 40 test messages - for (final msg - in List.generate(40, (index) => {'message': 'PING $index'})) { + for (final msg in List.generate(40, (index) => {'message': 'PING $index'})) { await a.sendMessage(channelId: senderChannelForA.id, content: msg); } @@ -300,8 +297,7 @@ void main() { ); // Send 20+15 test messages - for (final msg - in List.generate(20 + 15, (index) => {'message': 'PING $index'})) { + for (final msg in List.generate(20 + 15, (index) => {'message': 'PING $index'})) { await a.sendMessage(channelId: senderChannelForA.id, content: msg); } diff --git a/test/rt/match_test.dart b/nakama/test/rt/match_test.dart similarity index 96% rename from test/rt/match_test.dart rename to nakama/test/rt/match_test.dart index 72317bd..7cd4e7f 100644 --- a/test/rt/match_test.dart +++ b/nakama/test/rt/match_test.dart @@ -106,10 +106,7 @@ void main() { }, count: 1)); // A creates match, B joins - await a - .createMatch() - .then((value) => b.joinMatch(value.matchId)) - .then((value) { + await a.createMatch().then((value) => b.joinMatch(value.matchId)).then((value) { a.sendMatchData( matchId: value.matchId, opCode: Int64(0), diff --git a/test/rt/status_test.dart b/nakama/test/rt/status_test.dart similarity index 100% rename from test/rt/status_test.dart rename to nakama/test/rt/status_test.dart diff --git a/tool/build-protobuf.sh b/nakama/tool/build-protobuf.sh similarity index 100% rename from tool/build-protobuf.sh rename to nakama/tool/build-protobuf.sh diff --git a/tool/nakama_server/docker-compose.yml b/nakama/tool/nakama_server/docker-compose.yml similarity index 100% rename from tool/nakama_server/docker-compose.yml rename to nakama/tool/nakama_server/docker-compose.yml diff --git a/tool/nakama_server/modules/main.lua b/nakama/tool/nakama_server/modules/main.lua similarity index 100% rename from tool/nakama_server/modules/main.lua rename to nakama/tool/nakama_server/modules/main.lua diff --git a/lib/satori/CHANGELOG.md b/satori/CHANGELOG.md similarity index 100% rename from lib/satori/CHANGELOG.md rename to satori/CHANGELOG.md diff --git a/lib/satori/LICENSE b/satori/LICENSE similarity index 100% rename from lib/satori/LICENSE rename to satori/LICENSE diff --git a/satori/README.md b/satori/README.md new file mode 100644 index 0000000..0610507 --- /dev/null +++ b/satori/README.md @@ -0,0 +1,61 @@ +# Satori Dart/Flutter Client + +Satori is a liveops server for games that powers actionable analytics, A/B testing and remote configuration. Use the Satori Dart Client to communicate with Satori from within your Dart game. + +Full documentation is online - https://heroiclabs.com/docs/satori/client-libraries/dart/index.html + +## Getting Started + +In your dart project add the dependency in `pubspec.yaml`: + +```yaml +dependencies: + ... + satori: ^1.0.0 +``` + +To use Satori within your dart app you need to import the Satori package: + +```dart +import 'package:satori/satori.dart'; +``` + +Now to start using Satori, create a client object that accepts the API key you were given as a Satori customer. + +```dart +final client = getSatoriClient( + host: '127.0.0.1', + port: 7450, + ssl: false, + apiKey: 'apikey', +); +``` + +Then authenticate with the server to obtain your session. + +```dart +// Authenticate with the Satori server. +try { + final session = await _satoriClient.authenticate(id: 'your-id'); + print('Authenticated successfully: $session'); +} catch (error) { + print('Authentication failed $error'); +} +``` + +Using the client you can get any experiments or feature flags the user belongs to. + +```dart +final experiments = await _satoriClient.getExperiments(session: session, names: ['experiment1', 'Experiment2']); +final flag = await _satoriClient.getFlag(session: session, name: 'FlagName'); +``` + +You can also send arbitrary events to the server: + +```dart +final event = Event( + name: 'gameLaunched', + value: jsonEncode({'gameId': 'id-1234'}), +); +await _satoriClient.event(session: session, event: event); +``` \ No newline at end of file diff --git a/lib/satori/build.yaml b/satori/build.yaml similarity index 100% rename from lib/satori/build.yaml rename to satori/build.yaml diff --git a/lib/satori/lib/satori.dart b/satori/lib/satori.dart similarity index 100% rename from lib/satori/lib/satori.dart rename to satori/lib/satori.dart diff --git a/lib/satori/lib/src/models/event.dart b/satori/lib/src/models/event.dart similarity index 100% rename from lib/satori/lib/src/models/event.dart rename to satori/lib/src/models/event.dart diff --git a/lib/satori/lib/src/models/event.freezed.dart b/satori/lib/src/models/event.freezed.dart similarity index 100% rename from lib/satori/lib/src/models/event.freezed.dart rename to satori/lib/src/models/event.freezed.dart diff --git a/lib/satori/lib/src/models/event.g.dart b/satori/lib/src/models/event.g.dart similarity index 100% rename from lib/satori/lib/src/models/event.g.dart rename to satori/lib/src/models/event.g.dart diff --git a/lib/satori/lib/src/models/experiment.dart b/satori/lib/src/models/experiment.dart similarity index 100% rename from lib/satori/lib/src/models/experiment.dart rename to satori/lib/src/models/experiment.dart diff --git a/lib/satori/lib/src/models/experiment.freezed.dart b/satori/lib/src/models/experiment.freezed.dart similarity index 100% rename from lib/satori/lib/src/models/experiment.freezed.dart rename to satori/lib/src/models/experiment.freezed.dart diff --git a/lib/satori/lib/src/models/experiment.g.dart b/satori/lib/src/models/experiment.g.dart similarity index 100% rename from lib/satori/lib/src/models/experiment.g.dart rename to satori/lib/src/models/experiment.g.dart diff --git a/lib/satori/lib/src/models/flag.dart b/satori/lib/src/models/flag.dart similarity index 100% rename from lib/satori/lib/src/models/flag.dart rename to satori/lib/src/models/flag.dart diff --git a/lib/satori/lib/src/models/flag.freezed.dart b/satori/lib/src/models/flag.freezed.dart similarity index 100% rename from lib/satori/lib/src/models/flag.freezed.dart rename to satori/lib/src/models/flag.freezed.dart diff --git a/lib/satori/lib/src/models/flag.g.dart b/satori/lib/src/models/flag.g.dart similarity index 100% rename from lib/satori/lib/src/models/flag.g.dart rename to satori/lib/src/models/flag.g.dart diff --git a/lib/satori/lib/src/models/live_event.dart b/satori/lib/src/models/live_event.dart similarity index 100% rename from lib/satori/lib/src/models/live_event.dart rename to satori/lib/src/models/live_event.dart diff --git a/lib/satori/lib/src/models/live_event.freezed.dart b/satori/lib/src/models/live_event.freezed.dart similarity index 100% rename from lib/satori/lib/src/models/live_event.freezed.dart rename to satori/lib/src/models/live_event.freezed.dart diff --git a/lib/satori/lib/src/models/live_event.g.dart b/satori/lib/src/models/live_event.g.dart similarity index 100% rename from lib/satori/lib/src/models/live_event.g.dart rename to satori/lib/src/models/live_event.g.dart diff --git a/lib/satori/lib/src/models/properties.dart b/satori/lib/src/models/properties.dart similarity index 100% rename from lib/satori/lib/src/models/properties.dart rename to satori/lib/src/models/properties.dart diff --git a/lib/satori/lib/src/models/properties.freezed.dart b/satori/lib/src/models/properties.freezed.dart similarity index 100% rename from lib/satori/lib/src/models/properties.freezed.dart rename to satori/lib/src/models/properties.freezed.dart diff --git a/lib/satori/lib/src/models/properties.g.dart b/satori/lib/src/models/properties.g.dart similarity index 100% rename from lib/satori/lib/src/models/properties.g.dart rename to satori/lib/src/models/properties.g.dart diff --git a/lib/satori/lib/src/models/session.dart b/satori/lib/src/models/session.dart similarity index 100% rename from lib/satori/lib/src/models/session.dart rename to satori/lib/src/models/session.dart diff --git a/lib/satori/lib/src/models/session.freezed.dart b/satori/lib/src/models/session.freezed.dart similarity index 100% rename from lib/satori/lib/src/models/session.freezed.dart rename to satori/lib/src/models/session.freezed.dart diff --git a/lib/satori/lib/src/rest/client_index.dart b/satori/lib/src/rest/client_index.dart similarity index 100% rename from lib/satori/lib/src/rest/client_index.dart rename to satori/lib/src/rest/client_index.dart diff --git a/lib/src/rest/client_mapping.dart b/satori/lib/src/rest/client_mapping.dart similarity index 100% rename from lib/src/rest/client_mapping.dart rename to satori/lib/src/rest/client_mapping.dart diff --git a/lib/satori/lib/src/rest/satori.swagger.chopper.dart b/satori/lib/src/rest/satori.swagger.chopper.dart similarity index 100% rename from lib/satori/lib/src/rest/satori.swagger.chopper.dart rename to satori/lib/src/rest/satori.swagger.chopper.dart diff --git a/lib/satori/lib/src/rest/satori.swagger.dart b/satori/lib/src/rest/satori.swagger.dart similarity index 100% rename from lib/satori/lib/src/rest/satori.swagger.dart rename to satori/lib/src/rest/satori.swagger.dart diff --git a/lib/satori/lib/src/rest/satori.swagger.g.dart b/satori/lib/src/rest/satori.swagger.g.dart similarity index 100% rename from lib/satori/lib/src/rest/satori.swagger.g.dart rename to satori/lib/src/rest/satori.swagger.g.dart diff --git a/lib/satori/lib/src/satori_client/satori_api_client.dart b/satori/lib/src/satori_client/satori_api_client.dart similarity index 100% rename from lib/satori/lib/src/satori_client/satori_api_client.dart rename to satori/lib/src/satori_client/satori_api_client.dart diff --git a/lib/satori/lib/src/satori_client/satori_client.dart b/satori/lib/src/satori_client/satori_client.dart similarity index 100% rename from lib/satori/lib/src/satori_client/satori_client.dart rename to satori/lib/src/satori_client/satori_client.dart diff --git a/lib/satori/lib/src/satori_client/stub/api_client.dart b/satori/lib/src/satori_client/stub/api_client.dart similarity index 100% rename from lib/satori/lib/src/satori_client/stub/api_client.dart rename to satori/lib/src/satori_client/stub/api_client.dart diff --git a/lib/satori/lib/src/satori_client/stub/satori_client_stub.dart b/satori/lib/src/satori_client/stub/satori_client_stub.dart similarity index 100% rename from lib/satori/lib/src/satori_client/stub/satori_client_stub.dart rename to satori/lib/src/satori_client/stub/satori_client_stub.dart diff --git a/lib/satori/pubspec.lock b/satori/pubspec.lock similarity index 100% rename from lib/satori/pubspec.lock rename to satori/pubspec.lock diff --git a/lib/satori/pubspec.yaml b/satori/pubspec.yaml similarity index 100% rename from lib/satori/pubspec.yaml rename to satori/pubspec.yaml diff --git a/lib/satori/test/client_test.dart b/satori/test/client_test.dart similarity index 100% rename from lib/satori/test/client_test.dart rename to satori/test/client_test.dart diff --git a/lib/satori/test/identify_test.dart b/satori/test/identify_test.dart similarity index 100% rename from lib/satori/test/identify_test.dart rename to satori/test/identify_test.dart diff --git a/lib/satori/test/session_test.dart b/satori/test/session_test.dart similarity index 100% rename from lib/satori/test/session_test.dart rename to satori/test/session_test.dart