File indexing completed on 2024-12-22 04:57:04

0001 /*
0002     SPDX-FileCopyrightText: 2015-2017 Krzysztof Nowicki <krissn@op.pl>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QSharedPointer>
0010 
0011 #include "ewsid.h"
0012 #include "ewsrequest.h"
0013 #include "ewstypes.h"
0014 
0015 class EwsUnsubscribeRequest : public EwsRequest
0016 {
0017     Q_OBJECT
0018 public:
0019     enum Type {
0020         PullSubscription = 0,
0021         PushSubscription,
0022         StreamingSubscription,
0023     };
0024 
0025     class Response : public EwsRequest::Response
0026     {
0027     protected:
0028         explicit Response(QXmlStreamReader &reader);
0029 
0030         friend class EwsUnsubscribeRequest;
0031     };
0032 
0033     EwsUnsubscribeRequest(EwsClient &client, QObject *parent);
0034     ~EwsUnsubscribeRequest() override;
0035 
0036     void setSubscriptionId(const QString &id)
0037     {
0038         mSubscriptionId = id;
0039     }
0040 
0041     const Response &response() const
0042     {
0043         return *mResponse;
0044     }
0045 
0046     void start() override;
0047 
0048 protected:
0049     bool parseResult(QXmlStreamReader &reader) override;
0050     bool parseUnsubscribeResponse(QXmlStreamReader &reader);
0051 
0052 private:
0053     QString mSubscriptionId;
0054 
0055     QSharedPointer<Response> mResponse;
0056 };