SignNow.NET icon indicating copy to clipboard operation
SignNow.NET copied to clipboard

Add Ability to Resend Invites

Open SimonEvans482 opened this issue 1 year ago • 1 comments

I have added this to my local copy, but thought may be useful for others to include in release.

Need to add a property for Field_Request_Id to the ISignNowField interface (and the Field class):

        /// <summary>
        /// Field Request ID - Needed for Resend Invite
        /// </summary>
        [JsonProperty("field_request_id")]
        public string Field_Request_Id { get; }

This ID can then be retrieved from a Document and used for the Resend API call

ISignInvite Interface:

        /// <summary>
        /// ReSends a Role Based Invite to the Specified Invite ID.
        /// </summary>
        /// <param name="inviteFieldId">The Role identity to resend the invitation to.</param>
        /// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
        /// <returns></returns>
        Task ReSendRoleBasedInviteAsync(string inviteFieldId, CancellationToken cancellationToken = default);

UserServices.cs:

        /// <inheritdoc cref="ISignInvite.ReSendRoleBasedInviteAsync(string, CancellationToken)" />
        /// <exception cref="ArgumentException">Invalid format of <paramref name="inviteFieldId"/>.</exception>
        public async Task ReSendRoleBasedInviteAsync(string inviteFieldId, CancellationToken cancellationToken = default)
        {
            await ProcessReSendRoleBasedInviteAsync($"/fieldinvite/{inviteFieldId.ValidateId()}/resend", cancellationToken).ConfigureAwait(false);
        }
        private async Task ProcessReSendRoleBasedInviteAsync(string inviteFieldId,CancellationToken cancellationToken)
        {
            var requestOptions = new PutHttpRequestOptions
            {
                RequestUrl = new Uri(ApiBaseUrl, inviteFieldId),
                Token = Token
            };

            await SignNowClient.RequestAsync(requestOptions, cancellationToken).ConfigureAwait(false);
        }

SimonEvans482 avatar May 24 '23 08:05 SimonEvans482