[WIP] Fixes #1718 Implement Repository Transfer functionality (#1813)

* Add "transfer repository" accept header

* Create RepositoryTransfer class

This will be used to send the POST request to initiate the transfer.

* Create Ensure method to check for empty or null arrays

* Change arg name in Ensure for nonempty arrays

array -> value

* Add xmldoc for ArgumentNotNullOrEmptyArray

* Create Transfer method in IRepositoriesClient

* Implement Transfer method in RepositoriesClient

* Fix typo in xmldoc for Transfer

* Add <returns> to Transfer xmldoc

* Create Transfer method in IObservableRepositoriesClient

* Implement Transfer in ObservableRepositoriesClient

* Add DebuggerDIsplayAttribute do RepositoryTransfer

* Add unit tests for RepositoryTransfer constructors

* Change TeamId property type to IReadOnlyList<int>

* Rewrite DebuggerDisplay property into something more succint

* Make new Ensure method into an IEnumerable<T> checker

* Add XmlDoc to RepositoryTransfer

* Tweaks to first ctor XmlDoc

* Create basic unit tests for Transfer

* Create ApiUrls.RepositoryTransfer

* Use ApiUrls.RepositoryTransfer to get URI in Transfer

Previous implementation used wrong URI

* Start implementing RepositoriesClientTests.TheTransferMethod

* Implement org -> user transfer integration test

* Implement user -> org transfer integration test

* [WIP] Implement user -> org transfer with teams

Implementation doesn't work, API usage seems correct.

* Mark transfer user -> org w/ teams integration test with FIXME

* Add second end point URI to ApiUrls

* Add other Transfer overload to RepositoriesClient for other end point

* Create unit tests for other Transfer endpoint

* Add overload to IRepositoriesClient

* Add integration tests for overload

* Reorganize unit tests for TheTransferMethod

* Rename id to repositoryId

* Reorganize unit tests for RepositoriesClientTests.Transfer

* Add second endpoint to IObservableRepositoriesClient

* Add XmlDoc to second Transfer endpoint

* Add XmlDoc to second Transfer endpoint in RepositoriesClient

* Reimplement "with teams" integration tests using TeamContext

* Rename integration test for consistency

* Add asserts to actual ownership transfer

* Rename RepositoryTransfer.TeamId property to TeamIds

* Add awaiit to ThrowsAsync in RepositoriesClientTests

* Put await in right places for unit tests

* Add Ensures for Transfer method in RepositoriesClient

* Add XmlDoc to ApiUrls.RepositoryTransfer with repo id

* Update XmlDoc for RepositoryTransfer constructor and teamIds property

* Rename currentOwner to owner

* Add Ensure guards to ObservableRepositoriesClient.Transfer methods

* Add unit tests for ObservableRepositoriesClient
This commit is contained in:
William Quelho Ferreira
2018-06-24 09:33:33 -03:00
committed by Ryan Gribble
parent fb928f68d5
commit 74dc51a6f5
12 changed files with 637 additions and 0 deletions

View File

@@ -1834,6 +1834,27 @@ namespace Octokit
return "repos/{0}/{1}/tags".FormatUri(owner, name);
}
/// <summary>
/// Returns the <see cref="Uri"/> for a repository transfer.
/// </summary>
/// <param name="owner">The current owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <returns></returns>
public static Uri RepositoryTransfer(string owner, string name)
{
return "repos/{0}/{1}/transfer".FormatUri(owner, name);
}
/// <summary>
/// Returns the <see cref="Uri"/> for a repository transfer.
/// </summary>
/// <param name="repositoryId">The id of the repository</param>
/// <returns></returns>
public static Uri RepositoryTransfer(long repositoryId)
{
return "repositories/{0}/transfer".FormatUri(repositoryId);
}
/// <summary>
/// Returns the <see cref="Uri"/> for repository commits.
/// </summary>