public IEnumerator RemoveUserFromSession(string @namespace, string accessToken, string channelName, string matchId, string userId, MatchmakingResult body, ResultCallback callback) { Assert.IsFalse(string.IsNullOrEmpty(accessToken), "RemoveUserFromSession failed. accessToken parameter is null or empty!"); Assert.IsFalse(string.IsNullOrEmpty(matchId), "RemoveUserFromSession failed. accessToken parameter is null or empty!"); Assert.IsFalse(string.IsNullOrEmpty(channelName), "RemoveUserFromSession failed, channelName is null or empty!"); Assert.IsFalse(string.IsNullOrEmpty(userId), "RemoveUserFromSession failed, userId is null or empty!"); var requestBuilder = HttpRequestBuilder.CreateDelete(this.baseUrl + "/v1/admin/namespaces/{namespace}/channels/{channelName}/sessions/{matchId}/users/{userId}") .WithPathParam("namespace", @namespace) .WithPathParam("channelName", channelName) .WithPathParam("matchId", matchId) .WithPathParam("userId", userId) .WithBearerAuth(accessToken) .WithContentType(MediaType.ApplicationJson) .Accepts(MediaType.ApplicationJson); if (body != null) { requestBuilder.WithBody(body.ToJsonString()); } var request = requestBuilder.GetResult(); IHttpResponse respose = null; yield return(this.httpClient.SendRequest(request, rsp => respose = rsp)); var result = respose.TryParse(); callback.Try(result); }
public IEnumerator EnqueueJoinableSession(string @namespace, string accessToken, MatchmakingResult body, ResultCallback callback) { Assert.IsFalse(string.IsNullOrEmpty(accessToken), "RegisterSession failed. accessToken parameter is null!"); Assert.IsNotNull(body, "RegisterSession failed. body parameter is null"); var request = HttpRequestBuilder.CreatePost(this.baseUrl + "/namespaces/{namespace}/sessions") .WithPathParam("namespace", @namespace) .WithBearerAuth(accessToken) .WithContentType(MediaType.ApplicationJson) .Accepts(MediaType.ApplicationJson) .WithBody(body.ToJsonString()) .GetResult(); IHttpResponse response = null; yield return(this.httpClient.SendRequest(request, rsp => response = rsp)); var result = response.TryParse(); callback.Try(result); }