Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions Project/Sources/Classes/GoogleCalendar.4dm
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,11 @@ Function getCalendars($inParameters : Object) : Object
$delimiter:="&"
End if

var $URL : Text:=This._getURL()+$urlParams
var $result : cs.GoogleCalendarList:=cs.GoogleCalendarList.new(This._getOAuth2Provider(); $URL; $headers)
var $options : Object:={}
$options.url:=This._getURL()+$urlParams
$options.headers:={Accept: "application/json"}

var $result : cs.GoogleCalendarList:=cs.GoogleCalendarList.new(This._getOAuth2Provider(); $options)

Super._throwErrors(True)

Expand Down Expand Up @@ -205,7 +208,6 @@ Function getEvents($inParameters : Object) : Object
Super._clearErrorStack()
Super._throwErrors(False)

var $headers : Object:={Accept: "application/json"}
var $calendarId : Text:=(Length(String($inParameters.calendarId))>0) ? $inParameters.calendarId : "primary"
var $urlParams : Text:="calendars/"+cs.Tools.me.urlEncode($calendarID)+"/events"
var $delimiter : Text:="?"
Expand Down Expand Up @@ -275,10 +277,12 @@ Function getEvents($inParameters : Object) : Object
End if
$urlParams+=($delimiter+"timeZone="+String($timeZone))

var $URL : Text:=This._getURL()+$urlParams
var $options : Object:={}
$options.url:=This._getURL()+$urlParams
$options.headers:={Accept: "application/json"}
$options.attributes:=["kind"; "etag"; "summary"; "calendarId"; "description"; "updated"; "timeZone"; "accessRole"; "defaultReminders"]

var $additionalAttributes : Collection:=["kind"; "etag"; "summary"; "calendarId"; "description"; "updated"; "timeZone"; "accessRole"; "defaultReminders"]
var $result : cs.GoogleEventList:=cs.GoogleEventList.new(This._getOAuth2Provider(); $URL; $headers; $additionalAttributes)
var $result : cs.GoogleEventList:=cs.GoogleEventList.new(This._getOAuth2Provider(); $options)

If ((Value type($result.calendarId)=Is undefined) && (Value type($inParameters.calendarId)=Is text) && (Length(String($inParameters.calendarId))>0))
$result.calendarId:=$inParameters.calendarId
Expand Down
4 changes: 2 additions & 2 deletions Project/Sources/Classes/GoogleCalendarList.4dm
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Class extends _GoogleBaseList

Class constructor($inProvider : cs.OAuth2Provider; $inURL : Text; $inHeaders : Object)
Class constructor($inProvider : cs.OAuth2Provider; $inParameters : Object)

Super($inProvider; $inURL; "items"; $inHeaders)
Super($inProvider; $inParameters)


// Mark: - [Public]
Expand Down
4 changes: 2 additions & 2 deletions Project/Sources/Classes/GoogleEventList.4dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ property timeZone : Text
property accessRole : Text
property defaultReminders : Collection

Class constructor($inProvider : cs.OAuth2Provider; $inURL : Text; $inHeaders : Object; $inAdditionalAttributes : Collection)
Class constructor($inProvider : cs.OAuth2Provider; $inParameters : Object)

Super($inProvider; $inURL; "items"; $inHeaders; $inAdditionalAttributes)
Super($inProvider; $inParameters)


// Mark: - [Public]
Expand Down
2 changes: 1 addition & 1 deletion Project/Sources/Classes/GoogleMailIdList.4dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Class extends _GoogleBaseList

Class constructor($inProvider : cs.OAuth2Provider; $inURL : Text)

Super($inProvider; $inURL; "messages")
Super($inProvider; {url: $inURL; elements: "messages"})
This._internals._URL:=$inURL


Expand Down
2 changes: 1 addition & 1 deletion Project/Sources/Classes/GoogleUserList.4dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Class extends _GoogleBaseList

Class constructor($inProvider : cs.OAuth2Provider; $inURL : Text; $inHeaders : Object)

Super($inProvider; $inURL; "people"; $inHeaders)
Super($inProvider; {url: $inURL; elements: "people"; headers: $inHeaders})


// Mark: - [Public]
Expand Down
26 changes: 14 additions & 12 deletions Project/Sources/Classes/_GoogleBaseList.4dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ property statusText : Text
property success : Boolean
property errors : Collection

Class constructor($inProvider : cs.OAuth2Provider; $inURL : Text; $inResultListName : Text; $inHeaders : Object; $inAdditionalAttributes : Collection)
Class constructor($inProvider : cs.OAuth2Provider; $inParameters : Object)

Super($inProvider)

This._internals._URL:=$inURL
This._internals._headers:=$inHeaders
This._internals._attribute:=$inResultListName
This._internals._additionalAttributes:=$inAdditionalAttributes
If ((Value type($inParameters.url)=Is text) && (Length($inParameters.url)>0))
This._internals._URL:=$inParameters.url
End if
This._internals._headers:=(Value type($inParameters.headers)=Is object) ? $inParameters.headers : Null
This._internals._elements:=((Value type($inParameters.elements)=Is text) && (Length($inParameters.elements)>0)) ? $inParameters.elements : "items"
This._internals._attributes:=(Value type($inParameters.attributes)=Is collection) ? $inParameters.attributes : Null
This._internals._nextPageToken:=""
This._internals._history:=[]
This._internals._throwErrors:=False
Expand Down Expand Up @@ -50,16 +52,16 @@ Function _getList($inPageToken : Text) : Boolean

If ($response#Null)

If (OB Is defined($response; This._internals._attribute))
This._internals._list:=OB Get($response; This._internals._attribute; Is collection)
If (OB Is defined($response; This._internals._elements))
This._internals._list:=OB Get($response; This._internals._elements; Is collection)
End if

If (This._internals._additionalAttributes#Null)
var $key : Text
For each ($key; This._internals._additionalAttributes)
If (This._internals._attributes#Null)
var $attribute : Text
For each ($attribute; This._internals._attributes)

If (OB Is defined($response; $key))
This[$key]:=OB Get($response; $key)
If (OB Is defined($response; $attribute))
This[$attribute]:=OB Get($response; $attribute)
End if
End for each
End if
Expand Down
Loading