Skip to content

Commit

Permalink
updated API signatures as per latest C#
Browse files Browse the repository at this point in the history
  • Loading branch information
mohitpubnub committed Apr 18, 2024
1 parent cb90098 commit af2057e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions PubNubUnity/Assets/PubNub/Runtime/Adapters/PubNub.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
using System;
using System.Threading.Tasks;
using PubnubApi.EndPoint;
using PubnubApi.Interface;

namespace PubnubApi.Unity {
public static class PubnubExtensions {
public static SubscribeOperation<T> Subscribe<T>(this Pubnub pn) => pn.Subscribe<T>();
public static ISubscribeOperation<T> Subscribe<T>(this Pubnub pn) => pn.Subscribe<T>();

[Obsolete("Use the generic version instead")]
public static SubscribeOperation<string> Subscribe(this Pubnub pn) => pn.Subscribe<string>();
public static ISubscribeOperation<string> Subscribe(this Pubnub pn) => pn.Subscribe<string>();

[Obsolete("Use the generic version instead")]
public static bool Reconnect(this Pubnub pn) => pn.Reconnect<string>();
Expand Down Expand Up @@ -45,10 +46,9 @@ public static UnsubscribeAllOperation<string> UnsubscribeAll(this Pubnub pn) {


// TODO create an async variant
public static UnsubscribeOperation<string> Unsubscribe(this Pubnub pn) {
public static IUnsubscribeOperation<string> Unsubscribe(this Pubnub pn) {
return pn.Unsubscribe<string>();
}


}
}
22 changes: 11 additions & 11 deletions PubNubUnity/Assets/PubNub/Runtime/Adapters/SubscribeOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,31 @@
using System.Linq;
using PubnubApi;
using PubnubApi.EndPoint;
using PubnubApi.Interface;

namespace PubnubApi.Unity {
public static class SubscribeOperationExtensions {
public static SubscribeOperation<T> Channels<T>(this SubscribeOperation<T> so, List<string> channels) =>
public static ISubscribeOperation<T> Channels<T>(this SubscribeOperation<T> so, List<string> channels) =>
so.Channels(channels.ToArray());

public static SubscribeOperation<string> Channels(this SubscribeOperation<string> so, List<string> channels) =>
public static ISubscribeOperation<string> Channels(this SubscribeOperation<string> so, List<string> channels) =>
so.Channels<string>(channels);

public static SubscribeOperation<T> ChannelGroups<T>(this SubscribeOperation<T> so, List<string> channels) =>
public static ISubscribeOperation<T> ChannelGroups<T>(this SubscribeOperation<T> so, List<string> channels) =>
so.ChannelGroups(channels.ToArray());

public static SubscribeOperation<string> ChannelGroups(this SubscribeOperation<string> so, List<string> channels) =>
public static ISubscribeOperation<string> ChannelGroups(this SubscribeOperation<string> so, List<string> channels) =>
so.ChannelGroups<string>(channels);


public static SubscribeOperation<string> QueryParam(this SubscribeOperation<string> so,
public static ISubscribeOperation<string> QueryParam(this SubscribeOperation<string> so,
Dictionary<string, string> customQueryParam) => so.QueryParam(customQueryParam.ToDictionary(kvp => kvp.Key, kvp => kvp.Value as object));

public static UnsubscribeOperation<T> ChannelGroups<T>(this UnsubscribeOperation<T> op, List<string> channelGroups) {
return op.ChannelGroups(channelGroups.ToArray());
}
public static IUnsubscribeOperation<T> ChannelGroups<T>(this UnsubscribeOperation<T> op, List<string> channelGroups) =>
op.ChannelGroups(channelGroups.ToArray());


public static UnsubscribeOperation<T> Channels<T>(this UnsubscribeOperation<T> op, List<string> channels) {
return op.ChannelGroups(channels.ToArray());
}
public static IUnsubscribeOperation<T> Channels<T>(this UnsubscribeOperation<T> op, List<string> channels) =>
op.Channels(channels.ToArray());
}
}

0 comments on commit af2057e

Please sign in to comment.