// Copyright Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using EpicGames.Horde.Issues;
#pragma warning disable CA2227 // Change x to be read-only by removing the property setter
namespace EpicGames.Horde.Ugs
{
///
/// Review by a user of a particular change
///
public enum UgsUserVote
{
///
/// No vote for the current change
///
None,
///
/// Succesfully compiled the change
///
CompileSuccess,
///
/// Failed to compile the change
///
CompileFailure,
///
/// Manually marked the change as good
///
Good,
///
/// Manually marked the change as bad
///
Bad
}
///
/// State of a badge
///
public enum UgsBadgeState
{
///
/// Starting work on this badge, outcome currently unknown
///
Starting,
///
/// Badge failed
///
Failure,
///
/// Badge produced a warning
///
Warning,
///
/// Badge succeeded
///
Success,
///
/// Badge was skipped
///
Skipped,
}
///
/// Adds a new badge to the change
///
public class AddUgsBadgeRequest
{
///
/// Name of the badge
///
[Required]
public string Name { get; set; } = String.Empty;
///
/// Url for the badge
///
public Uri? Url { get; set; }
///
/// Current status of the badge
///
public UgsBadgeState State { get; set; }
}
///
/// Request object for adding new metadata to the server
///
public class AddUgsMetadataRequest
{
///
/// The stream name
///
[Required]
public string Stream { get; set; } = null!;
///
/// The changelist number
///
[Required]
public int Change { get; set; }
///
/// The project name
///
public string? Project { get; set; }
///
/// Name of the current user
///
public string? UserName { get; set; }
///
/// Whether this changelist has been synced by the user
///
public bool? Synced { get; set; }
///
/// State of the user
///
public UgsUserVote? Vote { get; set; }
///
/// New starred state for the issue
///
public bool? Starred { get; set; }
///
/// Whether the user is investigating
///
public bool? Investigating { get; set; }
///
/// Comment for this change
///
public string? Comment { get; set; }
///
/// List of badges to add
///
public List? Badges { get; set; }
}
///
/// Information about a user synced to a change
///
public class GetUgsUserResponse
{
///
/// Name of the user
///
public string User { get; set; } = String.Empty;
///
/// Time that the change was synced
///
public long? SyncTime { get; set; }
///
/// State of the user
///
public UgsUserVote? Vote { get; set; }
///
/// Comment by this user
///
public string? Comment { get; set; }
///
/// Whether the user is investigating this change
///
public bool? Investigating { get; set; }
///
/// Whether this changelist is starred
///
public bool? Starred { get; set; }
}
///
/// Information about a badge
///
public class GetUgsBadgeResponse
{
///
/// Name of the badge
///
public string Name { get; set; } = String.Empty;
///
/// Url for the badge
///
public Uri? Url { get; set; }
///
/// Current status of the badge
///
public UgsBadgeState State { get; set; }
}
///
/// Response object for querying metadata
///
public class GetUgsMetadataResponse
{
///
/// Number of the changelist
///
public int Change { get; set; }
///
/// The project name
///
public string? Project { get; set; }
///
/// Information about a user synced to this change
///
public List? Users { get; set; }
///
/// Badges for this change
///
public List? Badges { get; set; }
}
///
/// Response object for querying metadata
///
public class GetUgsMetadataListResponse
{
///
/// Last time that the metadata was modified
///
public long SequenceNumber { get; set; }
///
/// List of changes matching the requested criteria
///
public List Items { get; set; } = new List();
}
///
/// Outcome of a particular build
///
public enum UgsIssueBuildOutcome
{
///
/// Unknown outcome
///
Unknown,
///
/// Build succeeded
///
Success,
///
/// Build failed
///
Error,
///
/// Build finished with warnings
///
Warning,
}
///
/// Legacy response describing a build
///
public class GetUgsIssueBuildResponse
{
///
/// Identifier for this build
///
public long Id { get; set; }
///
/// Path to the stream containing this build
///
public string Stream { get; set; }
///
/// The changelist number for this build
///
public int Change { get; set; }
///
/// Name of this job
///
public string? JobName { get; set; }
///
/// Link to the job
///
public Uri? JobUrl { get; set; }
///
/// Name of the job step
///
public string? JobStepName { get; set; }
///
/// Link to the job step
///
public Uri? JobStepUrl { get; set; }
///
/// Url for this particular error
///
public Uri? ErrorUrl { get; set; }
///
/// Outcome of this build (see )
///
public int Outcome { get; set; }
///
///
///
///
///
///
public GetUgsIssueBuildResponse(string stream, int change, IssueBuildOutcome outcome)
{
Stream = stream;
Change = change;
Outcome = (int)outcome;
}
}
///
/// Information about a diagnostic
///
public class GetUgsIssueDiagnosticResponse
{
///
/// The corresponding build id
///
public long? BuildId { get; set; }
///
/// Message for the diagnostic
///
public string Message { get; set; }
///
/// Link to the error
///
public Uri Url { get; set; }
///
/// Constructor
///
/// The corresponding build id
/// Message for the diagnostic
/// Link to the diagnostic
public GetUgsIssueDiagnosticResponse(long? buildId, string message, Uri url)
{
BuildId = buildId;
Message = message;
Url = url;
}
}
///
/// Stores information about a build health issue
///
public class GetUgsIssueResponse
{
///
/// Version number for this response
///
public int Version { get; set; } = 1;
///
/// The unique object id
///
public int Id { get; set; }
///
/// Time at which the issue was created
///
public DateTime CreatedAt { get; set; }
///
/// Time at which the issue was retrieved
///
public DateTime RetrievedAt { get; set; }
///
/// The associated project for the issue
///
public string? Project { get; set; }
///
/// The summary text for this issue
///
public string Summary { get; set; } = String.Empty;
///
/// Owner of the issue
///
public string? Owner { get; set; }
///
/// User that nominated the current owner
///
public string? NominatedBy { get; set; }
///
/// Time that the issue was acknowledged
///
public DateTime? AcknowledgedAt { get; set; }
///
/// Changelist that fixed this issue
///
public int? FixChange { get; set; }
///
/// Time at which the issue was resolved
///
public DateTime? ResolvedAt { get; set; }
///
/// Whether to notify the user about this issue
///
public bool BNotify { get; set; }
///
/// Whether this issue just contains warnings
///
public bool BWarning { get; set; }
///
/// Link to the last build
///
public Uri? BuildUrl { get; set; }
///
/// List of streams affected by this issue
///
public List Streams { get; set; } = new List();
}
///
/// Request an issue to be updated
///
public class UpdateUgsIssueRequest
{
///
/// New owner of the issue
///
public string? Owner { get; set; }
///
/// User than nominates the new owner
///
public string? NominatedBy { get; set; }
///
/// Whether the issue has been acknowledged
///
public bool? Acknowledged { get; set; }
///
/// Name of the user that declines the issue
///
public string? DeclinedBy { get; set; }
///
/// The change at which the issue is claimed fixed. 0 = not fixed, -1 = systemic issue.
///
public int? FixChange { get; set; }
///
/// Whether the issue should be marked as resolved
///
public bool? Resolved { get; set; }
///
/// Name of the user that resolved the issue
///
public string? ResolvedBy { get; set; }
}
}