View Issue Details

IDProjectCategoryView StatusLast Update
0037824FPCPackagespublic2020-10-05 13:09
ReporterMarton Papp Assigned ToMichael Van Canneyt  
PrioritynormalSeverityminorReproducibilityalways
Status assignedResolutionopen 
PlatformWindowsOSWindows 
Product Version3.2.0 
Summary0037824: google drive missing some fields and I am submitting a patch to fix that
DescriptionList functionality missing a field.... "fields"
that can be used to retrieve what fields one wants.
Steps To ReproduceSee google drive demo.... and modify it like this...
procedure TMainForm.ShowFolder(AFolderID : String);

var
  Entry: TFile;
  EN : String;
  i:integer;
  Q : TFilesListOptions;
  List : TFileList;
  Resource : TFilesResource;
  LI : TListItem;

begin
 
  Resource:=Nil;

    Resource:=FDriveAPI.CreateFilesResource(Self);
    // Search for files of indicated folder only.
    Q.q:='mimeType != ''application/vnd.google-apps.folder'' and '''+AFolderId+''' in parents';
    Q.pageSize :=100 ;
    Q.fields := 'files/createdTime, files/size, files/version, files/mimeType';
end;
Additional InformationI am submitting a patch to fix the problem
I tried to solution

TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files

Activities

Marton Papp

2020-09-27 18:43

reporter  

googledrivepatch (468 bytes)   
*** C:/fpcupdeluxe/fpcsrc/packages/googleapi/src/googledrive.pp	Tue May 24 10:35:58 2016
--- C:/lazarus/fpc/3.2.0/source/packages/googleapi/src/googledrive.pp	Sun Sep 27 12:53:55 2020
***************
*** 1215,1216 ****
--- 1215,1217 ----
      spaces : String;
+     fields: String;
    end;
***************
*** 4122,4123 ****
--- 4123,4125 ----
    AddToQuery(_Q,'spaces',AQuery.spaces);
+   AddToQuery(_Q,'fields',AQuery.fields);
    Result:=List(_Q);
googledrivepatch (468 bytes)   

Marton Papp

2020-09-30 14:39

reporter   ~0125989

another patch use it too
to improve google api
googledrivepatchtotal (2,599 bytes)   
*** C:/fpcupdeluxe/fpcsrc/packages/googleapi/src/googledrive.pp	Tue May 24 10:35:58 2016
--- C:/lazarus/fpc/3.2.0/source/packages/googleapi/src/googledrive.pp	Sun Sep 27 12:53:55 2020
***************
*** 1215,1216 ****
--- 1215,1217 ----
      spaces : String;
+     fields: String;
    end;
***************
*** 4122,4123 ****
--- 4123,4125 ----
    AddToQuery(_Q,'spaces',AQuery.spaces);
+   AddToQuery(_Q,'fields',AQuery.fields);
    Result:=List(_Q);

*** C:/fpcupdeluxe/fpcsrc/packages/googleapi/src/googledrive.pp	Sun Sep 27 17:39:03 2020
--- C:/lazarus/fpc/3.2.0/source/packages/googleapi/src/googledrive.pp	Mon Sep 28 14:26:06 2020
***************
*** 1203,1204 ****
--- 1203,1206 ----
      acknowledgeAbuse : boolean;
+     fields:String;
+     alt:String;
    end;
***************
*** 1252,1253 ****
--- 1254,1256 ----
      Function Get(fileId: string; AQuery : TFilesgetOptions) : TFile;
+     Function GetString(fileId: string; AQuery : TFilesgetOptions) : String;
      Function List(AQuery : string  = '') : TFileList;
***************
*** 4095,4098 ****
--- 4098,4126 ----
    AddToQuery(_Q,'acknowledgeAbuse',AQuery.acknowledgeAbuse);
+   AddToQuery(_Q,'fields',AQuery.fields);
    Result:=Get(fileId,_Q);
  end;
+ 
+ Function TFilesResource.GetString(fileId: string; AQuery : TFilesgetOptions) : String;
+ 
+ Var
+   _Q : String;
+ Const
+   _HTTPMethod = 'GET';
+   _Path       = 'files/{fileId}';
+   _Methodid   = 'drive.files.get';
+ 
+ Var
+   _P : String;
+ 
+ begin
+   _Q:='';
+   AddToQuery(_Q,'acknowledgeAbuse',AQuery.acknowledgeAbuse);
+   AddToQuery(_Q,'fields',AQuery.fields);
+   AddToQuery(_Q,'alt',AQuery.alt);
+   _P:=SubstitutePath(_Path,['fileId',fileId]);
+   Result:=ServiceCall(_HTTPMethod,_P,_Q);
+ 
+   //Result:=Get(fileId,_Q);
+ end;
+ 
  
*** C:/fpcupdeluxe/fpcsrc/packages/googleapi/src/googleservice.pp	Sat May 16 09:42:40 2015
--- C:/lazarus/fpc/3.2.0/source/packages/googleapi/src/googleservice.pp	Mon Sep 28 14:25:04 2020
***************
*** 119,120 ****
--- 119,121 ----
      Function ServiceCall(Const AMethod, APath, AQuery: String; AInput: TGoogleBaseObject;  AReturnClass: TGoogleBaseObjectClass): TGoogleBaseObject; virtual;
+     Function ServiceCall(Const AMethod, APath, AQuery: String): String;
    PubliC
***************
*** 351,352 ****
--- 352,362 ----
  end;
+ 
+ Function TGoogleResource.ServiceCall(Const AMethod, APath, AQuery: String
+   ): String;
+ begin
+   CheckAPI;
+   Result:=API.ServiceCall(Self,AMethod,APath,AQuery,'');
+ end;
+ 
+ 
  
googledrivepatchtotal (2,599 bytes)   

Marton Papp

2020-09-30 14:43

reporter   ~0125990

Last edited: 2020-09-30 14:46

View 2 revisions

I also update the google drive demo so it works now.. but it needs the previous patches.
drivedemo.zip (74,006 bytes)

Issue History

Date Modified Username Field Change
2020-09-27 18:43 Marton Papp New Issue
2020-09-27 18:43 Marton Papp File Added: googledrivepatch
2020-09-30 14:39 Marton Papp Note Added: 0125989
2020-09-30 14:39 Marton Papp File Added: googledrivepatchtotal
2020-09-30 14:43 Marton Papp Note Added: 0125990
2020-09-30 14:43 Marton Papp File Added: drivedemo.zip
2020-09-30 14:46 Marton Papp Note Edited: 0125990 View Revisions
2020-10-05 13:09 Michael Van Canneyt Assigned To => Michael Van Canneyt
2020-10-05 13:09 Michael Van Canneyt Status new => assigned