Page 4 of 9

Re: Google APIS Lib for Fivewin

PostPosted: Wed Feb 14, 2018 6:11 pm
by cnavarro
Read documentarion ( powerpoint presentation of Austria ) or PDF document

https://bitbucket.org/fivetech/harbour_ ... o_REST.pdf
( pages 45 and 46 )

Re: Google APIS Lib for Fivewin

PostPosted: Wed Feb 14, 2018 6:14 pm
by Silvio.Falconi
ok i create the file client_id.json from my My Project-2db95ee820d0.json
run gcalndar.exe
but I see nothing

Re: Google APIS Lib for Fivewin

PostPosted: Wed Feb 14, 2018 6:23 pm
by cnavarro
Modify prg

Code: Select all  Expand view


Function CalendList()

   local oCalendList
   local lSw      := .F.

   oCalendList  := TGCalendarList():New()
   lSw          := oCalendList:Activate()
   if lSw
      ? "Activado"
      oCalendList:ListCalendars()
      XBrowse( oCalendList:aCalendList )
   else
      ? oCalend:cError
   endif

Return nil

//----------------------------------------------------------------------------//

 

Re: Google APIS Lib for Fivewin

PostPosted: Wed Feb 14, 2018 6:27 pm
by Silvio.Falconi
ok now it request
email and password google

then I saw a msginfo "activado "

and now I have a xbrowse

Image


How I can insert it on calendar dbf ?

Re: Google APIS Lib for Fivewin

PostPosted: Wed Feb 14, 2018 6:31 pm
by cnavarro
Methods they do not use any rdd
Export array to dbf: FW_ArrayToDBF

If I created a dbf it would be a mistake
You have to understand that each user prefers a different structure of the dbf or prefers to export directly to fwmaria or any other rdd with a custom structure

Re: Google APIS Lib for Fivewin

PostPosted: Thu Feb 15, 2018 9:02 am
by Silvio.Falconi
ok Cris , My error was to create json from credential no Auth Now it is ok I can help Italian fwh User if they need the help for this
I tried also Gdrive and Gmail
for this two sample I not see nothing
How test the other classes ? thanks

Re: Google APIS Lib for Fivewin

PostPosted: Thu Feb 15, 2018 12:16 pm
by cnavarro
You added APIS for use this products to you project google console?

Re: Google APIS Lib for Fivewin

PostPosted: Thu Feb 15, 2018 1:01 pm
by Silvio.Falconi
I set all products

Re: Google APIS Lib for Fivewin

PostPosted: Thu Feb 15, 2018 7:58 pm
by cnavarro
And when you have added new APIS, you are download json file again and put this file in path of exe?

Re: Google APIS Lib for Fivewin

PostPosted: Thu Feb 15, 2018 10:47 pm
by Silvio.Falconi
Why i cannot use the same json i use fir gcalendar? It is the same Project

Re: Google APIS Lib for Fivewin

PostPosted: Thu Feb 15, 2018 10:54 pm
by cnavarro
you must use a single .json file updated for all products

Re: Google APIS Lib for Fivewin

PostPosted: Fri Feb 16, 2018 9:37 am
by Silvio.Falconi
I not understood
I downloaded a json file and I tried gcalendar Test and it run ok
I cannot use the same json file for nother service as gDrive or gmail ?

Re: Google APIS Lib for Fivewin

PostPosted: Fri Feb 16, 2018 9:49 am
by Silvio.Falconi
this morning I tried with gcalendar and I have this error after it askme the user/password of google and showed "activado" message

Application
===========
Path and name: C:\work\Prg\GOOGLE\gcalend.Exe (32 bits)
Size: 3,807,232 bytes
Compiler version: Harbour 3.2.0dev (r1712141320)
FiveWin version: FWH 17.12
C compiler version: Borland/Embarcadero C++ 7.3 (32-bit)
Windows version: 6.2, Build 9200

Time from start: 0 hours 1 mins 0 secs
Error occurred at: 16/02/2018, 10:47:57
Error description: Error BASE/1132 Bound error: array access
Args:
[ 1] = A { ... } length: 0
[ 2] = N 1

Stack Calls
===========
Called from: d:\fwh\fwhteam\source\internal\Tgevecal.prg => TGEVENTCALC:LISTEVENT( 275 )
Called from: gcalend.prg => EVENTLIST( 74 )
Called from: gcalend.prg => MAIN( 21 )

Re: Google APIS Lib for Fivewin

PostPosted: Fri Feb 16, 2018 9:53 am
by Silvio.Falconi
sorry I must activate the service on google I understood now


tried gcalendar I see the records I allready abilitate the service
tried gmail I see nothing ( only xbrowse and criptated strings) I allready abilitate the service
tried gdrive 0 and 1 I see the records I allready abilitate the service

Re: Google APIS Lib for Fivewin

PostPosted: Fri Feb 16, 2018 2:10 pm
by cnavarro
Silvio.Falconi wrote:tried gmail I see nothing ( only xbrowse and criptated strings) I allready abilitate the service


You see Id of thread and id of message
With Id of message, you can see all the properties of the message
Try with this sample

Code: Select all  Expand view


//----------------------------------------------------------------------------//
//
// GGMAIL.PRG: sample use Class TGMail from TGGoogle
// Author: Cristobal Navarro ( C ) 20/11/2017 - 16/02/2018
//
//----------------------------------------------------------------------------//

#include "Fivewin.ch"
#include "Splitter.ch"
#include "colores.ch"

REQUEST HB_CODEPAGE_ESWIN

Static nLeftPos
Static oMail

Function Main()

   local aMessages   := Main1()
   if !Empty( aMessages )
      XbrwMail(,,,,, aMessages )
   endif

Return nil

//----------------------------------------------------------------------------//

Function Main1()

   local lSw    := .F.
   local aList  := {}
   HB_CDPSELECT( "ESWIN" )
   
   oMail := TGMail():New()

   // you can configure the name and path of the json file between New and Activate methods
   // oMail:cJSonFile  := ".\client_id.json"      

   lSw   := oMail:Activate()
   if lSw
     
      //
      oMail:SentMessages()
      aList   := AClone( oMail:aMessages )
      //XBrowse( oMail:aMessages )
   endif

Return aList   //oMail:aMessages

//----------------------------------------------------------------------------//

Function XbrwMail( oWnd, nT, nL, nB, nR, aSource )

   local lWnd       := .F.
   local oVSplitL
   local oBrw
   local oPnel1
   local nTop
   local nHeight
   local aMsgs      := {}

   AEVal( aSource, { | a | AAdd( aMsgs, { a[ 1 ], a[ 2 ], "" } ) } )
   oMail:GetMessage( aMsgs[ 1 ][ 1 ] )
   nLeftPos    := Min( 300, Int( GetSysMetrics( 0 ) / 5 ) )
   if Empty( oWnd )
      lWnd     := .T.
      DEFINE WINDOW oWnd ;
         TITLE " - Google Mail - " + FWVERSION + " - " + hb_Compiler() ;
         PIXEL COLOR CLR_BLUE, CLR_WHITE //STYLE WS_POPUP
   endif
   nTop    := if( Empty( oWnd:oBar ), 0, oWnd:oBar:nBottom ) + 2
   nHeight := if( Empty( oWnd:oMsgBar ), 32, oWnd:oMsgBar:nTop - 2 )

   @ nTop, nLeftPos + 2 XBROWSE oBrw DATASOURCE aMsgs OF oWnd ;
      SIZE GetSysMetrics( 0 ) - nLeftPos - 4, GetSysMetrics( 1 ) - nHeight ;
      HEADERS "Thread", "Id", "Message" ;
      COLUMNS 2, 1, 3 ;
      PIXEL CELL LINES NOBORDER

   WITH OBJECT oBrw
      :l2007            := .F.
      //:nMarqueeStyle    := MARQSTYLE_DOTEDCELL
      :nStretchCol      := 3
      :bClrHeader       := { || { CLR_WHITE, CLR_GRAY } }
      :bClrSelFocus     := ;
      :bClrSel          := { || { CLR_BLACK, CLR_HGRAY } }
      :lRecordSelector  := .F.
      :lHScroll         := .F.
      :nColDividerStyle := ;
      :nRowDividerStyle := LINESTYLE_LIGHTGRAY
      :nRowHeight       := 87
      WITH OBJECT :aCols[ 3 ]
         :bClrStd       := { || { CLR_BLUE, CLR_WHITE } }
         :nDataStrAlign := 0
         :bEditValue    := { || oMail:GetMessage( oBrw:aRow[ 1 ] ), oMail:cMessage }
      END
      :CreateFromCode()
   END

   if lWnd
      oPnel1 := TPanel():New( nTop + 2, 2, GetSysMetrics( 1 ) - nHeight, nLeftPos - 2, oWnd )
      oPnel1:SetColor( CLR_WHITE, METRO_GRIS7 )
     
      @ nTop, nLeftPos SPLITTER oVSplitL ;
           VERTICAL ;
           PREVIOUS CONTROLS oPnel1 ;
           HINDS CONTROLS oBrw ;
           LEFT MARGIN   0 ;
           RIGHT MARGIN 80 ;
           SIZE 1, GetSysMetrics( 1 ) - nHeight + 2 ;
           COLOR CLR_HGRAY ; //oWnd:nClrPane ;
           PIXEL OF oWnd
      oVSplitL:lStatic := .T.

      ACTIVATE WINDOW oWnd MAXIMIZED
   endif

Return nil

//----------------------------------------------------------------------------//