Commit fd66c654 authored by David Barchiesi's avatar David Barchiesi

Add missing common parameters for Files create/update request in FileAbstractDataJob.

parent 0dcf4269
Pipeline #32146 passed with stage
in 16 minutes and 51 seconds
POST https://www.googleapis.com/drive/v2/files/abcdefghijklmnopqrstuvwxyz/copy?convert=false&ocr=false&pinned=false&useContentAsIndexableText=false&supportsAllDrives=true&prettyPrint=false
POST https://www.googleapis.com/drive/v2/files/abcdefghijklmnopqrstuvwxyz/copy?convert=false&enforceSingleParent=false&ocr=false&pinned=false&useContentAsIndexableText=false&supportsAllDrives=true&prettyPrint=false
Content-Type: application/json
{
......
POST https://www.googleapis.com/drive/v2/files?convert=false&ocr=false&pinned=false&useContentAsIndexableText=false&supportsAllDrives=true&prettyPrint=false
POST https://www.googleapis.com/drive/v2/files?convert=false&enforceSingleParent=false&ocr=false&pinned=false&useContentAsIndexableText=false&supportsAllDrives=true&prettyPrint=false
Content-Type: application/json
{
......
POST https://www.googleapis.com/drive/v2/files/abc123def456ghi789/copy?convert=false&ocr=false&pinned=false&useContentAsIndexableText=false&supportsAllDrives=true&prettyPrint=false
POST https://www.googleapis.com/drive/v2/files/abc123def456ghi789/copy?convert=false&enforceSingleParent=false&ocr=false&pinned=false&useContentAsIndexableText=false&supportsAllDrives=true&prettyPrint=false
Content-Type: application/json
{
......
......@@ -21,21 +21,24 @@ class Q_DECL_HIDDEN FileAbstractDataJob::Private
Private();
bool convert;
bool enforceSingleParent;
QString includePermissionsForView;
bool ocr;
QString ocrLanguage;
bool pinned;
bool supportsAllDrives;
QString timedTextLanguage;
QString timedTextTrackName;
bool useContentAsIndexableText;
bool supportsAllDrives;
};
FileAbstractDataJob::Private::Private():
convert(false),
enforceSingleParent(false),
ocr(false),
pinned(false),
useContentAsIndexableText(false),
supportsAllDrives(true)
supportsAllDrives(true),
useContentAsIndexableText(false)
{
}
......@@ -66,6 +69,38 @@ void FileAbstractDataJob::setConvert(bool convert)
d->convert = convert;
}
bool FileAbstractDataJob::enforceSingleParent() const
{
return d->enforceSingleParent;
}
void FileAbstractDataJob::setEnforceSingleParent(bool enforceSingleParent)
{
if (isRunning()) {
qCWarning(KGAPIDebug) << "Can't modify enforceSingleParent property when job is running";
return;
}
d->enforceSingleParent = enforceSingleParent;
}
QString FileAbstractDataJob::includePermissionsForView() const
{
return d->includePermissionsForView;
}
void FileAbstractDataJob::setIncludePermissionsForView(const QString &includePermissionsForView)
{
if (isRunning()) {
qCWarning(KGAPIDebug) << "Can't modify includePermissionsForView property when job is running";
return;
}
d->includePermissionsForView = includePermissionsForView;
}
bool FileAbstractDataJob::ocr() const
{
return d->ocr;
......@@ -111,6 +146,16 @@ void FileAbstractDataJob::setPinned(bool pinned)
d->pinned = pinned;
}
bool FileAbstractDataJob::supportsAllDrives() const
{
return d->supportsAllDrives;
}
void FileAbstractDataJob::setSupportsAllDrives(bool supportsAllDrives)
{
d->supportsAllDrives = supportsAllDrives;
}
QString FileAbstractDataJob::timedTextLanguage() const
{
return d->timedTextLanguage;
......@@ -157,22 +202,19 @@ bool FileAbstractDataJob::useContentAsIndexableText() const
return d->useContentAsIndexableText;
}
bool FileAbstractDataJob::supportsAllDrives() const
{
return d->supportsAllDrives;
}
void FileAbstractDataJob::setSupportsAllDrives(bool supportsAllDrives)
{
d->supportsAllDrives = supportsAllDrives;
}
QUrl FileAbstractDataJob::updateUrl(QUrl &url)
{
QUrlQuery query(url);
query.removeQueryItem(QStringLiteral("convert"));
query.addQueryItem(QStringLiteral("convert"), Utils::bool2Str(d->convert));
query.removeQueryItem(QStringLiteral("enforceSingleParent"));
query.removeQueryItem(QStringLiteral("includePermissionsForView"));
query.addQueryItem(QStringLiteral("enforceSingleParent"), Utils::bool2Str(d->enforceSingleParent));
if (!d->includePermissionsForView.isEmpty()) {
query.addQueryItem(QStringLiteral("includePermissionsForView"), d->includePermissionsForView);
}
query.removeQueryItem(QStringLiteral("ocr"));
query.removeQueryItem(QStringLiteral("ocrLanguage"));
query.addQueryItem(QStringLiteral("ocr"), Utils::bool2Str(d->ocr));
......
......@@ -34,6 +34,34 @@ class KGAPIDRIVE_EXPORT FileAbstractDataJob : public KGAPI2::Job
READ convert
WRITE setConvert)
/**
* Whether to opt in to API behavior that aims for all items to have exactly
* one parent. This parameter only takes effect if the item is not in a shared
* drive. Requests that specify more than one parent fail.
*
* If the item's owner makes a request to add a single parent, the item is removed
* from all current folders and placed in the requested folder. Other requests
* that increase the number of parents fail, except when the canAddMyDriveParent
* file capability is true and a single parent is being added.
*
* Default value is false.
*
* This property can be modified only when the job is not running.
*/
Q_PROPERTY(bool enforceSingleParent
READ enforceSingleParent
WRITE setEnforceSingleParent)
/**
* Specifies which additional view's permissions to include in the response.
* Only 'published' is supported.
*
* This property can be modified only when the job is not running.
*/
Q_PROPERTY(QString includePermissionsForView
READ includePermissionsForView
WRITE setIncludePermissionsForView)
/**
* Whether to attempt OCR on .jpg, .png, .gif, or .pdf uploads.
*
......@@ -66,6 +94,17 @@ class KGAPIDRIVE_EXPORT FileAbstractDataJob : public KGAPI2::Job
READ pinned
WRITE setPinned)
/**
* Sets whether the request supports both My Drives and shared drives.
*
* Set to true by default as LibKGAPI supports Team Drives.
*
* This property can be modified only when the job is not running.
*/
Q_PROPERTY(bool supportsAllDrives
READ supportsAllDrives
WRITE setSupportsAllDrives)
/**
* The language of timed text,
*
......@@ -95,17 +134,6 @@ class KGAPIDRIVE_EXPORT FileAbstractDataJob : public KGAPI2::Job
READ useContentAsIndexableText
WRITE setUseContentAsIndexableText)
/**
* Sets whether the request supports both My Drives and shared drives.
*
* Set to true by default as LibKGAPI supports Team Drives.
*
* This property can be modified only when the job is not running.
*/
Q_PROPERTY(bool supportsAllDrives
READ supportsAllDrives
WRITE setSupportsAllDrives)
public:
explicit FileAbstractDataJob(const AccountPtr &account,
QObject *parent = nullptr);
......@@ -113,6 +141,12 @@ class KGAPIDRIVE_EXPORT FileAbstractDataJob : public KGAPI2::Job
bool convert() const;
void setConvert(bool convert);
bool enforceSingleParent() const;
void setEnforceSingleParent(bool enforceSingleParent);
QString includePermissionsForView() const;
void setIncludePermissionsForView(const QString &includePermissionsForView);
bool ocr() const;
void setOcr(bool ocr);
......@@ -123,15 +157,6 @@ class KGAPIDRIVE_EXPORT FileAbstractDataJob : public KGAPI2::Job
bool pinned() const;
void setPinned(bool pinned);
QString timedTextLanguage() const;
void setTimedTextLanguage(const QString &timedTextLanguage);
QString timedTextTrackName() const;
void setTimedTextTrackName(const QString &timedTextTrackName);
bool useContentAsIndexableText() const;
void setUseContentAsIndexableText(bool useContentAsIndexableText);
/**
* @brief Whether the request supports both My Drives and shared drives.
*
......@@ -152,6 +177,15 @@ class KGAPIDRIVE_EXPORT FileAbstractDataJob : public KGAPI2::Job
*/
KGAPIDRIVE_DEPRECATED void setSupportsAllDrives(bool supportsAllDrives);
QString timedTextLanguage() const;
void setTimedTextLanguage(const QString &timedTextLanguage);
QString timedTextTrackName() const;
void setTimedTextTrackName(const QString &timedTextTrackName);
bool useContentAsIndexableText() const;
void setUseContentAsIndexableText(bool useContentAsIndexableText);
protected:
QUrl updateUrl(QUrl &url);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment