功能修改
This commit is contained in:
@@ -0,0 +1,389 @@
|
||||
package domain
|
||||
|
||||
import "time"
|
||||
|
||||
type GameClientBridgeCommandState string
|
||||
|
||||
const (
|
||||
GameClientBridgeCommandPending GameClientBridgeCommandState = "pending"
|
||||
GameClientBridgeCommandClaimed GameClientBridgeCommandState = "claimed"
|
||||
GameClientBridgeCommandSucceeded GameClientBridgeCommandState = "succeeded"
|
||||
GameClientBridgeCommandFailed GameClientBridgeCommandState = "failed"
|
||||
GameClientBridgeCommandCancelled GameClientBridgeCommandState = "cancelled"
|
||||
GameClientBridgeCommandExpired GameClientBridgeCommandState = "expired"
|
||||
)
|
||||
|
||||
type GameClientBridgeApprovalState string
|
||||
|
||||
const (
|
||||
GameClientBridgeApprovalNotRequired GameClientBridgeApprovalState = "not_required"
|
||||
GameClientBridgeApprovalPending GameClientBridgeApprovalState = "pending"
|
||||
GameClientBridgeApprovalApproved GameClientBridgeApprovalState = "approved"
|
||||
GameClientBridgeApprovalRejected GameClientBridgeApprovalState = "rejected"
|
||||
)
|
||||
|
||||
type GameClientBridgeApprovalLevel string
|
||||
|
||||
const (
|
||||
GameClientBridgeApprovalLevelNone GameClientBridgeApprovalLevel = "none"
|
||||
GameClientBridgeApprovalLevelOperator GameClientBridgeApprovalLevel = "operator"
|
||||
GameClientBridgeApprovalLevelPlatformAdmin GameClientBridgeApprovalLevel = "platform-admin"
|
||||
)
|
||||
|
||||
type GameClientBridgeCommandDeclaration struct {
|
||||
Type string
|
||||
Title string
|
||||
Permission string
|
||||
ApprovalLevel GameClientBridgeApprovalLevel
|
||||
PayloadSchemaRef string
|
||||
ResultSchemaRef string
|
||||
TimeoutSeconds int
|
||||
MaxPayloadBytes int
|
||||
}
|
||||
|
||||
type GameClientBridgeSnapshotDeclaration struct {
|
||||
Type string
|
||||
SchemaVersion string
|
||||
SchemaRef string
|
||||
Retention GameClientBridgeRetention
|
||||
}
|
||||
|
||||
type GameClientBridgeQueryTemplateDeclaration struct {
|
||||
Key string
|
||||
Title string
|
||||
Permission string
|
||||
Engine string
|
||||
TransportKey string
|
||||
TargetKey string
|
||||
ParameterSchemaRef string
|
||||
ResultSchemaRef string
|
||||
MaxRows int
|
||||
TimeoutSeconds int
|
||||
}
|
||||
|
||||
type GameClientBridgePageContract struct {
|
||||
PageKey string
|
||||
CommandTypes []string
|
||||
SnapshotTypes []string
|
||||
QueryTemplateKeys []string
|
||||
}
|
||||
|
||||
type GameClientBridgeCompanionDeclaration struct {
|
||||
ProfileKey string
|
||||
ConfigTemplateKey string
|
||||
ConfigSchemaRef string
|
||||
ConfigFormat string
|
||||
PlatformBaseURLSource string
|
||||
RegistrationProof string
|
||||
ProofMaterialSource string
|
||||
ProofMaterialEnv string
|
||||
SessionMode string
|
||||
TLSPolicy string
|
||||
HeartbeatIntervalSeconds int
|
||||
CommandPollIntervalSeconds int
|
||||
RequestTimeoutSeconds int
|
||||
}
|
||||
|
||||
type GameClientBridgeManifest struct {
|
||||
Commands []GameClientBridgeCommandDeclaration
|
||||
Snapshots []GameClientBridgeSnapshotDeclaration
|
||||
QueryTemplates []GameClientBridgeQueryTemplateDeclaration
|
||||
Retention GameClientBridgeRetention
|
||||
Pages []GameClientBridgePageContract
|
||||
Companion GameClientBridgeCompanionDeclaration
|
||||
}
|
||||
|
||||
type GameClientBridgeResultStatus string
|
||||
|
||||
const (
|
||||
GameClientBridgeResultSucceeded GameClientBridgeResultStatus = "succeeded"
|
||||
GameClientBridgeResultFailed GameClientBridgeResultStatus = "failed"
|
||||
GameClientBridgeResultCancelled GameClientBridgeResultStatus = "cancelled"
|
||||
)
|
||||
|
||||
type GameClientBridgeCommand struct {
|
||||
ID string
|
||||
ServerInstanceID string
|
||||
PluginID string
|
||||
ProfileKey string
|
||||
CommandType string
|
||||
Payload map[string]any
|
||||
IdempotencyKey string
|
||||
Priority int
|
||||
State GameClientBridgeCommandState
|
||||
ApprovalState GameClientBridgeApprovalState
|
||||
RequesterID string
|
||||
Claim GameClientBridgeClaim
|
||||
Cancellation GameClientBridgeCancellation
|
||||
Result GameClientBridgeResult
|
||||
AuditReferences []string
|
||||
ExpiresAt time.Time
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
CompletedAt time.Time
|
||||
}
|
||||
|
||||
type GameClientBridgeClaim struct {
|
||||
SessionID string
|
||||
InstallationID string
|
||||
DeploymentGeneration int
|
||||
FencingToken uint64
|
||||
LeaseExpiresAt time.Time
|
||||
ClaimedAt time.Time
|
||||
AcknowledgedAt time.Time
|
||||
}
|
||||
|
||||
type GameClientBridgeCancellation struct {
|
||||
RequestedBy string
|
||||
Reason string
|
||||
CancelledAt time.Time
|
||||
}
|
||||
|
||||
type GameClientBridgeResult struct {
|
||||
Status GameClientBridgeResultStatus
|
||||
Summary string
|
||||
Payload map[string]any
|
||||
CompletedBy string
|
||||
CompletedAt time.Time
|
||||
}
|
||||
|
||||
type GameClientBridgeSnapshot struct {
|
||||
ID string
|
||||
ServerInstanceID string
|
||||
PluginID string
|
||||
ProfileKey string
|
||||
Type string
|
||||
SchemaVersion string
|
||||
StreamKey string
|
||||
Sequence uint64
|
||||
SourceSessionID string
|
||||
ObservedAt time.Time
|
||||
Payload map[string]any
|
||||
Retention GameClientBridgeRetention
|
||||
AuditReferences []string
|
||||
CreatedAt time.Time
|
||||
ExpiresAt time.Time
|
||||
}
|
||||
|
||||
type GameClientBridgeSnapshotStream struct {
|
||||
ID string
|
||||
ServerInstanceID string
|
||||
PluginID string
|
||||
ProfileKey string
|
||||
Type string
|
||||
StreamKey string
|
||||
LatestSequence uint64
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
|
||||
type GameClientBridgeRetention struct {
|
||||
KeepForSeconds int
|
||||
MaxRecords int
|
||||
}
|
||||
|
||||
type GameClientBridgeAuditReference struct {
|
||||
ID string
|
||||
CommandID string
|
||||
SnapshotID string
|
||||
AuditEventID string
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
type GameClientBridgeCommandFilter struct {
|
||||
ServerInstanceID string
|
||||
PluginID string
|
||||
ProfileKey string
|
||||
State GameClientBridgeCommandState
|
||||
RequesterID string
|
||||
CommandType string
|
||||
IdempotencyKey string
|
||||
ExpiresBefore time.Time
|
||||
CompletedBefore time.Time
|
||||
}
|
||||
|
||||
type GameClientBridgeSnapshotStreamFilter struct {
|
||||
ServerInstanceID string
|
||||
PluginID string
|
||||
ProfileKey string
|
||||
Type string
|
||||
StreamKey string
|
||||
}
|
||||
|
||||
type GameClientBridgeSnapshotFilter struct {
|
||||
ServerInstanceID string
|
||||
PluginID string
|
||||
ProfileKey string
|
||||
Type string
|
||||
StreamKey string
|
||||
ObservedAfter time.Time
|
||||
ExpiresBefore time.Time
|
||||
Limit int
|
||||
}
|
||||
|
||||
type GameClientBridgeQueueRequest struct {
|
||||
ServerInstanceID string
|
||||
PluginID string
|
||||
ProfileKey string
|
||||
CommandType string
|
||||
Payload map[string]any
|
||||
IdempotencyKey string
|
||||
Priority int
|
||||
ExpiresAt time.Time
|
||||
}
|
||||
|
||||
type GameClientBridgeClaimRequest struct {
|
||||
SessionToken string
|
||||
Limit int
|
||||
}
|
||||
|
||||
type GameClientBridgeAckRequest struct {
|
||||
SessionToken string
|
||||
CommandID string
|
||||
FencingToken uint64
|
||||
}
|
||||
|
||||
type GameClientBridgeResultRequest struct {
|
||||
SessionToken string
|
||||
CommandID string
|
||||
FencingToken uint64
|
||||
Status GameClientBridgeResultStatus
|
||||
Summary string
|
||||
Payload map[string]any
|
||||
}
|
||||
|
||||
type GameClientBridgeCancelRequest struct {
|
||||
CommandID string
|
||||
Reason string
|
||||
}
|
||||
|
||||
type GameClientBridgeSnapshotIngestRequest struct {
|
||||
SessionToken string
|
||||
Type string
|
||||
SchemaVersion string
|
||||
StreamKey string
|
||||
Sequence uint64
|
||||
ObservedAt time.Time
|
||||
Payload map[string]any
|
||||
Retention GameClientBridgeRetention
|
||||
}
|
||||
|
||||
type GameClientBridgeSnapshotQuery struct {
|
||||
ServerInstanceID string
|
||||
PluginID string
|
||||
ProfileKey string
|
||||
Type string
|
||||
StreamKey string
|
||||
ObservedAfter time.Time
|
||||
Limit int
|
||||
}
|
||||
|
||||
type GameClientBridgeProfileDeclaration struct {
|
||||
PluginID string
|
||||
ProfileKey string
|
||||
Available bool
|
||||
Reason string
|
||||
CommandTypes []string
|
||||
SnapshotTypes []string
|
||||
QueryTemplateKeys []string
|
||||
}
|
||||
|
||||
type GameClientBridgeStatus struct {
|
||||
ServerInstanceID string
|
||||
PluginID string
|
||||
Available bool
|
||||
Reason string
|
||||
Profiles []GameClientBridgeProfileDeclaration
|
||||
}
|
||||
|
||||
func CopyGameClientBridgeProfileDeclaration(value GameClientBridgeProfileDeclaration) GameClientBridgeProfileDeclaration {
|
||||
value.CommandTypes = CopyStringSlice(value.CommandTypes)
|
||||
value.SnapshotTypes = CopyStringSlice(value.SnapshotTypes)
|
||||
value.QueryTemplateKeys = CopyStringSlice(value.QueryTemplateKeys)
|
||||
return value
|
||||
}
|
||||
|
||||
func CopyGameClientBridgeStatus(value GameClientBridgeStatus) GameClientBridgeStatus {
|
||||
value.Profiles = append([]GameClientBridgeProfileDeclaration(nil), value.Profiles...)
|
||||
for index := range value.Profiles {
|
||||
value.Profiles[index] = CopyGameClientBridgeProfileDeclaration(value.Profiles[index])
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
func CopyGameClientBridgeCommand(value GameClientBridgeCommand) GameClientBridgeCommand {
|
||||
value.Payload = CopyGameClientBridgePayload(value.Payload)
|
||||
value.Claim = CopyGameClientBridgeClaim(value.Claim)
|
||||
value.Cancellation = CopyGameClientBridgeCancellation(value.Cancellation)
|
||||
value.Result = CopyGameClientBridgeResult(value.Result)
|
||||
value.AuditReferences = CopyStringSlice(value.AuditReferences)
|
||||
return value
|
||||
}
|
||||
|
||||
func CopyGameClientBridgeClaim(value GameClientBridgeClaim) GameClientBridgeClaim { return value }
|
||||
|
||||
func CopyGameClientBridgeCancellation(value GameClientBridgeCancellation) GameClientBridgeCancellation {
|
||||
return value
|
||||
}
|
||||
|
||||
func CopyGameClientBridgeResult(value GameClientBridgeResult) GameClientBridgeResult {
|
||||
value.Payload = CopyGameClientBridgePayload(value.Payload)
|
||||
return value
|
||||
}
|
||||
|
||||
func CopyGameClientBridgeSnapshot(value GameClientBridgeSnapshot) GameClientBridgeSnapshot {
|
||||
value.Payload = CopyGameClientBridgePayload(value.Payload)
|
||||
value.Retention = CopyGameClientBridgeRetention(value.Retention)
|
||||
value.AuditReferences = CopyStringSlice(value.AuditReferences)
|
||||
return value
|
||||
}
|
||||
|
||||
func CopyGameClientBridgeSnapshotStream(value GameClientBridgeSnapshotStream) GameClientBridgeSnapshotStream {
|
||||
return value
|
||||
}
|
||||
|
||||
func CopyGameClientBridgeRetention(value GameClientBridgeRetention) GameClientBridgeRetention {
|
||||
return value
|
||||
}
|
||||
|
||||
func CopyGameClientBridgeAuditReference(value GameClientBridgeAuditReference) GameClientBridgeAuditReference {
|
||||
return value
|
||||
}
|
||||
|
||||
func CopyGameClientBridgePayload(value map[string]any) map[string]any {
|
||||
if value == nil {
|
||||
return nil
|
||||
}
|
||||
copy := make(map[string]any, len(value))
|
||||
for key, item := range value {
|
||||
copy[key] = copyGameClientBridgePayloadValue(item)
|
||||
}
|
||||
return copy
|
||||
}
|
||||
|
||||
func CopyGameClientBridgeManifest(value GameClientBridgeManifest) GameClientBridgeManifest {
|
||||
value.Commands = append([]GameClientBridgeCommandDeclaration(nil), value.Commands...)
|
||||
value.Snapshots = append([]GameClientBridgeSnapshotDeclaration(nil), value.Snapshots...)
|
||||
value.QueryTemplates = append([]GameClientBridgeQueryTemplateDeclaration(nil), value.QueryTemplates...)
|
||||
value.Pages = append([]GameClientBridgePageContract(nil), value.Pages...)
|
||||
for index := range value.Pages {
|
||||
value.Pages[index].CommandTypes = CopyStringSlice(value.Pages[index].CommandTypes)
|
||||
value.Pages[index].SnapshotTypes = CopyStringSlice(value.Pages[index].SnapshotTypes)
|
||||
value.Pages[index].QueryTemplateKeys = CopyStringSlice(value.Pages[index].QueryTemplateKeys)
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
func copyGameClientBridgePayloadValue(value any) any {
|
||||
switch typed := value.(type) {
|
||||
case map[string]any:
|
||||
return CopyGameClientBridgePayload(typed)
|
||||
case []any:
|
||||
copy := make([]any, len(typed))
|
||||
for index, item := range typed {
|
||||
copy[index] = copyGameClientBridgePayloadValue(item)
|
||||
}
|
||||
return copy
|
||||
default:
|
||||
return typed
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user