/// <summary> /// Call a resource of the APROPLAN API with the GET method /// </summary> /// <param name="resourceName">The resource name to get</param> /// <param name="filter">The filter to apply to the get</param> /// <param name="pathToLoad">The linked property to load in the same time</param> /// <param name="additionalHeaders">Additional headers to add to the HTTP request</param> /// <returns></returns> public async Task <HttpResponse> GetRaw(string resourceName, Filter filter, PathToLoad pathToLoad, Guid?projectId = null, IDictionary <String, String> additionalParams = null) { Dictionary <string, string> queryParams = new Dictionary <string, string>(); if (filter != null) { queryParams.Add("filter", filter.ToString()); } if (pathToLoad != null) { queryParams.Add("pathtoload", pathToLoad.ToString()); } if (projectId.HasValue) { queryParams.Add("projectid", projectId.Value.ToString()); } if (additionalParams != null) { foreach (String key in additionalParams.Keys) { queryParams.Add(key, additionalParams[key]); } } return(await Request(ApiRootUrl + resourceName, ApiMethod.Get, queryParams)); }
/// <summary> /// To update new entity /// </summary> /// <typeparam name="T">The type of the entity to update</typeparam> /// <param name="entity">The entity to update</param> /// <returns>The entity updated</returns> public async Task <T> UpdateEntity <T>(T entity, Guid?projectId = null, Filter filter = null, PathToLoad pathToLoad = null, Dictionary <string, string> queryParams = null) where T : Entity { T[] entities = null; if (entity != null) { entities = new[] { entity }; } if (queryParams == null) { queryParams = new Dictionary <string, string>(); } if (filter != null) { queryParams.Add("filter", filter.ToString()); } if (pathToLoad != null) { queryParams.Add("pathtoload", pathToLoad.ToString()); } T[] newEntities = await UpdateEntities <T>(entities, projectId); return(newEntities.Length == 0 ? null : newEntities[0]); }