Skip to content

Commit

Permalink
Feature GitHub:11200 (initial commit)
Browse files Browse the repository at this point in the history
  • Loading branch information
yannicktrinh committed Nov 12, 2024
1 parent 896d96c commit 7f48afe
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Project/Sources/Classes/GraphCalendarList.4dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Class extends _GraphBaseList

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

Super($inProvider; $inURL; $inHeaders)


// Mark: - [Public]
// ----------------------------------------------------


Function get calendars() : Collection

return This._internals._list
11 changes: 11 additions & 0 deletions Project/Sources/Classes/Office365.4dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,14 @@ Function get mail : cs.Office365Mail
This._internals._mail:=cs.Office365Mail.new(This._internals._oAuth2Provider; This._internals._parameters)
End if
return This._internals._mail


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


Function get calendar : cs.Office365Calendar

If (This._internals._calendar=Null)
This._internals._calendar:=cs.Office365Calendar.new(This._internals._oAuth2Provider)
End if
return This._internals._calendar
79 changes: 79 additions & 0 deletions Project/Sources/Classes/Office365Calendar.4dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
Class extends _GraphAPI

Class constructor($inProvider : cs.OAuth2Provider)

Super($inProvider)


// Mark: - [Private]
// ----------------------------------------------------


// Mark: - [Public]
// ----------------------------------------------------


Function getCalendar($inID : Text; $inSelect : Text) : Object

var $urlParams : Text:=""

If (Length(String($inID))>0)
$urlParams:="users/"+String($inID)+"/calendar"
Else
$urlParams:="me/calendar"
End if

If (Length(String($inSelect))>0)
$urlParams:=$urlParams+"?$select="+$inSelect
End if

var $URL : Text:=This._getURL()+$urlParams
var $response : Variant:=Super._sendRequestAndWaitResponse("GET"; $URL)

If (Value type($response)=Is object)
return Super._cleanGraphObject($response)
End if

return Null


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


Function getCalendarList($inParameters : Object) : Object

var $headers : Object
var $urlParams : Text:=""
var $delimiter : Text:="?"

If (Length(String($inID))>0)
$urlParams:="users/"+String($inID)+"/calendar"
Else
$urlParams:="me/calendar"
End if

If (Length(String($inParameters.search))>0)
$urlParams:=$urlParams+$delimiter+"$search="+$inParameters.search
$delimiter:="&"
$headers:={ConsistencyLevel: "eventual"}
End if
If (Length(String($inParameters.filter))>0)
$urlParams:=$urlParams+$delimiter+"$filter="+$inParameters.filter
$delimiter:="&"
End if
If (Length(String($inParameters.select))>0)
$urlParams:=$urlParams+$delimiter+"$select="+$inParameters.select
$delimiter:="&"
End if
If (Not(Value type($inParameters.top)=Is undefined))
$urlParams:=$urlParams+$delimiter+"$top="+Choose(Value type($inParameters.top)=Is text; $inParameters.top; String($inParameters.top))
$delimiter:="&"
End if
If (Length(String($inParameters.orderBy))>0)
$urlParams:=$urlParams+$delimiter+"$orderBy="+$inParameters.orderBy
$delimiter:="&"
End if

var $URL : Text:=This._getURL()+$urlParams

return cs.GraphCalendarList.new(This._getOAuth2Provider(); $URL; $headers)

0 comments on commit 7f48afe

Please sign in to comment.