private Dictionary <string, object> AddVersionCriteria(VersionSearchFilter filter, Dictionary <string, object> arguments) { if (filter.Type.HasValue) { arguments.Add("versionType", filter.Type.ToString()); if (filter.Type.Value != VersionType.Latest && filter.Type.Value != VersionType.Tip) { arguments.Add("version", filter.Value); } } if (filter.Options.HasValue) { arguments.Add("versionOptions", filter.Options.ToString()); } if (filter.Recursion.HasValue) { arguments.Add("recursionLevel", filter.Recursion.ToString()); } return(arguments); }
/// <summary> /// Get version control item metadata /// </summary> /// <param name="filter"></param> /// <returns></returns> public async Task <VersionControlItemVersion> GetVersionControlItem(VersionSearchFilter filter) { string response = await GetResponse(string.Format("items/{0}", filter.Path), AddVersionCriteria(filter, new Dictionary <string, object>())); return(JsonConvert.DeserializeObject <VersionControlItemVersion>(response)); }
/// <summary> /// Get version control item metadata /// </summary> /// <param name="filter"></param> /// <returns></returns> public async Task <JsonCollection <VersionControlItemVersion> > GetVersionControlItemVersions(VersionSearchFilter filter) { var arguments = new Dictionary <string, object>() { { "scopepath", filter.Path } }; string response = await GetResponse("items", AddVersionCriteria(filter, arguments)); return(JsonConvert.DeserializeObject <JsonCollection <VersionControlItemVersion> >(response)); }
/// <summary> /// Get file content /// </summary> /// <param name="filter"></param> /// <returns></returns> public async Task <string> GetVersionControlItemContent(VersionSearchFilter filter) { return(await GetResponse(string.Format("items/{0}", filter.Path), AddVersionCriteria(filter, new Dictionary <string, object>()), null, MediaType.HTML_MEDIA_TYPE)); }
private Dictionary<string, object> AddVersionCriteria(VersionSearchFilter filter, Dictionary<string, object> arguments) { if (filter.Type.HasValue) { arguments.Add("versionType", filter.Type.ToString()); if (filter.Type.Value != VersionType.Latest && filter.Type.Value != VersionType.Tip) { arguments.Add("version", filter.Value); } } if (filter.Options.HasValue) { arguments.Add("versionOptions", filter.Options.ToString()); } if (filter.Recursion.HasValue) { arguments.Add("recursionLevel", filter.Recursion.ToString()); } return arguments; }
/// <summary> /// Get version control item metadata /// </summary> /// <param name="filter"></param> /// <returns></returns> public async Task<JsonCollection<VersionControlItemVersion>> GetVersionControlItemVersions(VersionSearchFilter filter) { var arguments = new Dictionary<string, object>() { { "scopepath", filter.Path } }; string response = await GetResponse("items", AddVersionCriteria(filter, arguments)); return JsonConvert.DeserializeObject<JsonCollection<VersionControlItemVersion>>(response); }
/// <summary> /// Get version control item metadata /// </summary> /// <param name="filter"></param> /// <returns></returns> public async Task<VersionControlItemVersion> GetVersionControlItem(VersionSearchFilter filter) { string response = await GetResponse(string.Format("items/{0}", filter.Path), AddVersionCriteria(filter, new Dictionary<string, object>())); return JsonConvert.DeserializeObject<VersionControlItemVersion>(response); }
/// <summary> /// Get file content /// </summary> /// <param name="filter"></param> /// <returns></returns> public async Task<string> GetVersionControlItemContent(VersionSearchFilter filter) { return await GetResponse(string.Format("items/{0}", filter.Path), AddVersionCriteria(filter, new Dictionary<string, object>()), null, MediaType.HTML_MEDIA_TYPE); }