浏览代码

Lobby package update

/main/staging
nathaniel.buck@unity3d.com 3 年前
当前提交
42e833be
共有 40 个文件被更改,包括 544 次插入215 次删除
  1. 4
      Packages/com.unity.services.lobby/CHANGELOG.md
  2. 43
      Packages/com.unity.services.lobby/Runtime/Apis/LobbyApi.cs
  3. 111
      Packages/com.unity.services.lobby/Runtime/Apis/LobbyApiRequests.cs
  4. 4
      Packages/com.unity.services.lobby/Runtime/Http/BaseApiClient.cs
  5. 14
      Packages/com.unity.services.lobby/Runtime/Http/DeserializationException.cs
  6. 54
      Packages/com.unity.services.lobby/Runtime/Http/HttpClient.cs
  7. 13
      Packages/com.unity.services.lobby/Runtime/Http/HttpException.cs
  8. 5
      Packages/com.unity.services.lobby/Runtime/Http/IHttpClient.cs
  9. 4
      Packages/com.unity.services.lobby/Runtime/Http/JsonHelpers.cs
  10. 58
      Packages/com.unity.services.lobby/Runtime/Http/ResponseHandler.cs
  11. 5
      Packages/com.unity.services.lobby/Runtime/LobbyServiceProvider.cs
  12. 13
      Packages/com.unity.services.lobby/Runtime/Models/CreateRequest.cs
  13. 29
      Packages/com.unity.services.lobby/Runtime/Models/DataObject.cs
  14. 13
      Packages/com.unity.services.lobby/Runtime/Models/Detail.cs
  15. 17
      Packages/com.unity.services.lobby/Runtime/Models/ErrorStatus.cs
  16. 10
      Packages/com.unity.services.lobby/Runtime/Models/JoinByCodeRequest.cs
  17. 20
      Packages/com.unity.services.lobby/Runtime/Models/Lobby.cs
  18. 11
      Packages/com.unity.services.lobby/Runtime/Models/Player.cs
  19. 24
      Packages/com.unity.services.lobby/Runtime/Models/PlayerDataObject.cs
  20. 13
      Packages/com.unity.services.lobby/Runtime/Models/PlayerUpdateRequest.cs
  21. 8
      Packages/com.unity.services.lobby/Runtime/Models/QueryFilter.cs
  22. 8
      Packages/com.unity.services.lobby/Runtime/Models/QueryOrder.cs
  23. 11
      Packages/com.unity.services.lobby/Runtime/Models/QueryRequest.cs
  24. 13
      Packages/com.unity.services.lobby/Runtime/Models/QueryResponse.cs
  25. 10
      Packages/com.unity.services.lobby/Runtime/Models/QuickJoinRequest.cs
  26. 15
      Packages/com.unity.services.lobby/Runtime/Models/UpdateRequest.cs
  27. 4
      Packages/com.unity.services.lobby/Runtime/Scheduler/ThreadHelper.cs
  28. 44
      Packages/com.unity.services.lobby/package.json
  29. 2
      Packages/com.unity.services.lobby/Runtime/Http/DeserializationSettings.cs.meta
  30. 9
      Packages/com.unity.services.lobby/CONTRIBUTING.md
  31. 7
      Packages/com.unity.services.lobby/CONTRIBUTING.md.meta
  32. 15
      Packages/com.unity.services.lobby/Runtime/Http/DeserializationSettings.cs
  33. 53
      Packages/com.unity.services.lobby/Runtime/Http/JsonObject.cs
  34. 11
      Packages/com.unity.services.lobby/Runtime/Http/JsonObject.cs.meta
  35. 28
      Packages/com.unity.services.lobby/Runtime/Http/JsonObjectConverter.cs
  36. 11
      Packages/com.unity.services.lobby/Runtime/Http/JsonObjectConverter.cs.meta
  37. 34
      Packages/com.unity.services.lobby/Runtime/Http/ResponseDeserializationException.cs
  38. 11
      Packages/com.unity.services.lobby/Runtime/Http/ResponseDeserializationException.cs.meta
  39. 0
      /Packages/com.unity.services.lobby/Runtime/Http/DeserializationSettings.cs.meta

4
Packages/com.unity.services.lobby/CHANGELOG.md


The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## [0.2.1-preview] - 2021-07-22
Regenerate after adding Heartbeat API.
## [0.2.0-preview] - 2021-07-08
Add preview tag.

43
Packages/com.unity.services.lobby/Runtime/Apis/LobbyApi.cs


/// Create a lobby
/// </summary>
/// <param name="request">Request object for CreateLobby</param>
/// <param name="operationConfiguration">Configuration for CreateLobby</param>
/// <returns>Task for a Response object containing status code, headers, and Lobby object</returns>
/// <exception cref="Unity.Services.Lobbies.Http.HttpException">An exception containing the HttpClientResponse with headers, response code, and string of error.</exception>
Task<Response<Lobby>> CreateLobbyAsync(CreateLobbyRequest request, Configuration operationConfiguration = null);

/// Delete a lobby
/// </summary>
/// <param name="request">Request object for DeleteLobby</param>
/// <param name="operationConfiguration">Configuration for DeleteLobby</param>
/// <returns>Task for a Response object containing status code, headers</returns>
/// <exception cref="Unity.Services.Lobbies.Http.HttpException">An exception containing the HttpClientResponse with headers, response code, and string of error.</exception>
Task<Response> DeleteLobbyAsync(DeleteLobbyRequest request, Configuration operationConfiguration = null);

/// Get lobby details
/// </summary>
/// <param name="request">Request object for GetLobby</param>
/// <param name="operationConfiguration">Configuration for GetLobby</param>
/// <returns>Task for a Response object containing status code, headers, and Lobby object</returns>
/// <exception cref="Unity.Services.Lobbies.Http.HttpException">An exception containing the HttpClientResponse with headers, response code, and string of error.</exception>
Task<Response<Lobby>> GetLobbyAsync(GetLobbyRequest request, Configuration operationConfiguration = null);

/// Heartbeat a lobby
/// </summary>
/// <param name="request">Request object for Heartbeat</param>
/// <param name="operationConfiguration">Configuration for Heartbeat</param>
/// <returns>Task for a Response object containing status code, headers</returns>
/// <exception cref="Unity.Services.Lobbies.Http.HttpException">An exception containing the HttpClientResponse with headers, response code, and string of error.</exception>
Task<Response> HeartbeatAsync(HeartbeatRequest request, Configuration operationConfiguration = null);
/// <summary>
/// Async Operation.
/// <param name="operationConfiguration">Configuration for JoinLobbyByCode</param>
/// <returns>Task for a Response object containing status code, headers, and Lobby object</returns>
/// <exception cref="Unity.Services.Lobbies.Http.HttpException">An exception containing the HttpClientResponse with headers, response code, and string of error.</exception>
Task<Response<Lobby>> JoinLobbyByCodeAsync(JoinLobbyByCodeRequest request, Configuration operationConfiguration = null);

/// Join a lobby with lobby ID
/// </summary>
/// <param name="request">Request object for JoinLobbyById</param>
/// <param name="operationConfiguration">Configuration for JoinLobbyById</param>
/// <returns>Task for a Response object containing status code, headers, and Lobby object</returns>
/// <exception cref="Unity.Services.Lobbies.Http.HttpException">An exception containing the HttpClientResponse with headers, response code, and string of error.</exception>
Task<Response<Lobby>> JoinLobbyByIdAsync(JoinLobbyByIdRequest request, Configuration operationConfiguration = null);

/// Query public lobbies
/// </summary>
/// <param name="request">Request object for QueryLobbies</param>
/// <param name="operationConfiguration">Configuration for QueryLobbies</param>
/// <returns>Task for a Response object containing status code, headers, and QueryResponse object</returns>
/// <exception cref="Unity.Services.Lobbies.Http.HttpException">An exception containing the HttpClientResponse with headers, response code, and string of error.</exception>
Task<Response<QueryResponse>> QueryLobbiesAsync(QueryLobbiesRequest request, Configuration operationConfiguration = null);

/// Query available lobbies and join a random one
/// </summary>
/// <param name="request">Request object for QuickJoinLobby</param>
/// <param name="operationConfiguration">Configuration for QuickJoinLobby</param>
/// <returns>Task for a Response object containing status code, headers, and Lobby object</returns>
/// <exception cref="Unity.Services.Lobbies.Http.HttpException">An exception containing the HttpClientResponse with headers, response code, and string of error.</exception>
Task<Response<Lobby>> QuickJoinLobbyAsync(QuickJoinLobbyRequest request, Configuration operationConfiguration = null);

/// Remove a player
/// </summary>
/// <param name="request">Request object for RemovePlayer</param>
/// <param name="operationConfiguration">Configuration for RemovePlayer</param>
/// <returns>Task for a Response object containing status code, headers</returns>
/// <exception cref="Unity.Services.Lobbies.Http.HttpException">An exception containing the HttpClientResponse with headers, response code, and string of error.</exception>
Task<Response> RemovePlayerAsync(RemovePlayerRequest request, Configuration operationConfiguration = null);

/// Update lobby data
/// </summary>
/// <param name="request">Request object for UpdateLobby</param>
/// <param name="operationConfiguration">Configuration for UpdateLobby</param>
/// <returns>Task for a Response object containing status code, headers, and Lobby object</returns>
/// <exception cref="Unity.Services.Lobbies.Http.HttpException">An exception containing the HttpClientResponse with headers, response code, and string of error.</exception>
Task<Response<Lobby>> UpdateLobbyAsync(UpdateLobbyRequest request, Configuration operationConfiguration = null);

/// Update player data
/// </summary>
/// <param name="request">Request object for UpdatePlayer</param>
/// <param name="operationConfiguration">Configuration for UpdatePlayer</param>
/// <returns>Task for a Response object containing status code, headers, and Lobby object</returns>
/// <exception cref="Unity.Services.Lobbies.Http.HttpException">An exception containing the HttpClientResponse with headers, response code, and string of error.</exception>
Task<Response<Lobby>> UpdatePlayerAsync(UpdatePlayerRequest request, Configuration operationConfiguration = null);

}
public LobbyApiClient(IHttpClient httpClient,
TaskScheduler taskScheduler,
Configuration configuration = null) : base(httpClient, taskScheduler)
Configuration configuration = null) : base(httpClient)
{
// We don't need to worry about the configuration being null at
// this stage, we will check this in the accessor.

public async Task<Response<Lobby>> GetLobbyAsync(GetLobbyRequest request,
Configuration operationConfiguration = null)
{
var statusCodeToTypeMap = new Dictionary<string, System.Type>() { { "200", typeof(Lobby) },{ "403", typeof(ErrorStatus) },{ "404", typeof(ErrorStatus) } };
var statusCodeToTypeMap = new Dictionary<string, System.Type>() { { "200", typeof(Lobby) },{ "400", typeof(ErrorStatus) },{ "403", typeof(ErrorStatus) },{ "404", typeof(ErrorStatus) } };
// Merge the operation/request level configuration with the client level configuration.
var finalConfiguration = Configuration.MergeConfigurations(operationConfiguration, Configuration);

var handledResponse = ResponseHandler.HandleAsyncResponse<Lobby>(response, statusCodeToTypeMap);
return new Response<Lobby>(response, handledResponse);
}
public async Task<Response> HeartbeatAsync(HeartbeatRequest request,
Configuration operationConfiguration = null)
{
var statusCodeToTypeMap = new Dictionary<string, System.Type>() { { "204", null },{ "400", typeof(ErrorStatus) },{ "403", typeof(ErrorStatus) },{ "404", typeof(ErrorStatus) } };
// Merge the operation/request level configuration with the client level configuration.
var finalConfiguration = Configuration.MergeConfigurations(operationConfiguration, Configuration);
var response = await HttpClient.MakeRequestAsync("POST",
request.ConstructUrl(finalConfiguration.BasePath),
request.ConstructBody(),
request.ConstructHeaders(_accessToken, finalConfiguration),
finalConfiguration.RequestTimeout);
ResponseHandler.HandleAsyncResponse(response, statusCodeToTypeMap);
return new Response(response);
}
public async Task<Response<Lobby>> JoinLobbyByCodeAsync(JoinLobbyByCodeRequest request,

111
Packages/com.unity.services.lobby/Runtime/Apis/LobbyApiRequests.cs


using System.Collections.Generic;
using System.Linq;
using UnityEngine.Scripting;
using System.Text;
using System.Text.RegularExpressions;

key = UnityWebRequest.EscapeURL(key);
value = UnityWebRequest.EscapeURL(value);
queryParams.Add($"{key}={value}");
public List<string> AddParamsToQueryParams(List<string> queryParams, string key, List<string> values)
public List<string> AddParamsToQueryParams(List<string> queryParams, string key, List<string> values, string style, bool explode)
foreach(var value in values)
if (explode)
{
foreach(var value in values)
{
string escapedValue = UnityWebRequest.EscapeURL(value);
queryParams.Add($"{UnityWebRequest.EscapeURL(key)}={escapedValue}");
}
}
else
string escapedValue = UnityWebRequest.EscapeURL(value);
queryParams.Add($"{UnityWebRequest.EscapeURL(key)}[]={escapedValue}");
string paramString = $"{UnityWebRequest.EscapeURL(key)}=";
foreach(var value in values)
{
paramString += UnityWebRequest.EscapeURL(value) + ",";
}
paramString = paramString.Remove(paramString.Length - 1);
queryParams.Add(paramString);
return queryParams;
}

string[] accepts = {
"application/json",
"application/problem+json"
};
var acceptHeader = GenerateAcceptHeader(accepts);
if (!string.IsNullOrEmpty(acceptHeader))
{
headers.Add("Accept", acceptHeader);
}
var contentTypeHeader = GenerateContentTypeHeader(contentTypes);
if (!string.IsNullOrEmpty(contentTypeHeader))
{
headers.Add("Content-Type", contentTypeHeader);
}
// We also check if there are headers that are defined as part of
// the request configuration.
if (operationConfiguration != null && operationConfiguration.Headers != null)
{
foreach (var pair in operationConfiguration.Headers)
{
headers[pair.Key] = pair.Value;
}
}
return headers;
}
}
[Preserve]
public class HeartbeatRequest : LobbyApiBaseRequest
{
[Preserve]
public string LobbyId { get; }
[Preserve]
public object Body { get; }
string PathAndQueryParams;
/// <summary>
/// Heartbeat Request Object.
/// Heartbeat a lobby
/// </summary>
/// <param name="lobbyId">The id of the lobby to execute the request against.</param>
/// <param name="body">body param</param>
/// <returns>A Heartbeat request object.</returns>
[Preserve]
public HeartbeatRequest(string lobbyId, object body = default(object))
{
LobbyId = lobbyId;
Body = body;
PathAndQueryParams = $"/{lobbyId}/heartbeat";
List<string> queryParams = new List<string>();
if (queryParams.Count > 0)
{
PathAndQueryParams = $"{PathAndQueryParams}?{string.Join("&", queryParams)}";
}
}
public string ConstructUrl(string requestBasePath)
{
return requestBasePath + PathAndQueryParams;
}
public byte[] ConstructBody()
{
if(Body != null)
{
return ConstructBody(Body);
}
return null;
}
public Dictionary<string, string> ConstructHeaders(IAccessToken accessToken,
Configuration operationConfiguration = null)
{
var headers = new Dictionary<string, string>();
if(!string.IsNullOrEmpty(accessToken.AccessToken))
{
headers.Add("authorization", "Bearer " + accessToken.AccessToken);
}
string[] contentTypes = {
"application/json"
};
string[] accepts = {
"application/problem+json"
};

4
Packages/com.unity.services.lobby/Runtime/Http/BaseApiClient.cs


{
protected readonly IHttpClient HttpClient;
public BaseApiClient(IHttpClient httpClient, TaskScheduler scheduler)
public BaseApiClient(IHttpClient httpClient)
HttpClient = httpClient ?? new HttpClient(scheduler);
HttpClient = httpClient ?? new HttpClient();
}
}
}

14
Packages/com.unity.services.lobby/Runtime/Http/DeserializationException.cs


[Serializable]
public class DeserializationException : Exception
{
public HttpClientResponse response;
public DeserializationException() : base()
{
}

DeserializationException(string message, Exception inner) : base(message, inner)
{
}
public DeserializationException(HttpClientResponse httpClientResponse) : base(
"Unable to Deserialize Http Client Response")
{
response = httpClientResponse;
}
public DeserializationException(HttpClientResponse httpClientResponse, string message) : base(
message)
{
response = httpClientResponse;
}
}
}

54
Packages/com.unity.services.lobby/Runtime/Http/HttpClient.cs


};
private static readonly List<int> ErrorCodes = new List<int> {408, 500, 502, 503, 504};
private TaskScheduler _scheduler;
public HttpClient(TaskScheduler scheduler)
{
_scheduler = scheduler;
}
public void Get(string url, Dictionary<string, string> headers, Action<HttpClientResponse> onCompleted,
int requestTimeout = 10)
{
_scheduler.ScheduleMainThreadTask(() =>
{
_scheduler.StartCoroutine(ProcessRequest(UnityWebRequest.kHttpVerbGET, url, headers, null,
requestTimeout, onCompleted));
});
}
public void Delete(string url, Dictionary<string, string> headers, Action<HttpClientResponse> onCompleted,
int requestTimeout = 10)
{
_scheduler.ScheduleMainThreadTask(() =>
{
_scheduler.StartCoroutine(ProcessRequest(UnityWebRequest.kHttpVerbDELETE, url, headers, null,
requestTimeout, onCompleted));
});
}
public void Post(string url, byte[] body, Dictionary<string, string> headers,
Action<HttpClientResponse> onCompleted, int requestTimeout = 10)
{
_scheduler.ScheduleMainThreadTask(() =>
{
_scheduler.StartCoroutine(ProcessRequest(UnityWebRequest.kHttpVerbPOST, url, headers, body,
requestTimeout, onCompleted));
});
}
public void Put(string url, byte[] body, Dictionary<string, string> headers,
Action<HttpClientResponse> onCompleted, int requestTimeout = 10)
public HttpClient()
_scheduler.ScheduleMainThreadTask(() =>
{
_scheduler.StartCoroutine(ProcessRequest(UnityWebRequest.kHttpVerbPUT, url, headers, body,
requestTimeout, onCompleted));
});
}
public void MakeRequest(string method, string url, byte[] body, Dictionary<string, string> headers,
Action<HttpClientResponse> onCompleted, int requestTimeout = 10)
{
_scheduler.ScheduleMainThreadTask(() =>
{
_scheduler.StartCoroutine(ProcessRequest(method.ToUpper(), url, headers, body, requestTimeout,
onCompleted));
});
}
public async Task<HttpClientResponse> MakeRequestAsync(string method, string url, byte[] body,

13
Packages/com.unity.services.lobby/Runtime/Http/HttpException.cs


using System;
using UnityEngine.Scripting;
[Preserve]
[Preserve]
[Preserve]
[Preserve]
[Preserve]
[Preserve]
public HttpException(HttpClientResponse response) : base(response.ErrorMessage)
{
Response = response;

[Serializable]
[Preserve]
[Preserve]
[Preserve]
[Preserve]
[Preserve]
[Preserve]
public HttpException(HttpClientResponse response, T actualError) : base(response)
{
ActualError = actualError;

5
Packages/com.unity.services.lobby/Runtime/Http/IHttpClient.cs


{
public interface IHttpClient
{
void Get(string url, Dictionary<string, string> headers, Action<HttpClientResponse> onCompleted, int requestTimeout = 10);
void Delete(string url, Dictionary<string, string> headers, Action<HttpClientResponse> onCompleted, int requestTimeout = 10);
void Post(string url, byte[] body, Dictionary<string, string> headers, Action<HttpClientResponse> onCompleted, int requestTimeout = 10);
void Put(string url, byte[] body, Dictionary<string, string> headers, Action<HttpClientResponse> onCompleted, int requestTimeout = 10);
void MakeRequest(string method, string url, byte[] body, Dictionary<string, string> headers, Action<HttpClientResponse> onCompleted, int requestTimeout = 10);
Task<HttpClientResponse> MakeRequestAsync(string method, string url, byte[] body, Dictionary<string, string> headers, int requestTimeout);
Task<HttpClientResponse> MakeRequestAsync(string method, string url, List<IMultipartFormSection> body, Dictionary<string, string> headers, int requestTimeout, string boundary = null);
}

4
Packages/com.unity.services.lobby/Runtime/Http/JsonHelpers.cs


using Newtonsoft.Json;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Utilities;
using UnityEngine;

success = false;
args.ErrorContext.Handled = true;
},
MissingMemberHandling = MissingMemberHandling.Ignore
MissingMemberHandling = Newtonsoft.Json.MissingMemberHandling.Ignore
};
result = JsonConvert.DeserializeObject<T>(@this, settings);
return success;

58
Packages/com.unity.services.lobby/Runtime/Http/ResponseHandler.cs


{
var settings = new JsonSerializerSettings
{
MissingMemberHandling = MissingMemberHandling.Ignore
MissingMemberHandling = Newtonsoft.Json.MissingMemberHandling.Ignore
return JsonConvert.DeserializeObject<T>(GetDeserializardJson(response.Data), settings);
return JsonConvert.DeserializeObject<T>(GetDeserializedJson(response.Data), settings);
}
public static object TryDeserializeResponse(HttpClientResponse response, Type type)

MissingMemberHandling = MissingMemberHandling.Ignore
MissingMemberHandling = Newtonsoft.Json.MissingMemberHandling.Ignore
return JsonConvert.DeserializeObject(GetDeserializardJson(response.Data), type, settings);
return JsonConvert.DeserializeObject(GetDeserializedJson(response.Data), type, settings);
private static string GetDeserializardJson(byte[] data)
private static string GetDeserializedJson(byte[] data)
{
return Encoding.UTF8.GetString(data);
}

}
catch (ArgumentException e)
{
throw new DeserializationException(response, e.Message);
throw new ResponseDeserializationException(response, e.Message);
throw new DeserializationException(response,
throw new ResponseDeserializationException(response,
catch (DeserializationException e) when (e.response == null)
catch (ResponseDeserializationException e)
throw new DeserializationException(response, e.Message);
}
catch (DeserializationException)
{
if (e.response == null)
{
throw new ResponseDeserializationException(response, e.Message);
}
throw new DeserializationException(response);
throw new ResponseDeserializationException(response);
}
}

}
catch (ArgumentException e)
{
throw new DeserializationException(response, e.Message);
throw new ResponseDeserializationException(response, e.Message);
throw new DeserializationException(response,
throw new ResponseDeserializationException(response,
catch (DeserializationException e) when (e.response == null)
catch (ResponseDeserializationException e)
throw new DeserializationException(response, e.Message);
}
catch (DeserializationException)
{
if (e.response == null)
{
throw new ResponseDeserializationException(response, e.Message);
}
throw new DeserializationException(response);
throw new ResponseDeserializationException(response);
}
}

}
catch (ArgumentException e)
{
throw new DeserializationException(response, e.Message);
throw new ResponseDeserializationException(response, e.Message);
throw new DeserializationException(response,
throw new ResponseDeserializationException(response,
catch (DeserializationException e) when (e.response == null)
{
throw new DeserializationException(response, e.Message);
}
catch (DeserializationException)
catch (ResponseDeserializationException e)
if (e.response == null)
{
throw new ResponseDeserializationException(response, e.Message);
}
throw new DeserializationException(response);
throw new ResponseDeserializationException(response);
}
}
}

5
Packages/com.unity.services.lobby/Runtime/LobbyServiceProvider.cs


public Task Initialize(CoreRegistry registry)
{
_gameObjectFactory = GameObjectFactory.CreateCoreSdkGameObject();
var scheduler = _gameObjectFactory.GetComponent<TaskScheduler>();
var httpClient = new HttpClient(scheduler);
var httpClient = new HttpClient();
LobbyService.LobbyApiClient = new LobbyApiClient(httpClient, scheduler, accessTokenLobbyApi);
LobbyService.LobbyApiClient = new LobbyApiClient(httpClient, accessTokenLobbyApi);
}
return Task.CompletedTask;

13
Packages/com.unity.services.lobby/Runtime/Models/CreateRequest.cs


using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Unity.Services.Lobbies.Http;

/// The body of a Create Lobby request.
/// <param name="name">The name of the lobby that should be displayed to users. All whitespace will be trimmed from name.</param>
/// <param name="maxPlayers">The maximum number of players allowed in the lobby.</param>
/// <param name="isPrivate">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 &#x60;lobbyCode&#x60; with other users who can use it to join this lobby.</param>
/// <param name="player">player param</param>
/// <param name="data">Custom game-specific properties that apply to the lobby (e.g. &#x60;mapName&#x60; or &#x60;gameType&#x60;).</param>
[Preserve]
[DataContract(Name = "CreateRequest")]
public class CreateRequest

/// <param name="player">player param</param>
/// <param name="data">Custom game-specific properties that apply to the lobby (e.g. &#x60;mapName&#x60; or &#x60;gameType&#x60;).</param>
[Preserve]
public CreateRequest(string name, int maxPlayers, bool? isPrivate = null, Player player = default(Player), Dictionary<string, DataObject> data = null)
public CreateRequest(string name, int maxPlayers, bool? isPrivate = false, Player player = default, Dictionary<string, DataObject> data = default)
{
Name = name;
MaxPlayers = maxPlayers;

}
/// <summary>
/// The name of the lobby that should be displayed to users. All whitespace will be trimmed from name.
/// </summary>

[DataMember(Name = "isPrivate", EmitDefaultValue = true)]
public bool? IsPrivate{ get; }
/// <summary>
/// player param
/// </summary>
[Preserve]
[DataMember(Name = "player", EmitDefaultValue = false)]
public Player Player{ get; }

29
Packages/com.unity.services.lobby/Runtime/Models/DataObject.cs


using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Unity.Services.Lobbies.Http;

/// Custom data property for a lobby.
/// <param name="value">The value of the custom property. This property can be set to null or empty string. If this property is indexed (by setting the &#x60;index&#x60; field) then the length of the value must be less than 128 bytes.</param>
/// <param name="visibility">Indicates for whom the property should be visible. If &#x60;public&#x60;, the property will be visible to everyone and will be included in query results. If &#x60;member&#x60; the data will only be visible to users who are members of the lobby (i.e. those who have successfully joined). If &#x60;private&#x60;, the metadata will only be visible to the host.</param>
/// <param name="index">The name of the column to index this property value under, either &#x60;S#&#x60; for strings or &#x60;N#&#x60; for numeric values. If an index is specified on a property, then you can use that index name in a &#x60;QueryFilter&#x60; to filter results by that property. If You will not be prevented from indexing multiple objects having properties different with names but the same the same index, but you will likely receive unexpected results from a query.</param>
[Preserve]
[DataContract(Name = "DataObject")]
public class DataObject

/// <param name="value">The value of the custom property. This property can be set to null or empty string. If this property is indexed (by setting the &#x60;index&#x60; field) then the length of the value must be less than 128 bytes.</param>
/// <param name="index">The name of the column to index this property value under, either &#x60;S#&#x60; for strings or &#x60;N#&#x60; for numeric values. If an index is specified on a property, then you can use that index name in a &#x60;QueryFilter&#x60; to filter results by that property. If You will not be prevented from indexing multiple objects having properties different with names but the same the same index, but you will likely receive unexpected results from a query.</param>
[Preserve]
public DataObject(VisibilityOptions visibility, string value = null, IndexOptions index = default)
public DataObject(VisibilityOptions visibility, string value = default, IndexOptions index = default)
Value = value;
Value = value;
/// <summary>
/// The value of the custom property. This property can be set to null or empty string. If this property is indexed (by setting the &#x60;index&#x60; field) then the length of the value must be less than 128 bytes.
/// </summary>
[Preserve]
[DataMember(Name = "value", EmitDefaultValue = false)]
public string Value{ get; }
/// <summary>
/// Indicates for whom the property should be visible. If &#x60;public&#x60;, the property will be visible to everyone and will be included in query results. If &#x60;member&#x60; the data will only be visible to users who are members of the lobby (i.e. those who have successfully joined). If &#x60;private&#x60;, the metadata will only be visible to the host.
/// </summary>

public VisibilityOptions Visibility{ get; }
/// <summary>
/// The value of the custom property. This property can be set to null or empty string. If this property is indexed (by setting the &#x60;index&#x60; field) then the length of the value must be less than 128 bytes.
/// </summary>
[Preserve]
[DataMember(Name = "value", EmitDefaultValue = false)]
public string Value{ get; }
/// <summary>
/// The name of the column to index this property value under, either &#x60;S#&#x60; for strings or &#x60;N#&#x60; for numeric values. If an index is specified on a property, then you can use that index name in a &#x60;QueryFilter&#x60; to filter results by that property. If You will not be prevented from indexing multiple objects having properties different with names but the same the same index, but you will likely receive unexpected results from a query.
/// </summary>
[Preserve]

[Preserve]
[JsonConverter(typeof(StringEnumConverter))]
public enum VisibilityOptions
{

/// The name of the column to index this property value under, either &#x60;S#&#x60; for strings or &#x60;N#&#x60; for numeric values. If an index is specified on a property, then you can use that index name in a &#x60;QueryFilter&#x60; to filter results by that property. If You will not be prevented from indexing multiple objects having properties different with names but the same the same index, but you will likely receive unexpected results from a query.
/// </summary>
/// <value>The name of the column to index this property value under, either &#x60;S#&#x60; for strings or &#x60;N#&#x60; for numeric values. If an index is specified on a property, then you can use that index name in a &#x60;QueryFilter&#x60; to filter results by that property. If You will not be prevented from indexing multiple objects having properties different with names but the same the same index, but you will likely receive unexpected results from a query.</value>
[Preserve]
[JsonConverter(typeof(StringEnumConverter))]
public enum IndexOptions
{

}
}

13
Packages/com.unity.services.lobby/Runtime/Models/Detail.cs


using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Unity.Services.Lobbies.Http;

/// Additional detail about an error. This may include detailed validation failure messages, debugging information, troubleshooting steps, or more.
/// <param name="errorType">errorType param</param>
/// <param name="message">message param</param>
[Preserve]
[DataContract(Name = "Detail")]
public class Detail

/// <param name="errorType">errorType param</param>
/// <param name="message">message param</param>
[Preserve]
public Detail(string errorType = default(string), string message = default(string))
public Detail(string errorType = default, string message = default)
/// <summary>
/// errorType param
/// </summary>
/// <summary>
/// message param
/// </summary>
[Preserve]
[DataMember(Name = "message", EmitDefaultValue = false)]
public string Message{ get; }

17
Packages/com.unity.services.lobby/Runtime/Models/ErrorStatus.cs


using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Unity.Services.Lobbies.Http;

/// The body that will be returned for any failing request. We are using the [RFC 7807 Error Format](https://www.rfc-editor.org/rfc/rfc7807.html#section-3.1).
/// <param name="status">status param</param>
/// <param name="title">title param</param>
/// <param name="details">details param</param>
[Preserve]
[DataContract(Name = "ErrorStatus")]
public class ErrorStatus

/// <param name="title">title param</param>
/// <param name="details">details param</param>
[Preserve]
public ErrorStatus(int status = default(int), string title = default(string), List<Detail> details = default(List<Detail>))
public ErrorStatus(int status = default, string title = default, List<Detail> details = default)
{
Status = status;
Title = title;

/// <summary>
/// status param
/// </summary>
/// <summary>
/// title param
/// </summary>
/// <summary>
/// details param
/// </summary>
[Preserve]
[DataMember(Name = "details", EmitDefaultValue = false)]
public List<Detail> Details{ get; }

10
Packages/com.unity.services.lobby/Runtime/Models/JoinByCodeRequest.cs


using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Unity.Services.Lobbies.Http;

/// The body of a Join Lobby request using lobby code.
/// <param name="lobbyCode">The lobby code of the lobby the join. Mutually exclusive with &#x60;id&#x60;. This is used to join a private lobby where the lobby code was shared to other users manually.</param>
/// <param name="player">player param</param>
[Preserve]
[DataContract(Name = "JoinByCodeRequest")]
public class JoinByCodeRequest

/// <param name="lobbyCode">The lobby code of the lobby the join. Mutually exclusive with &#x60;id&#x60;. This is used to join a private lobby where the lobby code was shared to other users manually.</param>
/// <param name="player">player param</param>
[Preserve]
public JoinByCodeRequest(string lobbyCode, Player player = default(Player))
public JoinByCodeRequest(string lobbyCode, Player player = default)
/// <summary>
/// The lobby code of the lobby the join. Mutually exclusive with &#x60;id&#x60;. This is used to join a private lobby where the lobby code was shared to other users manually.
/// </summary>

/// <summary>
/// player param
/// </summary>
[Preserve]
[DataMember(Name = "player", EmitDefaultValue = false)]
public Player Player{ get; }

20
Packages/com.unity.services.lobby/Runtime/Models/Lobby.cs


using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Unity.Services.Lobbies.Http;

/// Data about an individual lobby.
/// <param name="id">id param</param>
/// <param name="lobbyCode">A short code that be used to join a lobby. This is only visible to lobby members. Typically this is displayed to the user so they can share it with other players out of game. Users with the code can join the lobby even when it is private.</param>
/// <param name="upid">The Unity project ID of the game.</param>
/// <param name="name">The name of the lobby. Typically this shown in game UI to represent the lobby.</param>
/// <param name="maxPlayers">The maximum number of players that can be members of the lobby.</param>
/// <param name="availableSlots">The number of remaining open slots for players before the lobby becomes full.</param>
/// <param name="isPrivate">Whether the lobby is private or not. Private lobbies do not appear in query results.</param>
/// <param name="players">The members of the lobby.</param>
/// <param name="data">Properties of the lobby set by the host.</param>
/// <param name="hostId">The ID of the player that is the lobby host.</param>
/// <param name="created">When the lobby was created. The timestamp is in UTC and conforms to ISO 8601.</param>
/// <param name="lastUpdated">When the lobby was last updated. The timestamp is in UTC and conforms to ISO 8601.</param>
[Preserve]
[DataContract(Name = "Lobby")]
public class Lobby

/// <param name="created">When the lobby was created. The timestamp is in UTC and conforms to ISO 8601.</param>
/// <param name="lastUpdated">When the lobby was last updated. The timestamp is in UTC and conforms to ISO 8601.</param>
[Preserve]
public Lobby(string id = default(string), string lobbyCode = null, string upid = default(string), string name = null, int maxPlayers = default(int), int availableSlots = default(int), bool isPrivate = default(bool), List<Player> players = default(List<Player>), Dictionary<string, DataObject> data = null, string hostId = default(string), DateTime created = default(DateTime), DateTime lastUpdated = default(DateTime))
public Lobby(string id = default, string lobbyCode = default, string upid = default, string name = default, int maxPlayers = default, int availableSlots = default, bool isPrivate = default, List<Player> players = default, Dictionary<string, DataObject> data = default, string hostId = default, DateTime created = default, DateTime lastUpdated = default)
{
Id = id;
LobbyCode = lobbyCode;

LastUpdated = lastUpdated;
}
/// <summary>
/// id param
/// </summary>
[Preserve]
[DataMember(Name = "id", EmitDefaultValue = false)]
public string Id{ get; }

11
Packages/com.unity.services.lobby/Runtime/Models/Player.cs


using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Unity.Services.Lobbies.Http;

/// Information about a specific player creating, joining, or already in a lobby.
/// <param name="id">The unique identifier for the player. If not provided for a create or join request it will be set to the id of the caller.</param>
/// <param name="connectionInfo">(TBD) Connection information for connecting to a relay with this player.</param>
/// <param name="data">Custom game-specific properties that apply to an individual player (e.g. &#x60;role&#x60; or &#x60;skill&#x60;).</param>
/// <param name="allocationId">An id that associates this player in this lobby with a persistent connection. When a disconnect notification is recevied, this value is used to identify the associated player in a lobby to mark them as disconnected.</param>
/// <param name="joined">The time at which the player joined the lobby.</param>
/// <param name="lastUpdated">The last time the metadata for this player was updated.</param>
[Preserve]
[DataContract(Name = "Player")]
public class Player

/// <param name="joined">The time at which the player joined the lobby.</param>
/// <param name="lastUpdated">The last time the metadata for this player was updated.</param>
[Preserve]
public Player(string id = null, string connectionInfo = null, Dictionary<string, PlayerDataObject> data = null, string allocationId = null, DateTime joined = default(DateTime), DateTime lastUpdated = default(DateTime))
public Player(string id = default, string connectionInfo = default, Dictionary<string, PlayerDataObject> data = default, string allocationId = default, DateTime joined = default, DateTime lastUpdated = default)
{
Id = id;
ConnectionInfo = connectionInfo;

LastUpdated = lastUpdated;
}
/// <summary>
/// The unique identifier for the player. If not provided for a create or join request it will be set to the id of the caller.
/// </summary>

24
Packages/com.unity.services.lobby/Runtime/Models/PlayerDataObject.cs


using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Unity.Services.Lobbies.Http;

/// Custom data property for a player.
/// <param name="value">The value of the custom property. This property can be set to null or empty string.</param>
/// <param name="visibility">Indicates for whom the property should be visible. If &#x60;public&#x60;, the property will be visible to everyone and will be included in query results. If &#x60;member&#x60; the data will only be visible to users who are members of the lobby (i.e. those who have successfully joined). If &#x60;private&#x60;, the metadata will only be visible to the the player.</param>
[Preserve]
[DataContract(Name = "PlayerDataObject")]
public class PlayerDataObject

/// <param name="visibility">Indicates for whom the property should be visible. If &#x60;public&#x60;, the property will be visible to everyone and will be included in query results. If &#x60;member&#x60; the data will only be visible to users who are members of the lobby (i.e. those who have successfully joined). If &#x60;private&#x60;, the metadata will only be visible to the the player.</param>
/// <param name="value">The value of the custom property. This property can be set to null or empty string.</param>
[Preserve]
public PlayerDataObject(VisibilityOptions visibility, string value = null)
public PlayerDataObject(VisibilityOptions visibility, string value = default)
Visibility = visibility;
Visibility = visibility;
/// Indicates for whom the property should be visible. If &#x60;public&#x60;, the property will be visible to everyone and will be included in query results. If &#x60;member&#x60; the data will only be visible to users who are members of the lobby (i.e. those who have successfully joined). If &#x60;private&#x60;, the metadata will only be visible to the the player.
/// The value of the custom property. This property can be set to null or empty string.
[JsonConverter(typeof(StringEnumConverter))]
[DataMember(Name = "visibility", IsRequired = true, EmitDefaultValue = true)]
public VisibilityOptions Visibility{ get; }
[DataMember(Name = "value", EmitDefaultValue = false)]
public string Value{ get; }
/// The value of the custom property. This property can be set to null or empty string.
/// Indicates for whom the property should be visible. If &#x60;public&#x60;, the property will be visible to everyone and will be included in query results. If &#x60;member&#x60; the data will only be visible to users who are members of the lobby (i.e. those who have successfully joined). If &#x60;private&#x60;, the metadata will only be visible to the the player.
[DataMember(Name = "value", EmitDefaultValue = false)]
public string Value{ get; }
[JsonConverter(typeof(StringEnumConverter))]
[DataMember(Name = "visibility", IsRequired = true, EmitDefaultValue = true)]
public VisibilityOptions Visibility{ get; }
/// <summary>

[Preserve]
[JsonConverter(typeof(StringEnumConverter))]
public enum VisibilityOptions
{

13
Packages/com.unity.services.lobby/Runtime/Models/PlayerUpdateRequest.cs


using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Unity.Services.Lobbies.Http;

/// The body of an Update Player Data request.
/// <param name="connectionInfo">(TBD) Connection information for connecting to a relay with this player.</param>
/// <param name="data">Custom game-specific properties to add, update, or remove from the player (e.g. &#x60;role&#x60; or &#x60;skill&#x60;). To remove an existing property, include it in &#x60;data&#x60; but set the property object to &#x60;null&#x60;. To update the value to &#x60;null&#x60;, set the &#x60;value&#x60; property of the object to &#x60;null&#x60;.</param>
/// <param name="allocationId">An id that associates this player in this lobby with a persistent connection. When a disconnect notification is recevied, this value is used to identify the associated player in a lobby to mark them as disconnected.</param>
[Preserve]
[DataContract(Name = "PlayerUpdateRequest")]
public class PlayerUpdateRequest

/// <param name="data">Custom game-specific properties to add, update, or remove from the player (e.g. &#x60;role&#x60; or &#x60;skill&#x60;). To remove an existing property, include it in &#x60;data&#x60; but set the property object to &#x60;null&#x60;. To update the value to &#x60;null&#x60;, set the &#x60;value&#x60; property of the object to &#x60;null&#x60;.</param>
/// <param name="allocationId">An id that associates this player in this lobby with a persistent connection. When a disconnect notification is recevied, this value is used to identify the associated player in a lobby to mark them as disconnected.</param>
[Preserve]
public PlayerUpdateRequest(string connectionInfo = null, Dictionary<string, PlayerDataObject> data = null, string allocationId = null)
public PlayerUpdateRequest(string connectionInfo = default, Dictionary<string, PlayerDataObject> data = default, string allocationId = default)
Data = data;
Data = new JsonObject(data);
/// <summary>
/// (TBD) Connection information for connecting to a relay with this player.
/// </summary>

/// Custom game-specific properties to add, update, or remove from the player (e.g. &#x60;role&#x60; or &#x60;skill&#x60;). To remove an existing property, include it in &#x60;data&#x60; but set the property object to &#x60;null&#x60;. To update the value to &#x60;null&#x60;, set the &#x60;value&#x60; property of the object to &#x60;null&#x60;.
/// </summary>
[Preserve]
[JsonConverter(typeof(JsonObjectConverter))]
public Dictionary<string, PlayerDataObject> Data{ get; }
public JsonObject Data{ get; }
/// <summary>
/// An id that associates this player in this lobby with a persistent connection. When a disconnect notification is recevied, this value is used to identify the associated player in a lobby to mark them as disconnected.

8
Packages/com.unity.services.lobby/Runtime/Models/QueryFilter.cs


using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Unity.Services.Lobbies.Http;

/// A filter for an individual field that is applied to a query.
/// <param name="field">The name of the field to filter on. For custom data fields, the name of the index must be used instead of the field name.</param>
/// <param name="value">The value to compare to the field being filtered. This value must be a string and it must be parsable as the same type as &#x60;field&#x60; (e.g. &#x60;integer&#x60; for MaxPlayers, &#x60;datetime&#x60; for Created, etc.). The value for &#x60;datetime&#x60; fields (Created, LastUpdated) must be in RFC3339 format. For example, in C# this can be achieved using the \&quot;o\&quot; format specifier: &#x60;return dateTime.ToString(\&quot;o\&quot;, DateTimeFormatInfo.InvariantInfo);&#x60;. Refer to your language documentation for other methods to generate RFC3339-compatible datetime strings.</param>
/// <param name="op">The operator used to compare the field to the filter value. Supports &#x60;CONTAINS&#x60; (only on the &#x60;Name&#x60; field), &#x60;EQ&#x60; (Equal), &#x60;NE&#x60; (Not Equal), &#x60;LT&#x60; (Less Than), &#x60;LE&#x60; (Less Than or Equal), &#x60;GT&#x60; (Greater Than), or &#x60;GE&#x60; (Greater Than or Equal).</param>
[Preserve]
[DataContract(Name = "QueryFilter")]
public class QueryFilter

Op = op;
}
/// <summary>
/// The name of the field to filter on. For custom data fields, the name of the index must be used instead of the field name.
/// </summary>

/// The name of the field to filter on. For custom data fields, the name of the index must be used instead of the field name.
/// </summary>
/// <value>The name of the field to filter on. For custom data fields, the name of the index must be used instead of the field name.</value>
[Preserve]
[JsonConverter(typeof(StringEnumConverter))]
public enum FieldOptions
{

/// The operator used to compare the field to the filter value. Supports &#x60;CONTAINS&#x60; (only on the &#x60;Name&#x60; field), &#x60;EQ&#x60; (Equal), &#x60;NE&#x60; (Not Equal), &#x60;LT&#x60; (Less Than), &#x60;LE&#x60; (Less Than or Equal), &#x60;GT&#x60; (Greater Than), or &#x60;GE&#x60; (Greater Than or Equal).
/// </summary>
/// <value>The operator used to compare the field to the filter value. Supports &#x60;CONTAINS&#x60; (only on the &#x60;Name&#x60; field), &#x60;EQ&#x60; (Equal), &#x60;NE&#x60; (Not Equal), &#x60;LT&#x60; (Less Than), &#x60;LE&#x60; (Less Than or Equal), &#x60;GT&#x60; (Greater Than), or &#x60;GE&#x60; (Greater Than or Equal).</value>
[Preserve]
[JsonConverter(typeof(StringEnumConverter))]
public enum OpOptions
{

8
Packages/com.unity.services.lobby/Runtime/Models/QueryOrder.cs


using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Unity.Services.Lobbies.Http;

/// An order for an individual field that is applied to a query.
/// <param name="asc">Whether to sort in ascending or descending order.</param>
/// <param name="field">The name of the field to order on.</param>
[Preserve]
[DataContract(Name = "QueryOrder")]
public class QueryOrder

/// <param name="asc">Whether to sort in ascending or descending order.</param>
/// <param name="field">The name of the field to order on.</param>
[Preserve]
public QueryOrder(bool asc = default(bool), FieldOptions field = default)
public QueryOrder(bool asc = default, FieldOptions field = default)
/// <summary>
/// Whether to sort in ascending or descending order.
/// </summary>

/// The name of the field to order on.
/// </summary>
/// <value>The name of the field to order on.</value>
[Preserve]
[JsonConverter(typeof(StringEnumConverter))]
public enum FieldOptions
{

11
Packages/com.unity.services.lobby/Runtime/Models/QueryRequest.cs


using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Unity.Services.Lobbies.Http;

/// The body of a Query request which defines how to sort and filter results, how many results to return, etc.
/// <param name="count">The number of results to return.</param>
/// <param name="skip">The number of results to skip before selecting results to return.</param>
/// <param name="sampleResults">Whether a random sample of results that match the search filter should be returned.</param>
/// <param name="filter">A list of filters which can be used to narrow down which lobbies to return.</param>
/// <param name="order">A list of orders which define how the results should be ordered in the response.</param>
/// <param name="continuationToken">A continuation token that can be passed to subsequent query requests to fetch the next page of results.</param>
[Preserve]
[DataContract(Name = "QueryRequest")]
public class QueryRequest

/// <param name="order">A list of orders which define how the results should be ordered in the response.</param>
/// <param name="continuationToken">A continuation token that can be passed to subsequent query requests to fetch the next page of results.</param>
[Preserve]
public QueryRequest(int? count = null, int? skip = null, bool sampleResults = false, List<QueryFilter> filter = default(List<QueryFilter>), List<QueryOrder> order = default(List<QueryOrder>), string continuationToken = null)
public QueryRequest(int? count = 10, int? skip = 0, bool sampleResults = false, List<QueryFilter> filter = default, List<QueryOrder> order = default, string continuationToken = default)
{
Count = count;
Skip = skip;

ContinuationToken = continuationToken;
}
/// <summary>
/// The number of results to return.
/// </summary>

13
Packages/com.unity.services.lobby/Runtime/Models/QueryResponse.cs


using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Unity.Services.Lobbies.Http;

/// A list of lobbies that matched the specified lobbies query. Only the public top level, data, and player data properties are returned.
/// <param name="results">results param</param>
/// <param name="continuationToken">continuationToken param</param>
[Preserve]
[DataContract(Name = "QueryResponse")]
public class QueryResponse

/// <param name="results">results param</param>
/// <param name="continuationToken">continuationToken param</param>
[Preserve]
public QueryResponse(List<Lobby> results = default(List<Lobby>), string continuationToken = null)
public QueryResponse(List<Lobby> results = default, string continuationToken = default)
/// <summary>
/// results param
/// </summary>
/// <summary>
/// continuationToken param
/// </summary>
[Preserve]
[DataMember(Name = "continuationToken", EmitDefaultValue = false)]
public string ContinuationToken{ get; }

10
Packages/com.unity.services.lobby/Runtime/Models/QuickJoinRequest.cs


using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Unity.Services.Lobbies.Http;

/// The body of a QuickJoin request.
/// <param name="filter">A list of filters which can be used to narrow down which lobbies to attempt to join..</param>
/// <param name="player">player param</param>
[Preserve]
[DataContract(Name = "QuickJoinRequest")]
public class QuickJoinRequest

/// <param name="filter">A list of filters which can be used to narrow down which lobbies to attempt to join..</param>
/// <param name="player">player param</param>
[Preserve]
public QuickJoinRequest(List<QueryFilter> filter = default(List<QueryFilter>), Player player = default(Player))
public QuickJoinRequest(List<QueryFilter> filter = default, Player player = default)
/// <summary>
/// A list of filters which can be used to narrow down which lobbies to attempt to join..
/// </summary>

/// <summary>
/// player param
/// </summary>
[Preserve]
[DataMember(Name = "player", EmitDefaultValue = false)]
public Player Player{ get; }

15
Packages/com.unity.services.lobby/Runtime/Models/UpdateRequest.cs


using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Unity.Services.Lobbies.Http;

/// The body of an Update Lobby request.
/// <param name="name">The name of the lobby that should be displayed to users. All whitespace will be trimmed from name.</param>
/// <param name="maxPlayers">The maximum number of players allowed in the lobby. Must be greater than or equal to the current number of players in the lobby.</param>
/// <param name="isPrivate">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 &#x60;lobbyCode&#x60; with other users who can use it to join this lobby.</param>
/// <param name="data">Custom game-specific properties to add, update, or remove from the lobby (e.g. &#x60;mapName&#x60; or &#x60;gameType&#x60;). To remove an existing property, include it in &#x60;data&#x60; but set the property object to &#x60;null&#x60;. To update the value to &#x60;null&#x60;, set the &#x60;value&#x60; property of the object to &#x60;null&#x60;.</param>
/// <param name="hostId">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.</param>
[Preserve]
[DataContract(Name = "UpdateRequest")]
public class UpdateRequest

/// <param name="data">Custom game-specific properties to add, update, or remove from the lobby (e.g. &#x60;mapName&#x60; or &#x60;gameType&#x60;). To remove an existing property, include it in &#x60;data&#x60; but set the property object to &#x60;null&#x60;. To update the value to &#x60;null&#x60;, set the &#x60;value&#x60; property of the object to &#x60;null&#x60;.</param>
/// <param name="hostId">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.</param>
[Preserve]
public UpdateRequest(string name = null, int? maxPlayers = null, bool? isPrivate = null, Dictionary<string, DataObject> data = null, string hostId = null)
public UpdateRequest(string name = default, int? maxPlayers = default, bool? isPrivate = default, Dictionary<string, DataObject> data = default, string hostId = default)
Data = data;
Data = new JsonObject(data);
/// <summary>
/// The name of the lobby that should be displayed to users. All whitespace will be trimmed from name.
/// </summary>

/// Custom game-specific properties to add, update, or remove from the lobby (e.g. &#x60;mapName&#x60; or &#x60;gameType&#x60;). To remove an existing property, include it in &#x60;data&#x60; but set the property object to &#x60;null&#x60;. To update the value to &#x60;null&#x60;, set the &#x60;value&#x60; property of the object to &#x60;null&#x60;.
/// </summary>
[Preserve]
[JsonConverter(typeof(JsonObjectConverter))]
public Dictionary<string, DataObject> Data{ get; }
public JsonObject Data{ get; }
/// <summary>
/// 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.

4
Packages/com.unity.services.lobby/Runtime/Scheduler/ThreadHelper.cs


using System.Threading;
using UnityEditor;
using UnityEngine;
namespace Unity.Services.Lobbies.Scheduler

private static System.Threading.Tasks.TaskScheduler _taskScheduler;
private static int _mainThreadId;
#if UNITY_EDITOR
[InitializeOnLoadMethod]
#endif
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
public static void Init()
{

44
Packages/com.unity.services.lobby/package.json


{
"name": "com.unity.services.lobby",
"displayName": "Unity Lobby",
"version": "0.2.0-preview",
"unity": "2020.3",
"description": "Client API SDK Package for communicating with the Unity Lobby service",
"dependencies": {
"com.unity.services.core": "1.1.0-pre.2",
"com.unity.modules.unitywebrequest": "1.0.0",
"com.unity.modules.unitywebrequestassetbundle": "1.0.0",
"com.unity.modules.unitywebrequestaudio": "1.0.0",
"com.unity.modules.unitywebrequesttexture": "1.0.0",
"com.unity.modules.unitywebrequestwww": "1.0.0",
"com.unity.nuget.newtonsoft-json": "2.0.0"
},
"relatedPackages": {
"com.unity.services.lobby.tests": "0.2.0-preview"
},
"upmCi": {
"footprint": "aa7999c19cdbcfe8d97e68dde6d16c73ef3411c1"
},
"repository": {
"url": "https://github.cds.internal.unity3d.com/unity/com.unity.services.rooms.git",
"type": "git",
"revision": "902923a105886dde15661bfeb44db49ee0fdbaff"
},
"samples": [
{
"displayName": "Hello World Sample",
"description": "This sample walks through using most of the Lobby APIs in a simple, linear way.",
"path": "Samples~/HelloWorld"
"name": "com.unity.services.lobby",
"displayName":"Unity Lobby",
"version": "0.2.1-preview",
"unity": "2020.3",
"description": "Client API SDK Package for communicating with the Unity Lobby service",
"dependencies": {
"com.unity.services.core": "1.1.0-pre.2",
"com.unity.modules.unitywebrequest": "1.0.0",
"com.unity.modules.unitywebrequestassetbundle": "1.0.0",
"com.unity.modules.unitywebrequestaudio": "1.0.0",
"com.unity.modules.unitywebrequesttexture": "1.0.0",
"com.unity.modules.unitywebrequestwww": "1.0.0",
"com.unity.nuget.newtonsoft-json": "2.0.0"
]
}

2
Packages/com.unity.services.lobby/Runtime/Http/DeserializationSettings.cs.meta


fileFormatVersion: 2
guid: 36b1cdc3d10416a44ac98753d781b1c5
guid: c7097123bafddd84a882a4ef0b85a9f3
MonoImporter:
externalObjects: {}
serializedVersion: 2

9
Packages/com.unity.services.lobby/CONTRIBUTING.md


# Contributing
## If you are interested in contributing, here are some ground rules:
* ... Define guidelines & rules for what contributors need to know to successfully make Pull requests against your repo ...
## All contributions are subject to the [Unity Contribution Agreement(UCA)](https://unity3d.com/legal/licenses/Unity_Contribution_Agreement)
By making a pull request, you are confirming agreement to the terms and conditions of the UCA, including that your Contributions are your original creation and that you have complete right and authority to make your Contributions.
## Once you have a change ready following these ground rules. Simply make a pull request

7
Packages/com.unity.services.lobby/CONTRIBUTING.md.meta


fileFormatVersion: 2
guid: d997183ab5f3e4f1aabd60a9e9d99360
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

15
Packages/com.unity.services.lobby/Runtime/Http/DeserializationSettings.cs


using System;
namespace Unity.Services.Lobbies.Http
{
public enum MissingMemberHandling
{
Error,
Ignore
}
public class DeserializationSettings
{
public MissingMemberHandling MissingMemberHandling = MissingMemberHandling.Error;
}
}

53
Packages/com.unity.services.lobby/Runtime/Http/JsonObject.cs


using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Utilities;
using UnityEngine;
namespace Unity.Services.Lobbies.Http
{
public class JsonObject
{
internal JsonObject(object obj)
{
this.obj = obj;
}
internal object obj;
public string GetAsString()
{
try
{
return JsonConvert.SerializeObject(obj);
}
catch (System.Exception e)
{
throw new System.Exception("Failed to convert JsonObject to string.");
}
}
public T GetAs<T>(DeserializationSettings deserializationSettings = null)
{
// Check if derializationSettings is null so we can use the default value.
deserializationSettings = deserializationSettings ?? new DeserializationSettings();
JsonSerializerSettings jsonSettings = new JsonSerializerSettings
{
MissingMemberHandling = deserializationSettings.MissingMemberHandling == MissingMemberHandling.Error
? Newtonsoft.Json.MissingMemberHandling.Error
: Newtonsoft.Json.MissingMemberHandling.Ignore
};
try
{
return JsonConvert.DeserializeObject<T>(JsonConvert.SerializeObject(obj), jsonSettings);
}
catch (Newtonsoft.Json.JsonSerializationException e)
{
throw new DeserializationException(e.Message);
}
catch (System.Exception e)
{
throw new DeserializationException("Unable to deserialize object.");
}
}
}
}

11
Packages/com.unity.services.lobby/Runtime/Http/JsonObject.cs.meta


fileFormatVersion: 2
guid: b3487b36881411343af7b4568aaeaefa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

28
Packages/com.unity.services.lobby/Runtime/Http/JsonObjectConverter.cs


using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Utilities;
using UnityEngine;
namespace Unity.Services.Lobbies.Http
{
class JsonObjectConverter : JsonConverter
{
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
JsonObject jobj = (JsonObject) value;
JToken t = JToken.FromObject(jobj.obj);
t.WriteTo(writer);
}
public override object ReadJson(JsonReader reader, System.Type objectType, object existingValue, JsonSerializer serializer)
{
throw new System.NotImplementedException();
}
public override bool CanConvert(System.Type objectType)
{
throw new System.NotImplementedException();
}
}
}

11
Packages/com.unity.services.lobby/Runtime/Http/JsonObjectConverter.cs.meta


fileFormatVersion: 2
guid: 8a8551fcf9af54b448b0fc168977d45b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

34
Packages/com.unity.services.lobby/Runtime/Http/ResponseDeserializationException.cs


using System;
namespace Unity.Services.Lobbies.Http
{
[Serializable]
public class ResponseDeserializationException : Exception
{
public HttpClientResponse response;
public ResponseDeserializationException() : base()
{
}
public ResponseDeserializationException(string message) : base(message)
{
}
ResponseDeserializationException(string message, Exception inner) : base(message, inner)
{
}
public ResponseDeserializationException(HttpClientResponse httpClientResponse) : base(
"Unable to Deserialize Http Client Response")
{
response = httpClientResponse;
}
public ResponseDeserializationException(HttpClientResponse httpClientResponse, string message) : base(
message)
{
response = httpClientResponse;
}
}
}

11
Packages/com.unity.services.lobby/Runtime/Http/ResponseDeserializationException.cs.meta


fileFormatVersion: 2
guid: 180cd9f4e83e82043ab3a392fb6556a3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

/Packages/com.unity.services.lobby/Samples~/HelloWorld/LobbyHelloWorld.cs.meta → /Packages/com.unity.services.lobby/Runtime/Http/DeserializationSettings.cs.meta

正在加载...
取消
保存