CreateOrUpdateInstallationAsync() public method

public CreateOrUpdateInstallationAsync ( Newtonsoft.Json.Linq.JObject installation, CancellationToken cancellationToken = default(CancellationToken) ) : Task
installation Newtonsoft.Json.Linq.JObject
cancellationToken System.Threading.CancellationToken
return Task
        /// <summary>
        /// Register an Installation with particular registrationId and templates
        /// </summary>
        /// <param name="registrationId">The registrationId to register</param>
        /// <param name="templates">JSON with one more templates to register</param>
        /// <returns>Task that completes when registration is complete</returns>
        public Task RegisterAsync(string registrationId, JObject templates)
        {
            Arguments.IsNotNullOrWhiteSpace(registrationId, nameof(registrationId));

            JObject installation = new JObject
            {
                [PushInstallationProperties.PUSHCHANNEL] = registrationId,
                [PushInstallationProperties.PLATFORM]    = Platform.Instance.PushUtility.GetPlatform()
            };

            if (templates != null)
            {
                JObject templatesWithStringBody = templates;
                foreach (JProperty template in templates.Properties())
                {
                    //Notification hub requires template body to be a string.Convert to string from JObject
                    var templateBody = template.Value["body"];
                    if (templateBody != null && templateBody.GetType() == typeof(JObject))
                    {
                        templatesWithStringBody[template.Name]["body"] = templateBody.ToString();
                    }
                }
                installation[PushInstallationProperties.TEMPLATES] = templatesWithStringBody;
            }
            return(PushHttpClient.CreateOrUpdateInstallationAsync(installation));
        }
        /// <summary>
        /// Register an Installation with particular deviceToken and templates
        /// </summary>
        /// <param name="deviceToken">The deviceToken to register</param>
        /// <param name="templates">JSON with one more templates to register</param>
        /// <returns>Task that completes when registration is complete</returns>
        public Task RegisterAsync(NSData deviceToken, JObject templates)
        {
            string  channelUri   = ParseDeviceToken(deviceToken);
            JObject installation = new JObject
            {
                [PushInstallationProperties.PUSHCHANNEL] = channelUri,
                [PushInstallationProperties.PLATFORM]    = Platform.Instance.PushUtility.GetPlatform()
            };

            if (templates != null)
            {
                JObject templatesWithStringBody = templates;
                foreach (JProperty template in templates.Properties())
                {
                    //Notification hub requires template body to be a string.Convert to string from JObject
                    var templateBody = template.Value["body"];
                    if (templateBody != null && templateBody.GetType() == typeof(JObject))
                    {
                        templatesWithStringBody[template.Name]["body"] = templateBody.ToString();
                    }
                }
                installation[PushInstallationProperties.TEMPLATES] = templatesWithStringBody;
            }
            return(PushHttpClient.CreateOrUpdateInstallationAsync(installation));
        }