-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Support to specifiy ODataQuery Parameters in Microsoft Graph Clie…
…nt (#827) #### Summary This PR adds support so specify OData Query Parameters via the Microsoft Graph Client #### Work Item(s) Fixes #802 Fixes [AB#522447](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/522447) Fixes [AB#527604](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/527604) --------- Co-authored-by: Jesper Schulz-Wedde <[email protected]>
- Loading branch information
1 parent
09a335c
commit 5e67602
Showing
8 changed files
with
336 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
src/System Application/App/MicrosoftGraph/src/GraphODataQueryParameter.Enum.al
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
// ------------------------------------------------------------------------------------------------ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
// ------------------------------------------------------------------------------------------------ | ||
namespace System.Integration.Graph; | ||
|
||
/// <summary> | ||
/// A Microsoft Graph API operation might support one or more of the following OData system query options. | ||
/// These query options are compatible with the OData V4 query language and are supported only in GET operations. | ||
/// See: hhttps://learn.microsoft.com/en-us/graph/query-parameters?tabs=http#odata-system-query-options | ||
/// </summary> | ||
enum 9352 "Graph OData Query Parameter" | ||
{ | ||
Access = Public; | ||
Extensible = false; | ||
|
||
/// <summary> | ||
/// Query Parameter '$count'. | ||
/// see: https://learn.microsoft.com/en-us/graph/query-parameters?tabs=http#count-parameter | ||
/// </summary> | ||
value(0; count) | ||
{ | ||
Caption = '$count', Locked = true; | ||
} | ||
|
||
/// <summary> | ||
/// OData Query Parameter '$expand'. | ||
/// see: https://learn.microsoft.com/en-us/graph/query-parameters?tabs=http#expand-parameter | ||
/// </summary> | ||
value(10; expand) | ||
{ | ||
Caption = '$expand', Locked = true; | ||
} | ||
|
||
|
||
/// <summary> | ||
/// OData Query Parameter '$filter'. | ||
/// see: https://learn.microsoft.com/en-us/graph/query-parameters?tabs=http#filter-parameter | ||
/// </summary> | ||
value(20; filter) | ||
{ | ||
Caption = '$filter', Locked = true; | ||
} | ||
|
||
/// <summary> | ||
/// OData Query Parameter '$format'. | ||
/// see: https://learn.microsoft.com/en-us/graph/query-parameters?tabs=http#format-parameter | ||
/// </summary> | ||
value(30; format) | ||
{ | ||
Caption = '$format', Locked = true; | ||
} | ||
/// <summary> | ||
/// OData Query Parameter '$orderBy'. | ||
/// see: https://learn.microsoft.com/en-us/graph/query-parameters?tabs=http#orderby-parameter | ||
/// </summary> | ||
value(40; orderby) | ||
{ | ||
Caption = '$orderby', Locked = true; | ||
} | ||
|
||
/// <summary> | ||
/// OData Query Parameter '$search'. | ||
/// see: https://learn.microsoft.com/en-us/graph/query-parameters?tabs=http#search-parameter | ||
/// </summary> | ||
value(50; search) | ||
{ | ||
Caption = '$search', Locked = true; | ||
} | ||
|
||
/// <summary> | ||
/// OData Query Parameter '$select'. | ||
/// see: https://learn.microsoft.com/en-us/graph/query-parameters?tabs=http#select-parameter | ||
/// </summary> | ||
value(60; select) | ||
{ | ||
Caption = '$select', Locked = true; | ||
} | ||
|
||
/// <summary> | ||
/// OData Query Parameter '$skip'. | ||
/// see: https://learn.microsoft.com/en-us/graph/query-parameters?tabs=http#skip-parameter | ||
/// </summary> | ||
value(70; skip) | ||
{ | ||
Caption = '$skip', Locked = true; | ||
} | ||
|
||
/// <summary> | ||
/// OData Query Parameter '$skipToken'. | ||
/// see: https://learn.microsoft.com/en-us/graph/query-parameters?tabs=http#skiptoken-parameter | ||
/// </summary> | ||
value(80; skiptoken) | ||
{ | ||
Caption = '$skiptoken', Locked = true; | ||
} | ||
|
||
/// <summary> | ||
/// OData Query Parameter '$top'. | ||
/// see: https://learn.microsoft.com/en-us/graph/query-parameters?tabs=http#top-parameter | ||
/// </summary> | ||
value(90; top) | ||
{ | ||
Caption = '$top', Locked = true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
src/System Application/App/MicrosoftGraph/src/GraphOptionalParametersImpl.Codeunit.al
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// ------------------------------------------------------------------------------------------------ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
// ------------------------------------------------------------------------------------------------ | ||
namespace System.Integration.Graph; | ||
|
||
|
||
codeunit 9358 "Graph Optional Parameters Impl" | ||
{ | ||
Access = Internal; | ||
InherentEntitlements = X; | ||
InherentPermissions = X; | ||
|
||
#region Headers | ||
procedure SetRequestHeader(GraphRequestHeader: Enum "Graph Request Header"; HeaderValue: Text) | ||
begin | ||
SetRequestHeader(Format(GraphRequestHeader), HeaderValue); | ||
end; | ||
|
||
local procedure SetRequestHeader(Header: Text; HeaderValue: Text) | ||
begin | ||
RequestHeaders.Remove(Header); | ||
RequestHeaders.Add(Header, HeaderValue); | ||
end; | ||
|
||
internal procedure GetRequestHeaders(): Dictionary of [Text, Text] | ||
begin | ||
exit(RequestHeaders); | ||
end; | ||
|
||
#endregion | ||
|
||
#region Parameters | ||
|
||
procedure SetMicrosftGraphConflictBehavior(GraphConflictBehavior: Enum "Graph ConflictBehavior") | ||
begin | ||
SetQueryParameter('@microsoft.graph.conflictBehavior', Format(GraphConflictBehavior)); | ||
end; | ||
|
||
|
||
local procedure SetQueryParameter(Header: Text; HeaderValue: Text) | ||
begin | ||
QueryParameters.Remove(Header); | ||
QueryParameters.Add(Header, HeaderValue); | ||
end; | ||
|
||
procedure GetQueryParameters(): Dictionary of [Text, Text] | ||
begin | ||
exit(QueryParameters); | ||
end; | ||
#endregion | ||
|
||
#region ODataQueryParameters | ||
|
||
procedure SetODataQueryParameter(GraphODataQueryParameter: Enum "Graph OData Query Parameter"; ODataQueryParameterValue: Text) | ||
begin | ||
SetODataQueryParameter(Format(GraphODataQueryParameter), ODataQueryParameterValue); | ||
end; | ||
|
||
local procedure SetODataQueryParameter(ODataQueryParameterKey: Text; ODataQueryParameterValue: Text) | ||
begin | ||
ODataQueryParameters.Remove(ODataQueryParameterKey); | ||
ODataQueryParameters.Add(ODataQueryParameterKey, ODataQueryParameterValue); | ||
end; | ||
|
||
procedure GetODataQueryParameters(): Dictionary of [Text, Text] | ||
begin | ||
exit(ODataQueryParameters); | ||
end; | ||
|
||
#endregion | ||
|
||
var | ||
QueryParameters: Dictionary of [Text, Text]; | ||
ODataQueryParameters: Dictionary of [Text, Text]; | ||
RequestHeaders: Dictionary of [Text, Text]; | ||
} |
46 changes: 46 additions & 0 deletions
46
src/System Application/App/MicrosoftGraph/src/GraphRequestHeader.Enum.al
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// ------------------------------------------------------------------------------------------------ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
// ------------------------------------------------------------------------------------------------ | ||
namespace System.Integration.Graph; | ||
|
||
/// <summary> | ||
/// The supported request header for the Microsoft Graph API | ||
/// </summary> | ||
enum 9353 "Graph Request Header" | ||
{ | ||
Access = Public; | ||
Extensible = false; | ||
|
||
/// <summary> | ||
/// If-Match Request Header | ||
/// </summary> | ||
value(0; "If-Match") | ||
{ | ||
Caption = 'If-Match', Locked = true; | ||
} | ||
|
||
/// <summary> | ||
/// If-None-Match Request Header | ||
/// </summary> | ||
value(10; "If-None-Match") | ||
{ | ||
Caption = 'If-None-Match', Locked = true; | ||
} | ||
|
||
/// <summary> | ||
/// Prefer Request Header | ||
/// </summary> | ||
value(20; Prefer) | ||
{ | ||
Caption = 'Prefer', Locked = true; | ||
} | ||
|
||
/// <summary> | ||
/// ConsistencyLevel Request Header | ||
/// </summary> | ||
value(30; ConsistencyLevel) | ||
{ | ||
Caption = 'ConsistencyLevel', Locked = true; | ||
} | ||
} |
Oops, something went wrong.