mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-06 07:16:09 +00:00
Change "state" from string to enum in Migration Response.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
/// <summary>
|
||||
/// The state of migration. Can be one of pending, exporting, exported and failed.
|
||||
/// </summary>
|
||||
public string State { get; private set; }
|
||||
public MigrationState State { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether to lock repositories.
|
||||
@@ -94,5 +94,34 @@ namespace Octokit
|
||||
return string.Format(CultureInfo.InvariantCulture, "Guid: {0}", Guid);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// State of a migration.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See: https://developer.github.com/v3/migration/migrations/#get-the-status-of-a-migration
|
||||
/// </remarks>
|
||||
public enum MigrationState
|
||||
{
|
||||
/// <summary>
|
||||
/// The migration hasn't started yet.
|
||||
/// </summary>
|
||||
Pending,
|
||||
|
||||
/// <summary>
|
||||
/// The migration is in progress.
|
||||
/// </summary>
|
||||
Exporting,
|
||||
|
||||
/// <summary>
|
||||
/// The migration finished successfully.
|
||||
/// </summary>
|
||||
Exported,
|
||||
|
||||
/// <summary>
|
||||
/// The migration failed.
|
||||
/// </summary>
|
||||
Failed
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user