public async Task <IActionResult> InviteFriend(InviteFriendRequest request) { var response = await mediator.Send(request); logger.LogResponse($"User #{HttpContext.GetCurrentUserId()} invited to friends user #{request.RecipientId}", response.Error); return(this.CreateResponse(response)); }
/// <summary> /// TPS services can invite Rogerthat users to become friends. The invitee receives a system message explaining that /// the TPS wants to become friends. This invitation contains two buttons: Accept invitation and Decline invitation. /// /// When the invitee clicks one of these buttons the service is notified via the service callback method receive /// invitation result. /// /// In case the invitee is not yet a Rogerthat user, he receives an email in which he is invited to become a /// Rogerthat user on behalf of the service. Once he is registered, he is friends with the TPS. /// </summary> /// <returns> InviteFriendResponse object</returns> /// <param name="request"> InviteFriendRequest object</param> /// <param name='jsonRpcCallId'> /// The json rpc call identifier. This is a string generated by the client, which can be used to correlate the response to the request. Max length is 256 characters. A JSON-RPC id must be generated on a per call invocation basis. The Rogerthat platform uses the id of the call to store the call result for a certain amount of time so that if something fails during the communication, the same call (having the same JSON-RPC id) can be resent to the Rogerthat service, allowing to fetch the result, without actually executing the call again. This avoids annoying problems such as duplicate delivery of messages. /// /// You should use a different JSON-RPC id for every call you make. /// /// In case of an intermittent failure such as a network connectivity problem, you can retry the same call using the same JSON-RPC id, without running the risk of duplicate execution of your call (e.g. duplicate message delivery). /// </param> public InviteFriendResponse InviteFriend(InviteFriendRequest request, string jsonRpcCallId) { InviteFriendResponse result = new InviteFriendResponse(); WireRequest(0, jsonRpcCallId, "friend.invite", (writer) => { request.Write(writer,false); }, (reader) => { result.Read(reader); } ); return result; }
/// <summary> /// TPS services can invite Rogerthat users to become friends. The invitee receives a system message explaining that /// the TPS wants to become friends. This invitation contains two buttons: Accept invitation and Decline invitation. /// /// When the invitee clicks one of these buttons the service is notified via the service callback method receive /// invitation result. /// /// In case the invitee is not yet a Rogerthat user, he receives an email in which he is invited to become a /// Rogerthat user on behalf of the service. Once he is registered, he is friends with the TPS. /// </summary> /// <returns> InviteFriendResponse object</returns> /// <param name="request"> InviteFriendRequest object</param> public InviteFriendResponse InviteFriend(InviteFriendRequest request) { return InviteFriend(request, Guid.NewGuid().ToString()); }