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

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 <QList>
0010 
0011 #include "ewsitem.h"
0012 #include "ewsitemshape.h"
0013 #include "ewsrequest.h"
0014 #include "ewstypes.h"
0015 
0016 class EwsGetItemRequest : public EwsRequest
0017 {
0018     Q_OBJECT
0019 public:
0020     class Response : public EwsRequest::Response
0021     {
0022     public:
0023         typedef QList<Response> List;
0024 
0025         explicit Response(QXmlStreamReader &reader);
0026         bool parseItems(QXmlStreamReader &reader);
0027         const EwsItem &item() const
0028         {
0029             return mItem;
0030         }
0031 
0032     private:
0033         EwsItem mItem;
0034     };
0035 
0036     EwsGetItemRequest(EwsClient &client, QObject *parent);
0037     ~EwsGetItemRequest() override;
0038 
0039     void setItemIds(const EwsId::List &ids);
0040     void setItemShape(const EwsItemShape &shape);
0041 
0042     void start() override;
0043 
0044     const Response::List &responses() const
0045     {
0046         return mResponses;
0047     }
0048 
0049 protected:
0050     bool parseResult(QXmlStreamReader &reader) override;
0051     bool parseItemsResponse(QXmlStreamReader &reader);
0052 
0053 private:
0054     EwsId::List mIds;
0055     EwsItemShape mShape;
0056     Response::List mResponses;
0057 };