joinNetwork method
Joins networkId with password (and optional displayName).
POST /api/networks/{id}/join with body
{password, displayName?}; expects 200.
Implementation
Future<FanetJoinResult> joinNetwork(
String networkId, {
required String password,
String? displayName,
}) async {
final response = await _client.post(
_uri('/api/networks/${Uri.encodeComponent(networkId)}/join'),
headers: {'content-type': 'application/json'},
body: jsonEncode({'password': password, 'displayName': ?displayName}),
);
_expectStatus(response, const {200}, 'joinNetwork($networkId)');
return FanetJoinResult.fromJson(_jsonObject(response));
}