using System; using System.Collections.Generic; using UnityEngine.Scripting; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using Unity.Services.Lobbies.Http; namespace Unity.Services.Lobbies.Models { /// /// The body of an Update Lobby request. /// The name of the lobby that should be displayed to users. All whitespace will be trimmed from name. /// The maximum number of players allowed in the lobby. Must be greater than or equal to the current number of players in the lobby. /// Indicates whether or not the lobby is publicly visible and will show up in query results. If the lobby is not publicly visible, the creator can share the `lobbyCode` with other users who can use it to join this lobby. /// Custom game-specific properties to add, update, or remove from the lobby (e.g. `mapName` or `gameType`). To remove an existing property, include it in `data` but set the property object to `null`. To update the value to `null`, set the `value` property of the object to `null`. /// The id of the player to make the host of the lobby. As soon as this is updated the current host will no longer have permission to modify the lobby. /// [Preserve] [DataContract(Name = "UpdateRequest")] public class UpdateRequest { /// /// The body of an Update Lobby request. /// /// The name of the lobby that should be displayed to users. All whitespace will be trimmed from name. /// The maximum number of players allowed in the lobby. Must be greater than or equal to the current number of players in the lobby. /// Indicates whether or not the lobby is publicly visible and will show up in query results. If the lobby is not publicly visible, the creator can share the `lobbyCode` with other users who can use it to join this lobby. /// Custom game-specific properties to add, update, or remove from the lobby (e.g. `mapName` or `gameType`). To remove an existing property, include it in `data` but set the property object to `null`. To update the value to `null`, set the `value` property of the object to `null`. /// The id of the player to make the host of the lobby. As soon as this is updated the current host will no longer have permission to modify the lobby. [Preserve] public UpdateRequest(string name = default, int? maxPlayers = default, bool? isPrivate = default, Dictionary data = default, string hostId = default) { Name = name; MaxPlayers = maxPlayers; IsPrivate = isPrivate; Data = new JsonObject(data); HostId = hostId; } /// /// The name of the lobby that should be displayed to users. All whitespace will be trimmed from name. /// [Preserve] [DataMember(Name = "name", EmitDefaultValue = false)] public string Name{ get; } /// /// The maximum number of players allowed in the lobby. Must be greater than or equal to the current number of players in the lobby. /// [Preserve] [DataMember(Name = "maxPlayers", EmitDefaultValue = false)] public int? MaxPlayers{ get; } /// /// Indicates whether or not the lobby is publicly visible and will show up in query results. If the lobby is not publicly visible, the creator can share the `lobbyCode` with other users who can use it to join this lobby. /// [Preserve] [DataMember(Name = "isPrivate", EmitDefaultValue = true)] public bool? IsPrivate{ get; } /// /// Custom game-specific properties to add, update, or remove from the lobby (e.g. `mapName` or `gameType`). To remove an existing property, include it in `data` but set the property object to `null`. To update the value to `null`, set the `value` property of the object to `null`. /// [Preserve] [JsonConverter(typeof(JsonObjectConverter))] [DataMember(Name = "data", EmitDefaultValue = false)] public JsonObject Data{ get; } /// /// The id of the player to make the host of the lobby. As soon as this is updated the current host will no longer have permission to modify the lobby. /// [Preserve] [DataMember(Name = "hostId", EmitDefaultValue = false)] public string HostId{ get; } } }