private void button2_Click(object sender, EventArgs e) { try { AddLog("Active cycle - Read with offset - Start"); IO.Swagger.Api.TransmissionInvoicesNotificationsApi transmissionInvoicesNotificationsApi = new IO.Swagger.Api.TransmissionInvoicesNotificationsApi(_urlWebApiInvoice); DateTime?data = DateTime.Now.AddDays(-80).ToUniversalTime(); //I create a new subscription. I must send the datetime or the last notification ID var transmissionOffsetSubscribeResponse = transmissionInvoicesNotificationsApi.TransmissionOffsetSubscribe(AooIdentifier, UoIdentifier, new IO.Swagger.Model.TransmissionSubscribeOffsetRequest(null, data), _authToken); //I download from IX FE the next list of top 10 events var transmissionOffsetNotificationsResponse = transmissionInvoicesNotificationsApi.GetTransmissionOffsetNotifications(AooIdentifier, UoIdentifier, transmissionOffsetSubscribeResponse.SubscriptionUID, 10, _authToken); foreach (var notification in transmissionOffsetNotificationsResponse.Notifications) { //foreac event I must manage the event's detail MenageActiveEvent(notification); } //Now I call the Unsubscribe method. If you prefer you can cycle and call next the "get methods" while Get return plus the zero events transmissionInvoicesNotificationsApi.TransmissionOffsetUnsubscribe(AooIdentifier, UoIdentifier, transmissionOffsetSubscribeResponse.SubscriptionUID, _authToken); AddLog("Active cycle - Read with offset - End"); } catch (Exception ex) { AddLog("Active cycle - Read with offset - Error", ex.ToString()); } }
private void button1_Click(object sender, EventArgs e) { AddLog("Active cycle - Read without offset - Start"); try { IO.Swagger.Api.TransmissionInvoicesNotificationsApi transmissionInvoicesNotificationsApi = new IO.Swagger.Api.TransmissionInvoicesNotificationsApi(_urlWebApiInvoice); //I create a new subscription var transmissionSubscribeResponse = transmissionInvoicesNotificationsApi.TransmissionSubscribe(AooIdentifier, UoIdentifier, _authToken); //I download from IX FE the next list of top 10 events var transmissionNotificationsResponse = transmissionInvoicesNotificationsApi.GetTransmissionNotifications(AooIdentifier, UoIdentifier, transmissionSubscribeResponse.SubscriptionUID, 10, _authToken); foreach (var notification in transmissionNotificationsResponse.Notifications) { //foreac event I must manage the event's detail MenageActiveEvent(notification); } //I call the ACK method transmissionInvoicesNotificationsApi.TransmissionSubscriptionAck(AooIdentifier, UoIdentifier, transmissionSubscribeResponse.SubscriptionUID, transmissionNotificationsResponse.AckUID, _authToken); //Now I call the Commit method. If you prefer you can cycle and call next the couple of methods "Get + Ack" while Get return plus the zero events transmissionInvoicesNotificationsApi.TransmissionSubscriptionCommit(AooIdentifier, UoIdentifier, transmissionSubscribeResponse.SubscriptionUID, _authToken); AddLog("Active cycle - Read without offset - End"); } catch (Exception ex) { AddLog("Active cycle - Read without offset - Error", ex.ToString()); } }