-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Event more attributes about network objects when they are registered (#…
…698)
- Loading branch information
Showing
17 changed files
with
421 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
c-sharp/Messages/MessageEventProjectDataProviderCreated.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
using Paranext.DataProvider.JsonUtils; | ||
|
||
namespace Paranext.DataProvider.Messages; | ||
|
||
[JsonMessageDeserialization( | ||
MessageField.MESSAGE_TYPE, | ||
MessageType.EVENT, | ||
MessageField.EVENT_TYPE, | ||
Messages.EventType.OBJECT_CREATE, | ||
MessageField.OBJECT_TYPE, | ||
NetworkObjectType.PROJECT_DATA_PROVIDER | ||
)] | ||
public sealed class MessageEventProjectDataProviderCreated | ||
: MessageEventGeneric<MessageEventProjectDataProviderCreatedContents> | ||
{ | ||
/// <summary> | ||
/// ONLY FOR DESERIALIZATION | ||
/// </summary> | ||
private MessageEventProjectDataProviderCreated() | ||
: base(Messages.EventType.OBJECT_CREATE, null!) { } | ||
|
||
public MessageEventProjectDataProviderCreated( | ||
string id, | ||
string[] functions, | ||
string projectID, | ||
string projectType, | ||
string projectStorageInterpreterId | ||
) | ||
: base( | ||
Messages.EventType.OBJECT_CREATE, | ||
new MessageEventProjectDataProviderCreatedContents | ||
{ | ||
Id = id, | ||
ObjectType = NetworkObjectType.PROJECT_DATA_PROVIDER, | ||
Functions = functions, | ||
Attributes = new ProjectDataProviderAttributes | ||
{ | ||
ProjectId = projectID, | ||
ProjectType = projectType, | ||
ProjectStorageInterpreterId = projectStorageInterpreterId | ||
} | ||
} | ||
) { } | ||
} | ||
|
||
public sealed record MessageEventProjectDataProviderCreatedContents | ||
{ | ||
public string? Id { get; set; } | ||
public string? ObjectType { get; set; } | ||
public string[]? Functions { get; set; } | ||
public ProjectDataProviderAttributes? Attributes { get; set; } | ||
|
||
public override string ToString() | ||
{ | ||
return $"Id = {Id}, ObjectType = {ObjectType}, Functions = {(Functions != null ? string.Join(',', Functions) : "[null]")}, ProjectID = {Attributes?.ProjectId}, ProjectType = {Attributes?.ProjectType}, ProjectStorageInterpreterId = {Attributes?.ProjectStorageInterpreterId}"; | ||
} | ||
} | ||
|
||
public sealed record ProjectDataProviderAttributes | ||
{ | ||
public string? ProjectId { get; set; } | ||
public string? ProjectType { get; set; } | ||
public string? ProjectStorageInterpreterId { get; set; } | ||
} |
55 changes: 55 additions & 0 deletions
55
c-sharp/Messages/MessageEventProjectDataProviderFactoryCreated.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using Paranext.DataProvider.JsonUtils; | ||
|
||
namespace Paranext.DataProvider.Messages; | ||
|
||
[JsonMessageDeserialization( | ||
MessageField.MESSAGE_TYPE, | ||
MessageType.EVENT, | ||
MessageField.EVENT_TYPE, | ||
Messages.EventType.OBJECT_CREATE, | ||
MessageField.OBJECT_TYPE, | ||
NetworkObjectType.PROJECT_DATA_PROVIDER_FACTORY | ||
)] | ||
public sealed class MessageEventProjectDataProviderFactoryCreated | ||
: MessageEventGeneric<MessageEventProjectDataProviderFactoryCreatedContents> | ||
{ | ||
/// <summary> | ||
/// ONLY FOR DESERIALIZATION | ||
/// </summary> | ||
private MessageEventProjectDataProviderFactoryCreated() | ||
: base(Messages.EventType.OBJECT_CREATE, null!) { } | ||
|
||
public MessageEventProjectDataProviderFactoryCreated( | ||
string id, | ||
string[] functions, | ||
string projectType | ||
) | ||
: base( | ||
Messages.EventType.OBJECT_CREATE, | ||
new MessageEventProjectDataProviderFactoryCreatedContents | ||
{ | ||
Id = id, | ||
ObjectType = NetworkObjectType.PROJECT_DATA_PROVIDER, | ||
Functions = functions, | ||
Attributes = new ProjectDataProviderFactoryAttributes { ProjectType = projectType } | ||
} | ||
) { } | ||
} | ||
|
||
public sealed record MessageEventProjectDataProviderFactoryCreatedContents | ||
{ | ||
public string? Id { get; set; } | ||
public string? ObjectType { get; set; } | ||
public string[]? Functions { get; set; } | ||
public ProjectDataProviderFactoryAttributes? Attributes { get; set; } | ||
|
||
public override string ToString() | ||
{ | ||
return $"Id = {Id}, ObjectType = {ObjectType}, Functions = {(Functions != null ? string.Join(',', Functions) : "[null]")}, ProjectType = {Attributes?.ProjectType}"; | ||
} | ||
} | ||
|
||
public sealed record ProjectDataProviderFactoryAttributes | ||
{ | ||
public string? ProjectType { get; set; } | ||
} |
61 changes: 61 additions & 0 deletions
61
c-sharp/Messages/MessageEventProjectStorageInterpreterCreated.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
using Paranext.DataProvider.JsonUtils; | ||
|
||
namespace Paranext.DataProvider.Messages; | ||
|
||
[JsonMessageDeserialization( | ||
MessageField.MESSAGE_TYPE, | ||
MessageType.EVENT, | ||
MessageField.EVENT_TYPE, | ||
Messages.EventType.OBJECT_CREATE, | ||
MessageField.OBJECT_TYPE, | ||
NetworkObjectType.PROJECT_STORAGE_INTERPRETER | ||
)] | ||
public sealed class MessageEventProjectStorageInterpreterCreated | ||
: MessageEventGeneric<MessageEventProjectStorageInterpreterCreatedContents> | ||
{ | ||
/// <summary> | ||
/// ONLY FOR DESERIALIZATION | ||
/// </summary> | ||
private MessageEventProjectStorageInterpreterCreated() | ||
: base(Messages.EventType.OBJECT_CREATE, null!) { } | ||
|
||
public MessageEventProjectStorageInterpreterCreated( | ||
string id, | ||
string[] functions, | ||
string projectStorageType, | ||
string[] projectTypes | ||
) | ||
: base( | ||
Messages.EventType.OBJECT_CREATE, | ||
new MessageEventProjectStorageInterpreterCreatedContents | ||
{ | ||
Id = id, | ||
ObjectType = NetworkObjectType.PROJECT_STORAGE_INTERPRETER, | ||
Functions = functions, | ||
Attributes = new ProjectStorageInterpreterAttributes | ||
{ | ||
ProjectStorageType = projectStorageType, | ||
ProjectTypes = projectTypes | ||
} | ||
} | ||
) { } | ||
} | ||
|
||
public sealed record MessageEventProjectStorageInterpreterCreatedContents | ||
{ | ||
public string? Id { get; set; } | ||
public string? ObjectType { get; set; } | ||
public string[]? Functions { get; set; } | ||
public ProjectStorageInterpreterAttributes? Attributes { get; set; } | ||
|
||
public override string ToString() | ||
{ | ||
return $"Id = {Id}, ObjectType = {ObjectType}, Functions = {(Functions != null ? string.Join(',', Functions) : "[null]")}, ProjectStorageType = {Attributes?.ProjectStorageType}, ProjectType = {Attributes?.ProjectTypes}"; | ||
} | ||
} | ||
|
||
public sealed record ProjectStorageInterpreterAttributes | ||
{ | ||
public string? ProjectStorageType { get; set; } | ||
public string[]? ProjectTypes { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace Paranext.DataProvider.Messages; | ||
|
||
public static class NetworkObjectType | ||
{ | ||
public const string DATA_PROVIDER = "dataProvider"; | ||
public const string OBJECT = "object"; | ||
public const string PROJECT_DATA_PROVIDER_FACTORY = "pdpFactory"; | ||
public const string PROJECT_DATA_PROVIDER = "pdp"; | ||
public const string PROJECT_STORAGE_INTERPRETER = "psi"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.