Пример #1
0
        /// <summary>
        /// Links a secondary account to a primary account.
        /// </summary>
        /// <param name="id">The ID of the primary account.</param>
        /// <param name="primaryJwtToken">The JWT of the primary account.</param>
        /// <param name="secondaryJwtToken">The JWT for the secondary account you wish to link.</param>
        /// <returns>A <see cref="IList{AccountLinkResponse}"/> containing details about this account link.</returns>
        public Task <IList <AccountLinkResponse> > LinkAccountAsync(string id, string primaryJwtToken, string secondaryJwtToken)
        {
            var request = new UserAccountJwtLinkRequest
            {
                LinkWith = secondaryJwtToken
            };

            return(Connection.SendAsync <IList <AccountLinkResponse> >(HttpMethod.Post,
                                                                       BuildUri($"users/{EncodePath(id)}/identities"), request,
                                                                       new Dictionary <string, string>(DefaultHeaders)
            {
                ["Authorization"] = $"Bearer {primaryJwtToken}"
            }));
        }
Пример #2
0
        /// <summary>
        /// Links a secondary account to a primary account.
        /// </summary>
        /// <param name="id">The ID of the primary account.</param>
        /// <param name="primaryJwtToken">The JWT of the primary account.</param>
        /// <param name="secondaryJwtToken">The JWT for the secondary account you wish to link.</param>
        /// <returns>A <see cref="IList{AccountLinkResponse}"/> containing details about this account link.</returns>
        public Task <IList <AccountLinkResponse> > LinkAccountAsync(string id, string primaryJwtToken, string secondaryJwtToken)
        {
            var request = new UserAccountJwtLinkRequest
            {
                LinkWith = secondaryJwtToken
            };

            return(Connection.PostAsync <IList <AccountLinkResponse> >("users/{id}/identities", request, null, null, new Dictionary <string, string>
            {
                { "id", id }
            }, new Dictionary <string, object>
            {
                { "Authorization", $"Bearer {primaryJwtToken}" }
            }, null));
        }