From 7f48afe67287929fc41a916b51255e8ce7ba1feb Mon Sep 17 00:00:00 2001 From: Yannick Trinh Date: Tue, 12 Nov 2024 17:54:29 +0100 Subject: [PATCH] Feature GitHub:11200 (initial commit) --- Project/Sources/Classes/GraphCalendarList.4dm | 14 ++++ Project/Sources/Classes/Office365.4dm | 11 +++ Project/Sources/Classes/Office365Calendar.4dm | 79 +++++++++++++++++++ 3 files changed, 104 insertions(+) create mode 100644 Project/Sources/Classes/GraphCalendarList.4dm create mode 100644 Project/Sources/Classes/Office365Calendar.4dm diff --git a/Project/Sources/Classes/GraphCalendarList.4dm b/Project/Sources/Classes/GraphCalendarList.4dm new file mode 100644 index 0000000..04dfeed --- /dev/null +++ b/Project/Sources/Classes/GraphCalendarList.4dm @@ -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 diff --git a/Project/Sources/Classes/Office365.4dm b/Project/Sources/Classes/Office365.4dm index 8123af3..f52fee1 100644 --- a/Project/Sources/Classes/Office365.4dm +++ b/Project/Sources/Classes/Office365.4dm @@ -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 diff --git a/Project/Sources/Classes/Office365Calendar.4dm b/Project/Sources/Classes/Office365Calendar.4dm new file mode 100644 index 0000000..a4d1679 --- /dev/null +++ b/Project/Sources/Classes/Office365Calendar.4dm @@ -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)