9#include "contactgroupdeletejob.h"
10#include "peopleservice.h"
11#include "private/queuehelper_p.h"
13#include <QNetworkRequest>
14#include <QNetworkReply>
16#include <QJsonDocument>
20namespace KGAPI2::People
23class Q_DECL_HIDDEN ContactGroupDeleteJob::Private
26 explicit Private(ContactGroupDeleteJob *parent);
27 void processNextContactGroup();
29 QueueHelper<QString> groupResourceNames;
33 ContactGroupDeleteJob *
const q;
36ContactGroupDeleteJob::Private::Private(ContactGroupDeleteJob *parent)
41void ContactGroupDeleteJob::Private::processNextContactGroup()
43 if (groupResourceNames.atEnd()) {
48 const auto groupResourceName = groupResourceNames.current();
49 const auto deleteUrl = PeopleService::deleteContactGroupUrl(groupResourceName,
false);
51 request.setRawHeader(
"Host",
"people.googleapis.com");
52 q->enqueueRequest(request);
56ContactGroupDeleteJob::ContactGroupDeleteJob(
const QStringList &contactGroupResourceNames,
const AccountPtr& account,
QObject* parent)
57 : DeleteJob(account, parent)
58 , d(std::make_unique<Private>(this))
60 d->groupResourceNames = contactGroupResourceNames;
63ContactGroupDeleteJob::ContactGroupDeleteJob(
const QString &contactGroupResourceName,
const AccountPtr &account,
QObject* parent)
64 : DeleteJob(account, parent)
65 , d(std::make_unique<Private>(this))
67 d->groupResourceNames << contactGroupResourceName;
70ContactGroupDeleteJob::~ContactGroupDeleteJob() =
default;
72void ContactGroupDeleteJob::start()
74 d->processNextContactGroup();
82 d->groupResourceNames.currentProcessed();
83 d->processNextContactGroup();
88#include "moc_contactgroupdeletejob.cpp"