Пример #1
0
        /// <summary>
        /// Updates a phone notification.
        /// </summary>
        /// <param name="options">Contains all of the relevant parameters to process a NotificationUpdate.</param>
        /// <returns>An object containing the result of the NotificationUpdate.</returns>
        /// <seealso cref="NotificationUpdateParams"/>
        /// <seealso cref="NotificationUpdateResult"/>
        public PapiResponse <NotificationUpdateResult> NotificationUpdate(NotificationUpdateParams options)
        {
            Require.Argument("AccessToken", Token.AccessToken);
            Require.Argument("NotificationTypeID", options.NotificationTypeId);
            Require.Argument("NotificationStatusID", options.NotificationStatus);
            Require.Argument("DeliveryOptionID", options.DeliveryOptionId);
            Require.Argument("DeliveryString", options.DeliveryString);
            Require.Argument("Details", options.Details);
            Require.Argument("PatronID", options.PatronId);


            var root = new XElement("NotificationUpdateData",
                                    new XElement("LogonBranchID", options.BranchId),
                                    new XElement("LogonUserID", options.UserId),
                                    new XElement("LogonWorkstationID", options.WorkstationId),
                                    new XElement("ReportingOrgID", options.ReportingOrgID),
                                    new XElement("NotificationStatusID", (int)options.NotificationStatus),
                                    new XElement("NotificationDeliveryDate", options.DeliveryDate.ToString("yyyy-MM-dd")),
                                    new XElement("DeliveryOptionID", options.DeliveryOptionId),
                                    new XElement("DeliveryString", options.DeliveryString),
                                    new XElement("Details", options.Details),
                                    new XElement("PatronID", options.PatronId)
                                    );

            if (!string.IsNullOrWhiteSpace(options.ItemBarcode))
            {
                root.Add(new XElement("ItemBarcode", options.ItemBarcode));
            }
            else if (options.ItemRecordId > 0)
            {
                root.Add(new XElement("ItemRecordID", options.ItemRecordId));
            }
            else
            {
                throw new ArgumentException("Item information is required.");
            }

            var doc = new XDocument(root);


            var url = $"PAPIService/REST/protected/v1/1033/100/1/{Token.AccessToken}/notification/{options.NotificationTypeId}";

            return(Execute <NotificationUpdateResult>(HttpMethod.Put, url, pin: Token.AccessSecret, body: doc.ToString()));
        }
Пример #2
0
        /// <summary>
        /// Updates a phone notification.
        /// </summary>
        /// <summary>
        /// Currently only supports phone notifications; DeliveryOptionIDs 3, 4, and 5
        /// </summary>
        /// <param name="updateParams">Contains all of the relevant parameters to process a NotificationUpdate.</param>
        /// <returns>An object containing the result of the NotificationUpdate.</returns>
        /// <seealso cref="NotificationUpdateParams"/>
        /// <seealso cref="NotificationUpdateResult"/>
        public NotificationUpdateResult NotificationUpdate(NotificationUpdateParams updateParams)
        {
            Require.Argument("AccessToken", token.AccessToken);
            Require.Argument("NotificationTypeID", updateParams.NotificationTypeId);
            Require.Argument("NotificationStatusID", updateParams.CallStatus);
            Require.Argument("DeliveryOptionID", updateParams.DeliveryOptionId);
            Require.Argument("DeliveryString", updateParams.DeliveryString);
            Require.Argument("Details", updateParams.Details);
            Require.Argument("PatronID", updateParams.PatronId);
            Require.Argument("ItemRecordID", updateParams.ItemRecordId);

            var doc = new XDocument(
                new XElement("NotificationUpdateData",
                             new XElement("LogonBranchID", 1),
                             new XElement("LogonUserID", 1),
                             new XElement("LogonWorkstationID", 1),
                             new XElement("NotificationStatusID", updateParams.CallStatus),
                             new XElement("NotificationDeliveryDate", DateTime.Today.ToString("yyyy-MM-dd")),
                             new XElement("DeliveryOptionID", updateParams.DeliveryOptionId),
                             new XElement("DeliveryString", updateParams.DeliveryString),
                             new XElement("Details", updateParams.Details),
                             new XElement("PatronID", updateParams.PatronId),
                             new XElement("ItemRecordID", updateParams.ItemRecordId)
                             )
                );

            var request = new RestRequest
            {
                Method   = Method.PUT,
                Resource =
                    string.Format("protected/v1/1033/100/1/{0}/notification/{1}", token.AccessToken,
                                  updateParams.NotificationTypeId)
            };

            request.AddParameter("text/xml", doc.ToString(), ParameterType.RequestBody);

            _client.Authenticator = new PolarisProtectedAuthenticator(ApiUser, ApiKey, token);

            return(Execute <NotificationUpdateResult>(request));
        }
Пример #3
0
        /// <summary>
        /// Updates a phone notification.
        /// </summary>
        /// <summary>
        /// Currently only supports phone notifications; DeliveryOptionIDs 3, 4, and 5
        /// </summary>
        /// <param name="updateParams">Contains all of the relevant parameters to process a NotificationUpdate.</param>
        /// <returns>An object containing the result of the NotificationUpdate.</returns>
        /// <seealso cref="NotificationUpdateParams"/>
        /// <seealso cref="NotificationUpdateResult"/>
        public NotificationUpdateResult NotificationUpdate(NotificationUpdateParams updateParams)
        {
            Require.Argument("AccessToken", token.AccessToken);
            Require.Argument("NotificationTypeID", updateParams.NotificationTypeId);
            Require.Argument("NotificationStatusID", updateParams.CallStatus);
            Require.Argument("DeliveryOptionID", updateParams.DeliveryOptionId);
            Require.Argument("DeliveryString", updateParams.DeliveryString);
            Require.Argument("Details", updateParams.Details);
            Require.Argument("PatronID", updateParams.PatronId);
            Require.Argument("ItemRecordID", updateParams.ItemRecordId);

            var doc = new XDocument(
                new XElement("NotificationUpdateData",
                             new XElement("LogonBranchID", 1),
                             new XElement("LogonUserID", 1),
                             new XElement("LogonWorkstationID", 1),
                             new XElement("NotificationStatusID", updateParams.CallStatus),
                             new XElement("NotificationDeliveryDate", DateTime.Today.ToString("yyyy-MM-dd")),
                             new XElement("DeliveryOptionID", updateParams.DeliveryOptionId),
                             new XElement("DeliveryString", updateParams.DeliveryString),
                             new XElement("Details", updateParams.Details),
                             new XElement("PatronID", updateParams.PatronId),
                             new XElement("ItemRecordID", updateParams.ItemRecordId)
                    )
                );

            var request = new RestRequest
                              {
                                  Method = Method.PUT,
                                  Resource =
                                      string.Format("protected/v1/1033/100/1/{0}/notification/{1}", token.AccessToken,
                                                    updateParams.NotificationTypeId)
                              };
            request.AddParameter("text/xml", doc.ToString(), ParameterType.RequestBody);

            _client.Authenticator = new PolarisProtectedAuthenticator(ApiUser, ApiKey, token);

            return Execute<NotificationUpdateResult>(request);
        }