Add fields standard query parameter to Job and use it in FileFetchJob.
ClosedPublic

Authored by barchiesi on Apr 28 2019, 9:47 PM.

Details

Summary

Add fields standard query parameter to Job and use it in FileFetchJob. This change requires clients using this library to change the way they limit what fields are returned in a FileFetchJob.
Start adding entity field declarations for use with Job::setFields().

See D19948 DRAFT Add Standard Query Parameters support for previous discussions.

Diff Detail

Repository
R477 KGAPI Library
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
barchiesi created this revision.Apr 28 2019, 9:47 PM
Restricted Application added a project: KDE PIM. · View Herald TranscriptApr 28 2019, 9:47 PM
Restricted Application added a subscriber: kde-pim. · View Herald Transcript

Does this change require any changes to KIO GDrive?

Otherwise looks good 👍

Yes this change affects all LibKGAPI users that used the FileFetchJob::setFields() function. A patch for KIO Gdrive fixes the incompatibility, although I'm not sure how to specify that it should be blocked until the new LibKGAPI release.

barchiesi updated this revision to Diff 57174.Apr 29 2019, 11:52 AM

Added Teamdrive field mappings.

Since this changes the API, we must also bump the version in CMakeLists.txt. KIO GDrive will then have to have an #ifdef on LibKGAPI version to use either the old or the new approach, based on against what version of LibKGAPI it is compiled. This LibKGAPI API will not be publicly available until August (KDE Applications 19.08 release).

Another option is to have KIO GDrive master depend on the master of LibKGAPI and not doing any KIO GDrive release from master until LibKGAPI 19.08 is released (but I doubt @elvisangelaccio would be too happy about that :-) )

barchiesi updated this revision to Diff 57191.Apr 29 2019, 3:01 PM

Since this changes the API, we must also bump the version in CMakeLists.txt. KIO GDrive will then have to have an #ifdef on LibKGAPI version to use either the old or the new approach, based on against what version of LibKGAPI it is compiled. This LibKGAPI API will not be publicly available until August (KDE Applications 19.08 release).

Another option is to have KIO GDrive master depend on the master of LibKGAPI and not doing any KIO GDrive release from master until LibKGAPI 19.08 is released (but I doubt @elvisangelaccio would be too happy about that :-) )

I guess we should let @elvisangelaccio decide, I believe the first approach is better because it allows building a newer KIO GDrive against older versions of LibKGAPI.

I think this revision needs some more work anyways, I would like to find an elegant way of applying the fields query param in the case of lists. Both FileFetchJob and TeamdriveFetchJob (as seen in my last update) need to manually handle applying filters to items.

barchiesi updated this revision to Diff 57328.May 1 2019, 4:57 PM
barchiesi retitled this revision from Add fields standard query parameter to Job and use it in FileFetchJob. to Add fields standard query parameter to Job and use it in FileFetchJob..

Updated after revision D20789 change.

I was planning to do a new kio-gdrive release once we can announce Team Drive as working feature.

Does LibKGAPI 19.04 already have full Team Drive support? If yes, then we can go with #ifdefs to support this new API.

LibKGAPI 19.04 has full support for the Teamdrives REST API but unfortunately that isn't sufficient for completely manipulating them in KIO GDrive. The KIO GDrive patch for Team Drives that I'm working on requires this revision for querying if the user can create Team Drives and it requires D20789 for uploading files and finding parents. I'll probably find more stuff that needs to be added to LibKGAPI.
Therefore KIO GDrive won't be able to support Team Drives until LibKGAPI 19.08. As soon as I have most of the functionality ready, I will submit a revision so you can start looking at it.

barchiesi set the repository for this revision to R477 KGAPI Library.May 1 2019, 6:16 PM

@barchiesi can you update D20888 to add #ifdefs for kgapi version, please, so I can start merging this patchset? :-)

Since we need to wait for LibKGAPI 19.08, I'd actually prefer to not use #ifdefs but just make kio-gdrive master depend on LibKGAPI master. There are no other features waiting to be released anyway.

Ah, my bad. In that case, @barchiesi , please bump PIM_VERSION in CMakeLists.txt` as part of this patch, so kio-gdrive can depend on a specific version with the fixed API.

barchiesi updated this revision to Diff 58050.May 14 2019, 8:00 AM

I bumped PIM_VERSION, but I'm not sure how versioning works in this project so I only increased the PATCH number.

I think this patch needs to be rebased, here's what I get when I try to apply it:

$ arc patch D20886
 INFO  Base commit is not in local repository; trying to fetch.
Created and checked out branch arcpatch-D20886.
Created and checked out branch arcpatch-D20789.
Checking patch src/drive/permissionmodifyjob.h...
Checking patch src/drive/permissionmodifyjob.cpp...
Checking patch src/drive/permissionfetchjob.h...
Checking patch src/drive/permissionfetchjob.cpp...
Checking patch src/drive/permissiondeletejob.h...
Checking patch src/drive/permissiondeletejob.cpp...
Checking patch src/drive/permissioncreatejob.h...
Checking patch src/drive/permissioncreatejob.cpp...
Checking patch src/drive/parentreferencecreatejob.h...
Checking patch src/drive/parentreferencecreatejob.cpp...
Checking patch src/drive/filefetchjob.h...
Checking patch src/drive/filefetchjob.cpp...
Checking patch src/drive/fileabstractuploadjob.h...
Checking patch src/drive/fileabstractuploadjob.cpp...
Checking patch src/drive/childreferencecreatejob.h...
Checking patch src/drive/childreferencecreatejob.cpp...
Checking patch src/drive/changefetchjob.h...
Checking patch src/drive/changefetchjob.cpp...
Checking patch examples/teamdrive/ui/main.ui...
Checking patch examples/teamdrive/mainwindow.h...
Checking patch examples/teamdrive/mainwindow.cpp...
Checking patch autotests/drive/data/file2_create_request.txt...
error: the patch applies to 'autotests/drive/data/file2_create_request.txt' (b02b6ce294b8c3ad745edaa0b91eaeb4978c3da2), which does not match the current contents.
error: autotests/drive/data/file2_create_request.txt: patch does not apply
Checking patch autotests/drive/data/file1_create_request.txt...
Checking patch autotests/drive/data/changes_fetch_page1_request.txt...
Checking patch autotests/drive/data/change1_fetch_request.txt...
Applied patch src/drive/permissionmodifyjob.h cleanly.
Applied patch src/drive/permissionmodifyjob.cpp cleanly.
Applied patch src/drive/permissionfetchjob.h cleanly.
Applied patch src/drive/permissionfetchjob.cpp cleanly.
Applied patch src/drive/permissiondeletejob.h cleanly.
Applied patch src/drive/permissiondeletejob.cpp cleanly.
Applied patch src/drive/permissioncreatejob.h cleanly.
Applied patch src/drive/permissioncreatejob.cpp cleanly.
Applied patch src/drive/parentreferencecreatejob.h cleanly.
Applied patch src/drive/parentreferencecreatejob.cpp cleanly.
Applied patch src/drive/filefetchjob.h cleanly.
Applied patch src/drive/filefetchjob.cpp cleanly.
Applied patch src/drive/fileabstractuploadjob.h cleanly.
Applied patch src/drive/fileabstractuploadjob.cpp cleanly.
Applied patch src/drive/childreferencecreatejob.h cleanly.
Applied patch src/drive/childreferencecreatejob.cpp cleanly.
Applied patch src/drive/changefetchjob.h cleanly.
Applied patch src/drive/changefetchjob.cpp cleanly.
Applied patch examples/teamdrive/ui/main.ui cleanly.
Applied patch examples/teamdrive/mainwindow.h cleanly.
Applied patch examples/teamdrive/mainwindow.cpp cleanly.
Applied patch autotests/drive/data/file1_create_request.txt cleanly.
Applied patch autotests/drive/data/changes_fetch_page1_request.txt cleanly.
Applied patch autotests/drive/data/change1_fetch_request.txt cleanly.

 Patch Failed! 
Usage Exception: Unable to apply patch!

Just use --skip-dependencies - arc is confused becasue the commits from previous reviews landed with different commit hashes than arc expects.

That worked, thanks :)

This revision was not accepted when it landed; it landed in state Needs Review.May 19 2019, 11:25 AM
This revision was automatically updated to reflect the committed changes.