/// <summary> /// Gets an existing APConnection by type and id. /// </summary> /// <param name="type">The type (relation name) of the connection.</param> /// <param name="id">The id of the connection.</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 relation, string id, ApiOptions options = null) { var request = new GetConnectionRequest { Relation = relation, Id = id }; ApiOptions.Apply(request, options); var response = await request.ExecuteAsync(); if (response.Status.IsSuccessful == false) throw response.Status.ToFault(); else return response.Connection; }
public async Task<GetConnectionResponse> GetConnectionAsync(GetConnectionRequest request) { byte[] bytes = null; bytes = await HttpOperation .WithUrl(Urls.For.GetConnection(request.Relation, request.Id, request.CurrentLocation, request.DebugEnabled, request.Verbosity, request.Fields)) .WithAppacitiveSession(request.SessionToken) .WithEnvironment(request.Environment) .WithUserToken(request.UserToken) .GetAsync(); var response = GetConnectionResponse.Parse(bytes); return response; }