Skip to content

Commit ff22286

Browse files
author
Elad Zelingher
committed
Adding a client api for meta-api
1 parent 286d3b6 commit ff22286

18 files changed

+970
-0
lines changed

src/mono/WampSharp/WampSharp.csproj

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,45 @@
554554
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\Fluent\WampCraChannelFactoryExtensions.cs">
555555
<Link>WAMP2\V2\Fluent\WampCraChannelFactoryExtensions.cs</Link>
556556
</Compile>
557+
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\MetaApi\Client\Contracts\IWampRegistrationDescriptorProxy.cs">
558+
<Link>WAMP2\V2\MetaApi\Client\Contracts\IWampRegistrationDescriptorProxy.cs</Link>
559+
</Compile>
560+
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\MetaApi\Client\Contracts\IWampSessionDescriptorProxy.cs">
561+
<Link>WAMP2\V2\MetaApi\Client\Contracts\IWampSessionDescriptorProxy.cs</Link>
562+
</Compile>
563+
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\MetaApi\Client\Contracts\IWampSubscriptionDescriptorProxy.cs">
564+
<Link>WAMP2\V2\MetaApi\Client\Contracts\IWampSubscriptionDescriptorProxy.cs</Link>
565+
</Compile>
566+
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\MetaApi\Client\Generated\WampRegistrationDescriptorProxyProxy.cs">
567+
<Link>WAMP2\V2\MetaApi\Client\Generated\WampRegistrationDescriptorProxyProxy.cs</Link>
568+
</Compile>
569+
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\MetaApi\Client\Generated\WampSessionDescriptorProxyProxy.cs">
570+
<Link>WAMP2\V2\MetaApi\Client\Generated\WampSessionDescriptorProxyProxy.cs</Link>
571+
</Compile>
572+
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\MetaApi\Client\Generated\WampSubscriptionDescriptorProxyProxy.cs">
573+
<Link>WAMP2\V2\MetaApi\Client\Generated\WampSubscriptionDescriptorProxyProxy.cs</Link>
574+
</Compile>
575+
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\MetaApi\Client\MetaApiEventsBase.cs">
576+
<Link>WAMP2\V2\MetaApi\Client\MetaApiEventsBase.cs</Link>
577+
</Compile>
578+
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\MetaApi\Client\MetaEvents.cs">
579+
<Link>WAMP2\V2\MetaApi\Client\MetaEvents.cs</Link>
580+
</Compile>
581+
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\MetaApi\Client\RegistrationEvents.cs">
582+
<Link>WAMP2\V2\MetaApi\Client\RegistrationEvents.cs</Link>
583+
</Compile>
584+
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\MetaApi\Client\SessionEvents.cs">
585+
<Link>WAMP2\V2\MetaApi\Client\SessionEvents.cs</Link>
586+
</Compile>
587+
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\MetaApi\Client\SubscriptionEvents.cs">
588+
<Link>WAMP2\V2\MetaApi\Client\SubscriptionEvents.cs</Link>
589+
</Compile>
590+
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\MetaApi\Client\WampMetaApiServiceProxy.cs">
591+
<Link>WAMP2\V2\MetaApi\Client\WampMetaApiServiceProxy.cs</Link>
592+
</Compile>
593+
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\MetaApi\Client\WampRealmProxyExtensions.cs">
594+
<Link>WAMP2\V2\MetaApi\Client\WampRealmProxyExtensions.cs</Link>
595+
</Compile>
557596
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\MetaApi\WampHostedRealmExtensions.cs">
558597
<Link>WAMP2\V2\MetaApi\WampHostedRealmExtensions.cs</Link>
559598
</Compile>

src/net40/WampSharp/WampSharp.csproj

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,45 @@
558558
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\Fluent\WampCraChannelFactoryExtensions.cs">
559559
<Link>WAMP2\V2\Fluent\WampCraChannelFactoryExtensions.cs</Link>
560560
</Compile>
561+
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\MetaApi\Client\Contracts\IWampRegistrationDescriptorProxy.cs">
562+
<Link>WAMP2\V2\MetaApi\Client\Contracts\IWampRegistrationDescriptorProxy.cs</Link>
563+
</Compile>
564+
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\MetaApi\Client\Contracts\IWampSessionDescriptorProxy.cs">
565+
<Link>WAMP2\V2\MetaApi\Client\Contracts\IWampSessionDescriptorProxy.cs</Link>
566+
</Compile>
567+
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\MetaApi\Client\Contracts\IWampSubscriptionDescriptorProxy.cs">
568+
<Link>WAMP2\V2\MetaApi\Client\Contracts\IWampSubscriptionDescriptorProxy.cs</Link>
569+
</Compile>
570+
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\MetaApi\Client\Generated\WampRegistrationDescriptorProxyProxy.cs">
571+
<Link>WAMP2\V2\MetaApi\Client\Generated\WampRegistrationDescriptorProxyProxy.cs</Link>
572+
</Compile>
573+
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\MetaApi\Client\Generated\WampSessionDescriptorProxyProxy.cs">
574+
<Link>WAMP2\V2\MetaApi\Client\Generated\WampSessionDescriptorProxyProxy.cs</Link>
575+
</Compile>
576+
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\MetaApi\Client\Generated\WampSubscriptionDescriptorProxyProxy.cs">
577+
<Link>WAMP2\V2\MetaApi\Client\Generated\WampSubscriptionDescriptorProxyProxy.cs</Link>
578+
</Compile>
579+
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\MetaApi\Client\MetaApiEventsBase.cs">
580+
<Link>WAMP2\V2\MetaApi\Client\MetaApiEventsBase.cs</Link>
581+
</Compile>
582+
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\MetaApi\Client\MetaEvents.cs">
583+
<Link>WAMP2\V2\MetaApi\Client\MetaEvents.cs</Link>
584+
</Compile>
585+
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\MetaApi\Client\RegistrationEvents.cs">
586+
<Link>WAMP2\V2\MetaApi\Client\RegistrationEvents.cs</Link>
587+
</Compile>
588+
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\MetaApi\Client\SessionEvents.cs">
589+
<Link>WAMP2\V2\MetaApi\Client\SessionEvents.cs</Link>
590+
</Compile>
591+
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\MetaApi\Client\SubscriptionEvents.cs">
592+
<Link>WAMP2\V2\MetaApi\Client\SubscriptionEvents.cs</Link>
593+
</Compile>
594+
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\MetaApi\Client\WampMetaApiServiceProxy.cs">
595+
<Link>WAMP2\V2\MetaApi\Client\WampMetaApiServiceProxy.cs</Link>
596+
</Compile>
597+
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\MetaApi\Client\WampRealmProxyExtensions.cs">
598+
<Link>WAMP2\V2\MetaApi\Client\WampRealmProxyExtensions.cs</Link>
599+
</Compile>
561600
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\MetaApi\WampHostedRealmExtensions.cs">
562601
<Link>WAMP2\V2\MetaApi\WampHostedRealmExtensions.cs</Link>
563602
</Compile>
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
using System.Threading.Tasks;
2+
using WampSharp.V2.Core.Contracts;
3+
using WampSharp.V2.Rpc;
4+
5+
namespace WampSharp.V2.MetaApi
6+
{
7+
public interface IWampRegistrationDescriptorProxy : IWampRegistrationDescriptor
8+
{
9+
/// <summary>
10+
/// Retrieves registration IDs listed according to match policies.
11+
/// </summary>
12+
/// <returns>An object with a list of registration IDs for each match policy.</returns>
13+
[WampProcedure("wamp.registration.list")]
14+
Task<AvailableGroups> GetAllRegistrationsAsync();
15+
16+
/// <summary>
17+
/// Obtains the registration Async(if any) managing a procedure, according to some match policy.
18+
/// </summary>
19+
/// <param name="procedureUri">The procedure to lookup the registration for.</param>
20+
/// <param name="options">Same options as when registering a procedure.</param>
21+
/// <returns>The ID of the registration managing the procedure, if found, or null.</returns>
22+
[WampProcedure("wamp.registration.lookup")]
23+
Task<long?> LookupRegistrationIdAsync(string procedureUri, RegisterOptions options = null);
24+
25+
/// <summary>
26+
/// Obtains the registration best matching a given procedure URI.
27+
/// </summary>
28+
/// <param name="procedureUri">The procedure URI to match.</param>
29+
/// <returns>The ID of best matching registration, or null.</returns>
30+
[WampProcedure("wamp.registration.match")]
31+
Task<long?> GetBestMatchingRegistrationIdAsync(string procedureUri);
32+
33+
/// <summary>
34+
/// Retrieves information on a particular registration.
35+
/// </summary>
36+
/// <param name="registrationId">The ID of the registration to retrieve.</param>
37+
/// <returns>Details on the registration.</returns>
38+
[WampProcedure("wamp.registration.get")]
39+
Task<RegistrationDetails> GetRegistrationDetailsAsync(long registrationId);
40+
41+
/// <summary>
42+
/// Retrieves a list of session IDs for sessions currently attached to the registration.
43+
/// </summary>
44+
/// <param name="registrationId">The ID of the registration to get calles for.</param>
45+
/// <returns>A list of WAMP session IDs of callees currently attached to the
46+
/// registration.</returns>
47+
[WampProcedure("wamp.registration.list_callees")]
48+
Task<long[]> GetCalleesIdsAsync(long registrationId);
49+
50+
/// <summary>
51+
/// Obtains the number of sessions currently attached to a registration.
52+
/// </summary>
53+
/// <param name="registrationId">The ID of the registration to get the number of callees for.</param>
54+
/// <returns>The number of callees currently attached to a registration.</returns>
55+
[WampProcedure("wamp.registration.count_callees")]
56+
Task<long> CountCalleesAsync(long registrationId);
57+
}
58+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using System.Threading.Tasks;
2+
using WampSharp.V2.Rpc;
3+
4+
namespace WampSharp.V2.MetaApi
5+
{
6+
public interface IWampSessionDescriptorProxy : IWampSessionDescriptor
7+
{
8+
/// <summary>
9+
/// Obtains the number of sessions currently attached to the realm.
10+
/// </summary>
11+
/// <returns>The number of sessions currently attached to the realm.</returns>
12+
[WampProcedure("wamp.session.count")]
13+
Task<long> SessionCountAsync();
14+
15+
/// <summary>
16+
/// Retrieves a list of the session IDs for all sessions currently attached to the realm.
17+
/// </summary>
18+
/// <returns>List of WAMP session IDs (order undefined).</returns>
19+
[WampProcedure("wamp.session.list")]
20+
Task<long[]> GetSessionIdsAsync();
21+
22+
/// <summary>
23+
/// Retrieves information on a specific session.
24+
/// </summary>
25+
/// <param name="sessionId">The session ID of the session to retrieve details for.</param>
26+
/// <returns>Information on the particular session.</returns>
27+
[WampProcedure("wamp.session.get")]
28+
Task<WampSessionDetails> GetSessionDetailsAsync(long sessionId);
29+
}
30+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
using System.Threading.Tasks;
2+
using WampSharp.V2.Core.Contracts;
3+
using WampSharp.V2.Rpc;
4+
5+
namespace WampSharp.V2.MetaApi
6+
{
7+
public interface IWampSubscriptionDescriptorProxy : IWampSubscriptionDescriptor
8+
{
9+
/// <summary>
10+
/// Retrieves subscription IDs listed according to match policies.
11+
/// </summary>
12+
/// <returns>An object with a list of subscription IDs for each match policy.</returns>
13+
[WampProcedure("wamp.subscription.list")]
14+
Task<AvailableGroups> GetAllSubscriptionIdsAsync();
15+
16+
/// <summary>
17+
/// Obtains the subscription Async(if any) managing a topic, according to some match policy.
18+
/// </summary>
19+
/// <param name="topicUri">The URI of the topic.</param>
20+
/// <param name="options">Same options as when subscribing to a topic.</param>
21+
/// <returns>The ID of the subscription managing the topic, if found, or null.</returns>
22+
[WampProcedure("wamp.subscription.lookup")]
23+
Task<long?> LookupSubscriptionIdAsync(string topicUri, SubscribeOptions options = null);
24+
25+
/// <summary>
26+
/// Retrieves a list of IDs of subscriptions matching a topic URI, irrespective of match policy.
27+
/// </summary>
28+
/// <param name="topicUri">The topic to match.</param>
29+
/// <returns>A list of all matching subscription IDs, or null</returns>
30+
[WampProcedure("wamp.subscription.match")]
31+
Task<long[]> GetMatchingSubscriptionIdsAsync(string topicUri);
32+
33+
/// <summary>
34+
/// Retrieves information on a particular subscription.
35+
/// </summary>
36+
/// <param name="subscriptionId">The ID of the subscription to retrieve.</param>
37+
/// <returns>Details on the subscription.</returns>
38+
[WampProcedure("wamp.subscription.get")]
39+
Task<SubscriptionDetails> GetSubscriptionDetailsAsync(long subscriptionId);
40+
41+
/// <summary>
42+
/// Retrieves a list of session IDs for sessions currently attached to the subscription.
43+
/// </summary>
44+
/// <param name="subscriptionId">The ID of the subscription to get subscribers for.</param>
45+
/// <returns>A list of WAMP session IDs of subscribers currently attached to the subscription.</returns>
46+
[WampProcedure("wamp.subscription.list_subscribers")]
47+
Task<long[]> GetSubscribersAsync(long subscriptionId);
48+
49+
/// <summary>
50+
/// Obtains the number of sessions currently attached to a subscription.
51+
/// </summary>
52+
/// <param name="subscriptionId">The ID of the subscription to get the number of subscribers for.</param>
53+
/// <returns>The number of sessions currently attached to a subscription.</returns>
54+
[WampProcedure("wamp.subscription.count_subscribers")]
55+
Task<long> CountSubscribersAsync(long subscriptionId);
56+
}
57+
}
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
using System.Reflection;
2+
using System.Threading.Tasks;
3+
using WampSharp.V2.CalleeProxy;
4+
using WampSharp.V2.Client;
5+
6+
namespace WampSharp.V2.MetaApi
7+
{
8+
//------------------------------------------------------------------------------
9+
// <auto-generated>
10+
// This code was generated by a tool.
11+
//
12+
// Changes to this file may cause incorrect behavior and will be lost if
13+
// the code is regenerated.
14+
// </auto-generated>
15+
//------------------------------------------------------------------------------
16+
internal class WampRegistrationDescriptorProxyProxy : CalleeProxyBase, global::WampSharp.V2.MetaApi.IWampRegistrationDescriptorProxy
17+
{
18+
private static readonly MethodInfo mMethod0 = GetMethodInfo((global::WampSharp.V2.MetaApi.IWampRegistrationDescriptorProxy instance) => instance.GetAllRegistrationsAsync());
19+
private static readonly MethodInfo mMethod1 = GetMethodInfo((global::WampSharp.V2.MetaApi.IWampRegistrationDescriptorProxy instance) => instance.LookupRegistrationIdAsync(default(string), default(global::WampSharp.V2.Core.Contracts.RegisterOptions)));
20+
private static readonly MethodInfo mMethod2 = GetMethodInfo((global::WampSharp.V2.MetaApi.IWampRegistrationDescriptorProxy instance) => instance.GetBestMatchingRegistrationIdAsync(default(string)));
21+
private static readonly MethodInfo mMethod3 = GetMethodInfo((global::WampSharp.V2.MetaApi.IWampRegistrationDescriptorProxy instance) => instance.GetRegistrationDetailsAsync(default(long)));
22+
private static readonly MethodInfo mMethod4 = GetMethodInfo((global::WampSharp.V2.MetaApi.IWampRegistrationDescriptorProxy instance) => instance.GetCalleesIdsAsync(default(long)));
23+
private static readonly MethodInfo mMethod5 = GetMethodInfo((global::WampSharp.V2.MetaApi.IWampRegistrationDescriptorProxy instance) => instance.CountCalleesAsync(default(long)));
24+
private static readonly MethodInfo mMethod6 = GetMethodInfo((global::WampSharp.V2.MetaApi.IWampRegistrationDescriptorProxy instance) => instance.GetAllRegistrations());
25+
private static readonly MethodInfo mMethod7 = GetMethodInfo((global::WampSharp.V2.MetaApi.IWampRegistrationDescriptorProxy instance) => instance.LookupRegistrationId(default(string), default(global::WampSharp.V2.Core.Contracts.RegisterOptions)));
26+
private static readonly MethodInfo mMethod8 = GetMethodInfo((global::WampSharp.V2.MetaApi.IWampRegistrationDescriptorProxy instance) => instance.GetBestMatchingRegistrationId(default(string)));
27+
private static readonly MethodInfo mMethod9 = GetMethodInfo((global::WampSharp.V2.MetaApi.IWampRegistrationDescriptorProxy instance) => instance.GetRegistrationDetails(default(long)));
28+
private static readonly MethodInfo mMethod10 = GetMethodInfo((global::WampSharp.V2.MetaApi.IWampRegistrationDescriptorProxy instance) => instance.GetCalleesIds(default(long)));
29+
private static readonly MethodInfo mMethod11 = GetMethodInfo((global::WampSharp.V2.MetaApi.IWampRegistrationDescriptorProxy instance) => instance.CountCallees(default(long)));
30+
31+
public WampRegistrationDescriptorProxyProxy
32+
(IWampRealmProxy realmProxy,
33+
ICalleeProxyInterceptor interceptor)
34+
: base(realmProxy, interceptor)
35+
{
36+
}
37+
38+
public Task<global::WampSharp.V2.MetaApi.AvailableGroups> GetAllRegistrationsAsync()
39+
{
40+
return SingleInvokeAsync<global::WampSharp.V2.MetaApi.AvailableGroups>(mMethod0);
41+
}
42+
43+
public Task<global::System.Nullable<long>> LookupRegistrationIdAsync(string procedureUri, global::WampSharp.V2.Core.Contracts.RegisterOptions options)
44+
{
45+
return SingleInvokeAsync<global::System.Nullable<long>>(mMethod1, procedureUri, options);
46+
}
47+
48+
public Task<global::System.Nullable<long>> GetBestMatchingRegistrationIdAsync(string procedureUri)
49+
{
50+
return SingleInvokeAsync<global::System.Nullable<long>>(mMethod2, procedureUri);
51+
}
52+
53+
public Task<global::WampSharp.V2.MetaApi.RegistrationDetails> GetRegistrationDetailsAsync(long registrationId)
54+
{
55+
return SingleInvokeAsync<global::WampSharp.V2.MetaApi.RegistrationDetails>(mMethod3, registrationId);
56+
}
57+
58+
public Task<long[]> GetCalleesIdsAsync(long registrationId)
59+
{
60+
return SingleInvokeAsync<long[]>(mMethod4, registrationId);
61+
}
62+
63+
public Task<long> CountCalleesAsync(long registrationId)
64+
{
65+
return SingleInvokeAsync<long>(mMethod5, registrationId);
66+
}
67+
68+
public global::WampSharp.V2.MetaApi.AvailableGroups GetAllRegistrations()
69+
{
70+
return SingleInvokeSync<global::WampSharp.V2.MetaApi.AvailableGroups>(mMethod6);
71+
}
72+
73+
public global::System.Nullable<long> LookupRegistrationId(string procedureUri, global::WampSharp.V2.Core.Contracts.RegisterOptions options)
74+
{
75+
return SingleInvokeSync<global::System.Nullable<long>>(mMethod7, procedureUri, options);
76+
}
77+
78+
public global::System.Nullable<long> GetBestMatchingRegistrationId(string procedureUri)
79+
{
80+
return SingleInvokeSync<global::System.Nullable<long>>(mMethod8, procedureUri);
81+
}
82+
83+
public global::WampSharp.V2.MetaApi.RegistrationDetails GetRegistrationDetails(long registrationId)
84+
{
85+
return SingleInvokeSync<global::WampSharp.V2.MetaApi.RegistrationDetails>(mMethod9, registrationId);
86+
}
87+
88+
public long[] GetCalleesIds(long registrationId)
89+
{
90+
return SingleInvokeSync<long[]>(mMethod10, registrationId);
91+
}
92+
93+
public long CountCallees(long registrationId)
94+
{
95+
return SingleInvokeSync<long>(mMethod11, registrationId);
96+
}
97+
}
98+
}

0 commit comments

Comments
 (0)