diff --git a/Octokit.Tests/Models/MigrationTests.cs b/Octokit.Tests/Models/MigrationTests.cs index 34255dd3..fbe81bac 100644 --- a/Octokit.Tests/Models/MigrationTests.cs +++ b/Octokit.Tests/Models/MigrationTests.cs @@ -113,7 +113,7 @@ namespace Octokit.Tests.Models private static readonly Migration migration = new Migration( id: 79, guid: "0b989ba4-242f-11e5-81e1-c7b6966d2516", - state: "exported", + state: Migration.MigrationState.Exported, lockRepositories: true, excludeAttachments: false, url: "https://api.github.com/orgs/octo-org/migrations/79", @@ -135,6 +135,7 @@ namespace Octokit.Tests.Models Assert.Equal("0b989ba4-242f-11e5-81e1-c7b6966d2516", _migration.Guid); Assert.Equal(1, _migration.Repositories.Count); Assert.Equal(1296269, _migration.Repositories[0].Id); + Assert.Equal(Migration.MigrationState.Pending, _migration.State); } } diff --git a/Octokit/Models/Response/Migration.cs b/Octokit/Models/Response/Migration.cs index 92bbc3b1..9246210e 100644 --- a/Octokit/Models/Response/Migration.cs +++ b/Octokit/Models/Response/Migration.cs @@ -23,7 +23,7 @@ namespace Octokit public Migration( int id, string guid, - string state, + MigrationState state, bool lockRepositories, bool excludeAttachments, string url, @@ -55,7 +55,7 @@ namespace Octokit /// /// The state of migration. Can be one of pending, exporting, exported and failed. /// - public string State { get; private set; } + public MigrationState State { get; private set; } /// /// Whether to lock repositories. @@ -94,5 +94,34 @@ namespace Octokit return string.Format(CultureInfo.InvariantCulture, "Guid: {0}", Guid); } } + + /// + /// State of a migration. + /// + /// + /// See: https://developer.github.com/v3/migration/migrations/#get-the-status-of-a-migration + /// + public enum MigrationState + { + /// + /// The migration hasn't started yet. + /// + Pending, + + /// + /// The migration is in progress. + /// + Exporting, + + /// + /// The migration finished successfully. + /// + Exported, + + /// + /// The migration failed. + /// + Failed + } } } \ No newline at end of file