コード例 #1
0
 public async Task<GetConnectionByEndpointResponse> GetConnectionByEndpointAsync(GetConnectionByEndpointRequest request)
 {
     byte[] bytes = null;
     bytes = await HttpOperation
                 .WithUrl(Urls.For.GetConnectionByEndpointAsync(request.Relation, request.ArticleId1, request.ArticleId2, request.CurrentLocation, request.DebugEnabled, request.Verbosity, request.Fields))
                 .WithAppacitiveSession(request.SessionToken)
                 .WithEnvironment(request.Environment)
                 .WithUserToken(request.UserToken)
                 .GetAsync();
     var response = GetConnectionByEndpointResponse.Parse(bytes);
     return response;
 }
コード例 #2
0
 /// <summary>
 /// Gets an existing APConnection by its endpoints and type.
 /// </summary>
 /// <param name="type">Type of the connection.</param>
 /// <param name="endpointObjectId1">Id of the object for endpoint 1.</param>
 /// <param name="endpointObjectId2">Id of the object for endpoint 2.</param>
 /// <param name="options">Request specific api options. These will override the global settings for the app for this request.</param>
 /// <returns>The matching APConnection object.</returns>
 public async static Task<APConnection> GetAsync(string type, string endpointObjectId1, string endpointObjectId2, ApiOptions options = null)
 {
     var request = new GetConnectionByEndpointRequest
     {
         Relation = type,
         ObjectId1 = endpointObjectId1,
         ObjectId2 = endpointObjectId2
     };
     ApiOptions.Apply(request, options);
     var response = await request.ExecuteAsync();
     if (response.Status.IsSuccessful == false)
         throw response.Status.ToFault();
     else
         return response.Connection;
 }