public static RepositoryContent ( long repositoryId ) : Uri | ||
repositoryId | long | The Id of the repository |
Результат | Uri |
public Task <IReadOnlyList <RepositoryContent> > GetAllContents(long repositoryId, string path) { Ensure.ArgumentNotNullOrEmptyString(path, nameof(path)); var url = ApiUrls.RepositoryContent(repositoryId, path); return(ApiConnection.GetAll <RepositoryContent>(url)); }
public Task <IReadOnlyList <RepositoryContent> > GetAllContentsByRef(long repositoryId, string reference) { Ensure.ArgumentNotNullOrEmptyString(reference, nameof(reference)); var url = ApiUrls.RepositoryContent(repositoryId, string.Empty, reference); return(ApiConnection.GetAll <RepositoryContent>(url)); }
/// <summary> /// Returns the contents of the root directory in a repository. /// </summary> /// <remarks> /// See the <a href="https://developer.github.com/v3/repos/contents/#get-contents">API documentation</a> for more information. /// </remarks> /// <param name="owner">The owner of the repository</param> /// <param name="name">The name of the repository</param> public Task <IReadOnlyList <RepositoryContent> > GetAllContents(string owner, string name) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); var url = ApiUrls.RepositoryContent(owner, name, string.Empty); return(ApiConnection.GetAll <RepositoryContent>(url)); }
/// <summary> /// Creates a commit that deletes a file in a repository. /// </summary> /// <param name="repositoryId">The Id of the repository</param> /// <param name="path">The path to the file</param> /// <param name="request">Information about the file to delete</param> public Task DeleteFile(int repositoryId, string path, DeleteFileRequest request) { Ensure.ArgumentNotNullOrEmptyString(path, "path"); Ensure.ArgumentNotNull(request, "request"); var deleteUrl = ApiUrls.RepositoryContent(repositoryId, path); return(ApiConnection.Delete(deleteUrl, request)); }
/// <summary> /// Creates a commit that updates the contents of a file in a repository. /// </summary> /// <param name="repositoryId">The Id of the repository</param> /// <param name="path">The path to the file</param> /// <param name="request">Information about the file to update</param> public Task <RepositoryContentChangeSet> UpdateFile(int repositoryId, string path, UpdateFileRequest request) { Ensure.ArgumentNotNullOrEmptyString(path, "path"); Ensure.ArgumentNotNull(request, "request"); var updateUrl = ApiUrls.RepositoryContent(repositoryId, path); return(ApiConnection.Put <RepositoryContentChangeSet>(updateUrl, request)); }
/// <summary> /// Returns the contents of a file or directory in a repository. /// </summary> /// <remarks> /// See the <a href="https://developer.github.com/v3/repos/contents/#get-contents">API documentation</a> for more information. /// </remarks> /// <param name="repositoryId">The Id of the repository</param> /// <param name="path">The content path</param> /// <param name="reference">The name of the commit/branch/tag. Default: the repository’s default branch (usually master)</param> public Task <IReadOnlyList <RepositoryContent> > GetAllContentsByRef(int repositoryId, string path, string reference) { Ensure.ArgumentNotNullOrEmptyString(path, "path"); Ensure.ArgumentNotNullOrEmptyString(reference, "reference"); var url = ApiUrls.RepositoryContent(repositoryId, path, reference); return(ApiConnection.GetAll <RepositoryContent>(url)); }
public Task <RepositoryContentChangeSet> CreateFile(long repositoryId, string path, CreateFileRequest request) { Ensure.ArgumentNotNullOrEmptyString(path, nameof(path)); Ensure.ArgumentNotNull(request, nameof(request)); var createUrl = ApiUrls.RepositoryContent(repositoryId, path); return(ApiConnection.Put <RepositoryContentChangeSet>(createUrl, request)); }
/// <summary> /// Returns the contents of a file or directory in a repository. /// </summary> /// <remarks> /// If given a path to a single file, this method returns a collection containing only that file. /// </remarks> /// <param name="owner">The owner of the repository</param> /// <param name="name">The name of the repository</param> /// <param name="path">The content path</param> /// <returns> /// A collection of <see cref="RepositoryContent"/> representing the content at the specified path /// </returns> public async Task <IReadOnlyList <RepositoryContent> > GetContents(string owner, string name, string path) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNullOrEmptyString(path, "path"); var url = ApiUrls.RepositoryContent(owner, name, path); return(await ApiConnection.GetAll <RepositoryContent>(url)); }
public Task <IReadOnlyList <RepositoryContent> > GetAllContents(string owner, string name, string path) { Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner)); Ensure.ArgumentNotNullOrEmptyString(name, nameof(name)); Ensure.ArgumentNotNullOrEmptyString(path, nameof(path)); var url = ApiUrls.RepositoryContent(owner, name, path); return(ApiConnection.GetAll <RepositoryContent>(url)); }
public Task <byte[]> GetRawContent(string owner, string name, string path) { Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner)); Ensure.ArgumentNotNullOrEmptyString(name, nameof(name)); Ensure.ArgumentNotNullOrEmptyString(path, nameof(path)); var url = ApiUrls.RepositoryContent(owner, name, path); return(ApiConnection.GetRaw(url, null)); }
/// <summary> /// Creates a commit that creates a new file in a repository. /// </summary> /// <param name="owner">The owner of the repository</param> /// <param name="name">The name of the repository</param> /// <param name="path">The path to the file</param> /// <param name="request">Information about the file to create</param> /// <returns></returns> public Task <RepositoryContentChangeSet> CreateFile(string owner, string name, string path, CreateFileRequest request) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNullOrEmptyString(path, "path"); Ensure.ArgumentNotNull(request, "request"); var createUrl = ApiUrls.RepositoryContent(owner, name, path); return(ApiConnection.Put <RepositoryContentChangeSet>(createUrl, request)); }
/// <summary> /// Creates a commit that deletes a file in a repository. /// </summary> /// <param name="owner">The owner of the repository</param> /// <param name="name">The name of the repository</param> /// <param name="path">The path to the file</param> /// <param name="request">Information about the file to delete</param> public Task DeleteFile(string owner, string name, string path, DeleteFileRequest request) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNullOrEmptyString(path, "path"); Ensure.ArgumentNotNull(request, "request"); var deleteUrl = ApiUrls.RepositoryContent(owner, name, path); return(ApiConnection.Delete(deleteUrl, request)); }
public Task <RepositoryContentChangeSet> UpdateFile(string owner, string name, string path, UpdateFileRequest request) { Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner)); Ensure.ArgumentNotNullOrEmptyString(name, nameof(name)); Ensure.ArgumentNotNullOrEmptyString(path, nameof(path)); Ensure.ArgumentNotNull(request, nameof(request)); var updateUrl = ApiUrls.RepositoryContent(owner, name, path); return(ApiConnection.Put <RepositoryContentChangeSet>(updateUrl, request)); }
public Task <IReadOnlyList <RepositoryContent> > GetAllContentsByRef(string owner, string name, string path, string reference) { Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner)); Ensure.ArgumentNotNullOrEmptyString(name, nameof(name)); Ensure.ArgumentNotNullOrEmptyString(path, nameof(path)); Ensure.ArgumentNotNullOrEmptyString(reference, nameof(reference)); var url = (path == "/") ? ApiUrls.RepositoryContent(owner, name, "", reference) : ApiUrls.RepositoryContent(owner, name, path, reference); return(ApiConnection.GetAll <RepositoryContent>(url)); }
/// <summary> /// Returns the contents of the root directory in a repository. /// </summary> /// <remarks> /// See the <a href="https://developer.github.com/v3/repos/contents/#get-contents">API documentation</a> for more information. /// </remarks> /// <param name="repositoryId">The Id of the repository</param> public Task <IReadOnlyList <RepositoryContent> > GetAllContents(int repositoryId) { var url = ApiUrls.RepositoryContent(repositoryId, string.Empty); return(ApiConnection.GetAll <RepositoryContent>(url)); }