Skip to content

Commit

Permalink
Merge pull request #141 from bingenito/fdc3-2_1
Browse files Browse the repository at this point in the history
Update to 2.1 specification
  • Loading branch information
bingenito authored Nov 1, 2024
2 parents 958f9bd + b798e1c commit 81828fd
Show file tree
Hide file tree
Showing 63 changed files with 819 additions and 99 deletions.
5 changes: 3 additions & 2 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<Project>
<PropertyGroup>
<VersionPrefix>2.0.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
<VersionPrefix>2.1.0</VersionPrefix>
<VersionSuffix>beta.1</VersionSuffix>
<Company>Morgan Stanley</Company>
<Authors>Morgan Stanley</Authors>
<Copyright>Copyright 2023 Morgan Stanley</Copyright>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<NeutralLanguage>en-US</NeutralLanguage>
<RepositoryUrl>https://github.com/finos/fdc3-dotnet</RepositoryUrl>
<PackageTags>FDC3</PackageTags>
<WarningsNotAsErrors>NU1901;NU1902;NU1903</WarningsNotAsErrors>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/Examples/WpfFdc3/Fdc3/DesktopAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public DesktopAgent()

public Task<IListener> AddContextListener<T>(string? contextType, ContextHandler<T> handler) where T : IContext
{
return _currentChannel?.AddContextListener<T>(contextType, handler);
return _currentChannel?.AddContextListener<T>(contextType, handler) ?? throw new Exception("Unable to create listener");
}

public Task<IListener> AddIntentListener<T>(string intent, IntentHandler<T> handler) where T : IContext
Expand Down
12 changes: 6 additions & 6 deletions src/Fdc3.AppDirectory/AppChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ public class AppChannel
/// <summary>
/// Initializes a new instance of the <see cref="AppChannel"/> class.
/// </summary>
/// <param name="name">The name</param>
/// <exception cref="ArgumentNullException">Exception if name is null</exception>
public AppChannel(string name)
/// <param name="id">The ID of the App Channel</param>
/// <exception cref="ArgumentNullException">Exception if ID is null</exception>
public AppChannel(string id)
{
Name = name ?? throw new ArgumentNullException(nameof(name));
ID = id ?? throw new ArgumentNullException(nameof(id));
}
/// <summary>
/// The name of the App Channel.
/// The ID of the App Channel.
/// </summary>
public string Name { get; set; }
public string ID { get; set; }

/// <summary>
/// A description of how the channel is used.
Expand Down
7 changes: 6 additions & 1 deletion src/Fdc3.AppDirectory/Fdc3App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@ public class Fdc3App
public Fdc3App(string appId, string name, AppType type, object details)
{
AppId = appId ?? throw new ArgumentNullException(nameof(appId));
#pragma warning disable CS0618 // Type or member is obsolete
Name = name ?? throw new ArgumentNullException( nameof(name));
#pragma warning restore CS0618 // Type or member is obsolete
Type = type;
Details = details ?? throw new ArgumentNullException(nameof(details));
}

/// <summary>
/// The unique application identifier located within a specific application directory instance.
/// </summary>
Expand All @@ -43,7 +46,8 @@ public Fdc3App(string appId, string name, AppType type, object details)
/// for multiple versions of the same app. The same appName could occur in other directories.
/// We are not currently specifying app name conventions in the document.
/// </summary>
public string Name { get; set; }
[Obsolete("Use `AppId` to identify apps and `Title` for their display names.")]
public string? Name { get; set; }

/// <summary>
/// The technology type that is used to launch and run the application.
Expand Down Expand Up @@ -147,6 +151,7 @@ public Fdc3App(string appId, string name, AppType type, object details)
/// <summary>
/// An optional set of name value pairs that can be used to deliver custom data from an App Directory to a launcher.
/// </summary>
[Obsolete]
public Dictionary<string, string>? CustomConfig { get; set; }

/// <summary>
Expand Down
7 changes: 5 additions & 2 deletions src/Fdc3.AppDirectory/IntentMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ public class IntentMetadata : IIntentMetadata
/// <param name="displayName">The displayName</param>
/// <param name="contexts">The contexts</param>
/// <exception cref="ArgumentNullException">Exception contexts is null</exception>
public IntentMetadata(string name, string displayName, IEnumerable<string> contexts)
public IntentMetadata(string name, string displayName, IEnumerable<string> contexts)
{
Name = name;
#pragma warning disable CS0618 // Type or member is obsolete
DisplayName = displayName;
#pragma warning restore CS0618 // Type or member is obsolete
Contexts = contexts ?? throw new ArgumentNullException(nameof(contexts));
}

Expand All @@ -44,7 +46,8 @@ public IntentMetadata(string name, string displayName, IEnumerable<string> conte
/// <summary>
/// An optional display name for the intent that may be used in UI instead of the name.
/// </summary>
public string DisplayName { get; set; }
[Obsolete("Use the intent name for display as display name may vary for each application as it is defined in the app's AppD record.")]
public string? DisplayName { get; set; }

/// <summary>
/// A comma separated list of the types of contexts the intent offered by the application
Expand Down
5 changes: 5 additions & 0 deletions src/Fdc3.Json/Serialization/Fdc3CamelCaseNamingPolicy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ public override string ConvertName(string name)
case "SEDOL":
case "LEI":
return name;
case "TextPlain":
return "text/plain";
case "TextMarkdown":
return "text/markdown";

default:
return CamelCase.ConvertName(name);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public override string GetPropertyName(string name, bool hasSpecifiedName)
case "SEDOL":
case "LEI":
return name;
case "TextPlain":
return "text/plain";
case "TextMarkdown":
return "text/markdown";

default:
return base.GetPropertyName(name, hasSpecifiedName);
Expand Down
34 changes: 34 additions & 0 deletions src/Fdc3/Context/Action.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Morgan Stanley makes this available to you under the Apache License,
* Version 2.0 (the "License"). You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.
*
* See the NOTICE file distributed with this work for additional information
* regarding copyright ownership. Unless required by applicable law or agreed
* to in writing, software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/

namespace Finos.Fdc3.Context
{
public class Action : Context, IContext
{
public Action(string title, IContext context, string? intent, IAppIdentifier? app = null, object? id = null, string? name = null)
: base(ContextTypes.Action, id, name)
{
this.Title = title;
this.Context = context;
this.Intent = intent;
this.App = app;
}

public string Title { get; private set; }
public IContext Context { get; private set; }
public string? Intent { get; private set; }
public IAppIdentifier? App { get; private set; }

}
}
6 changes: 4 additions & 2 deletions src/Fdc3/Context/Chart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
* and limitations under the License.
*/

using System.Collections.Generic;

namespace Finos.Fdc3.Context
{
public class Chart : Context, IContext
{
public Chart(Instrument[] instruments, TimeRange? range = null, object? otherConfig = null, string? style = null, object? id = null, string? name = null)
public Chart(Instrument[] instruments, TimeRange? range = null, IEnumerable<IContext>? otherConfig = null, string? style = null, object? id = null, string? name = null)
: base(ContextTypes.Chart, id, name)
{
this.Instruments = instruments;
Expand All @@ -27,7 +29,7 @@ public Chart(Instrument[] instruments, TimeRange? range = null, object? otherCon

public Instrument[] Instruments { get; set; }
public TimeRange? Range { get; set; }
public object? OtherConfig { get; set; }
public IEnumerable<IContext>? OtherConfig { get; set; }
public string? Style { get; set; }

object? IContext<object>.ID => base.ID;
Expand Down
17 changes: 13 additions & 4 deletions src/Fdc3/Context/ChatInitSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,29 @@ namespace Finos.Fdc3.Context
{
public class ChatInitSettings : Context, IContext
{
public ChatInitSettings(ContactList? members = null, string? initMessage = null, string? chatName = null, object? options = null, object? id = null, string? name = null)
public ChatInitSettings(ContactList? members = null, Message? message = null, string? chatName = null, ChatInitSettingsOptions? options = null, object? id = null, string? name = null)
: base(ContextTypes.ChatInitSettings, id, name)
{
this.Members = members;
this.InitMessage = initMessage;
this.Message = message;
this.ChatName = chatName;
this.Options = options;
}

public string? ChatName { get; set; }
public string? InitMessage { get; set; }
public Message? Message { get; set; }
public ContactList? Members { get; set; }
public object? Options { get; set; }
public ChatInitSettingsOptions? Options { get; set; }

object? IContext<object>.ID => base.ID;
}

public class ChatInitSettingsOptions
{
public bool? GroupRecipients { get; set; }
public bool? IsPublic { get; set; }
public bool? AllowHistoryBrowsing { get; set; }
public bool? AllowMessageCopy { get; set; }
public bool? AllowAddUser { get; set; }
}
}
29 changes: 29 additions & 0 deletions src/Fdc3/Context/ChatMessage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Morgan Stanley makes this available to you under the Apache License,
* Version 2.0 (the "License"). You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.
*
* See the NOTICE file distributed with this work for additional information
* regarding copyright ownership. Unless required by applicable law or agreed
* to in writing, software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/

namespace Finos.Fdc3.Context
{
public class ChatMessage : Context, IContext, IRecipient
{
public ChatMessage(ChatRoom chatRoom, Message message, object? id = null, string? name = null)
: base(ContextTypes.ChatMessage, id, name)
{
this.ChatRoom = chatRoom;
this.Message = message;
}

public ChatRoom ChatRoom { get; set; }
public Message Message { get; set; }
}
}
29 changes: 29 additions & 0 deletions src/Fdc3/Context/ChatRoom.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Morgan Stanley makes this available to you under the Apache License,
* Version 2.0 (the "License"). You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.
*
* See the NOTICE file distributed with this work for additional information
* regarding copyright ownership. Unless required by applicable law or agreed
* to in writing, software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/

namespace Finos.Fdc3.Context
{
public class ChatRoom : Context, IContext, IRecipient
{
public ChatRoom(object id, string providerName, string? url = null, string? name = null)
: base(ContextTypes.ChatRoom, id, name)
{
this.ProviderName = providerName;
this.Url = url;
}

public string ProviderName { get; set; }
public string? Url { get; set; }
}
}
29 changes: 29 additions & 0 deletions src/Fdc3/Context/ChatSearchCriteria.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Morgan Stanley makes this available to you under the Apache License,
* Version 2.0 (the "License"). You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.
*
* See the NOTICE file distributed with this work for additional information
* regarding copyright ownership. Unless required by applicable law or agreed
* to in writing, software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/

using System.Collections;

namespace Finos.Fdc3.Context
{
public class ChatSearchCriteria : Context, IContext
{
public ChatSearchCriteria(IEnumerable criteria, object? id = null, string? name = null)
: base(ContextTypes.ChatSearchCriteria, id, name)
{
this.Criteria = criteria;
}

public IEnumerable Criteria { get; set; }
}
}
2 changes: 1 addition & 1 deletion src/Fdc3/Context/Contact.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ public class ContactID
{
public string? Email { get; set; }

public string? FdsId { get; set; }
public string? FDS_ID { get; set; }
}
}
14 changes: 13 additions & 1 deletion src/Fdc3/Context/ContextTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,38 +19,50 @@ namespace Finos.Fdc3.Context
{
public static class ContextTypes
{
public static readonly string Action = "fdc3.action";
public static readonly string Chart = "fdc3.chart";
public static readonly string ChatInitSettings = "fdc3.chat.initSettings";
public static readonly string ChatMessage = "fdc3.chat.message";
public static readonly string ChatRoom = "fdc3.chat.room";
public static readonly string ChatSearchCriteria = "fdc3.chat.searchCriteria";
public static readonly string Contact = "fdc3.contact";
public static readonly string ContactList = "fdc3.contactList";
public static readonly string Country = "fdc3.country";
public static readonly string Currency = "fdc3.currency";
public static readonly string Email = "fdc3.email";
public static readonly string Instrument = "fdc3.instrument";
public static readonly string InstrumentList = "fdc3.instrumentList";
public static readonly string Message = "fdc3.message";
public static readonly string Nothing = "fdc3.nothing";
public static readonly string Organization = "fdc3.organization";
public static readonly string Portfolio = "fdc3.portfolio";
public static readonly string Position = "fdc3.position";
public static readonly string TimeRange = "fdc3.timerange";
public static readonly string TimeRange = "fdc3.timeRange";
public static readonly string TransactionResult = "fdc3.transactionResult";
public static readonly string Valuation = "fdc3.valuation";

public static IDictionary<string, Type> Map = new Dictionary<string, Type>()
{
{ ContextTypes.Action, typeof(Action) },
{ ContextTypes.Chart, typeof(Chart) },
{ ContextTypes.ChatInitSettings, typeof(ChatInitSettings) },
{ ContextTypes.ChatMessage, typeof(ChatMessage) },
{ ContextTypes.ChatRoom, typeof(ChatRoom) },
{ ContextTypes.ChatSearchCriteria, typeof(ChatSearchCriteria) },
{ ContextTypes.Contact, typeof(Contact) },
{ ContextTypes.ContactList, typeof(ContactList) },
{ ContextTypes.Country, typeof(Country) },
{ ContextTypes.Currency, typeof(Currency) },
{ ContextTypes.Email, typeof(Email) },
{ ContextTypes.Instrument, typeof(Instrument) },
{ ContextTypes.InstrumentList, typeof(InstrumentList) },
{ ContextTypes.Message, typeof(Message) },
{ ContextTypes.Nothing, typeof(Nothing) },
{ ContextTypes.Organization, typeof(Organization) },
{ ContextTypes.Portfolio, typeof(Portfolio) },
{ ContextTypes.Position, typeof(Position) },
{ ContextTypes.TimeRange, typeof(TimeRange) },
{ ContextTypes.TransactionResult, typeof(TransactionResult) },
{ ContextTypes.Valuation, typeof(Valuation) },
};

Expand Down
10 changes: 10 additions & 0 deletions src/Fdc3/Context/Instrument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public Instrument(InstrumentID? id = null, string? name = null)
{
}

public MarketSource? Market { get; set; }

object? IContext<object>.ID => base.ID;
}

Expand All @@ -36,4 +38,12 @@ public class InstrumentID
public string? SEDOL { get; set; }
public string? Ticker { get; set; }
}

public class MarketSource
{
public string? BBG { get; set; }
public string? COUNTRY_ISOALPHA2 { get; set; }
public string? MIC { get; set; }
public string? Name { get; set; }
}
}
Loading

0 comments on commit 81828fd

Please sign in to comment.