public async Task <Either <string, IProtobufObject> > MakeNotificationPublishingAsync(string key) { var scriptPath = keyScriptMap.GetScriptPathFrom(key); var arg = new ForPublishNotificationArgs(); return(await scriptPath.ToAsync().MatchAsync( Some: x => scriptExecutor.RunScriptAsync <IProtobufObject>(x, arg), None: () => $"[Can't Find Key] : {key}")); }
public async Task <Either <string, IProtobufObject> > MakeNotificationSubscribingAsync(string key, IEnumerable <byte> notificationBytes) { var scriptPath = keyScriptMap.GetScriptPathFrom(key); var arg = new ForResponseArgs(notificationBytes); return(await scriptPath.ToAsync().MatchAsync( Some: x => scriptExecutor.RunScriptAsync <IProtobufObject>(x, arg), None: () => $"[Can't Find Key] : {key}")); }
/// <summary> /// 要求送信用のデータを作る /// </summary> /// <param name="key"></param> /// <returns>成功時はタプルを返す。1つは要求送信用データで、もう1つは応答データ(purotobuf形式のバイナリ)を IProtobufObject に変換するデリゲート</returns> public async Task <Either <string, (IProtobufObject requestProto, Func <IEnumerable <byte>, IProtobufObject> createResponseProto)> > MakeRequestAsync(string key) { var scriptPath = keyScriptMap.GetScriptPathFrom(key); var arg = new ForRequestArgs(); return(await scriptPath.ToAsync().MatchAsync( Some: x => scriptExecutor.RunScriptAsync <(IProtobufObject requestProto, Func <IEnumerable <byte>, IProtobufObject> createResponseProto)>(x, arg), None: () => $"[Can't Find Key] : {key}")); }