Example #1
0
        /// <summary>
        /// Adds customer user to a directory role.
        /// </summary>
        /// <param name="newEntity">The user to add.</param>
        /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
        /// <returns>The customer directory role user member.</returns>
        public async Task <UserMember> CreateAsync(UserMember newEntity, CancellationToken cancellationToken = default)
        {
            newEntity.AssertNotNull(nameof(newEntity));

            return(await Partner.ServiceClient.PostAsync <UserMember, UserMember>(
                       new Uri(
                           string.Format(
                               CultureInfo.InvariantCulture,
                               $"/{PartnerService.Instance.ApiVersion}/{PartnerService.Instance.Configuration.Apis.AddUserToCustomerDirectoryRole.Path}",
                               Context.Item1,
                               Context.Item2),
                           UriKind.Relative),
                       newEntity,
                       cancellationToken).ConfigureAwait(false));
        }