public async Task <IEnumerable <Repository> > GetRepositoriesAsync( int?maxPages = null, int?limit = null, int?start = null, string name = null, string projectName = null, Permissions?permission = null, bool isPublic = false) { var queryParamValues = new Dictionary <string, object> { ["limit"] = limit, ["start"] = start, ["name"] = name, ["projectname"] = projectName, ["permission"] = BitbucketHelpers.PermissionToString(permission), ["visibility"] = isPublic ? "public" : "private" }; return(await GetPagedResultsAsync(maxPages, queryParamValues, async qpv => await GetReposUrl() .SetQueryParams(qpv) .GetJsonAsync <PagedResults <Repository> >() .ConfigureAwait(false)) .ConfigureAwait(false)); }
public async Task <ProjectKey> CreateProjectKeyAsync(string projectKey, string keyText, Permissions permission) { var data = new { key = new { text = keyText }, permission = BitbucketHelpers.PermissionToString(permission) }; var response = await GetKeysUrl($"/projects/{projectKey}/ssh") .PostJsonAsync(data) .ConfigureAwait(false); return(await HandleResponseAsync <ProjectKey>(response).ConfigureAwait(false)); }
public async Task <IEnumerable <Repository> > GetRecentReposAsync(Permissions?permission = null, int?maxPages = null, int?limit = null, int?start = null) { var queryParamValues = new Dictionary <string, object> { ["limit"] = limit, ["start"] = start, ["permission"] = BitbucketHelpers.PermissionToString(permission) }; return(await GetPagedResultsAsync(maxPages, queryParamValues, async qpv => await GetProfileUrl("/recent/repos") .SetQueryParams(qpv) .GetJsonAsync <PagedResults <Repository> >() .ConfigureAwait(false)) .ConfigureAwait(false)); }
public async Task <IEnumerable <ProjectKey> > GetProjectKeysAsync(string projectKey, string filter = null, Permissions?permission = null, int?maxPages = null, int?limit = null, int?start = null) { var queryParamValues = new Dictionary <string, object> { ["limit"] = limit, ["start"] = start, ["filter"] = filter, ["permission"] = BitbucketHelpers.PermissionToString(permission) }; return(await GetPagedResultsAsync(maxPages, queryParamValues, async qpv => await GetKeysUrl($"/projects/{projectKey}/ssh") .SetQueryParams(qpv) .GetJsonAsync <PagedResults <ProjectKey> >() .ConfigureAwait(false)) .ConfigureAwait(false)); }
protected override string ConvertToString(Permissions value) { return(BitbucketHelpers.PermissionToString(value)); }
public async Task <RepositoryKey> UpdateRepoKeyPermissionAsync(string projectKey, string repositorySlug, int keyId, Permissions permission) { var response = await GetKeysUrl($"/projects/{projectKey}/repos/{repositorySlug}/ssh/{keyId}/permissions/{BitbucketHelpers.PermissionToString(permission)}") .PutAsync(new StringContent("")) .ConfigureAwait(false); return(await HandleResponseAsync <RepositoryKey>(response).ConfigureAwait(false)); }