Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BC Idea] Add Put method to 'Graph Client' Codeunit #773

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,21 @@ codeunit 9350 "Graph Client"
exit(GraphClientImpl.Patch(RelativeUriToResource, GraphOptionalParameters, RequestHttpContent, HttpResponseMessage));
end;

/// <summary>
/// Put any request to the microsoft graph API
/// </summary>
/// <remarks>Does not require UI interaction.</remarks>
/// <param name="RelativeUriToResource">A relativ uri including the resource segment</param>
/// <param name="GraphOptionalParameters">A wrapper for optional header and query parameters</param>
/// <param name="RequestHttpContent">The HttpContent object for the request.</param>
/// <param name="HttpResponseMessage">The response message object.</param>
/// <returns>True if the operation was successful; otherwise - false.</returns>
/// <error>Authentication failed.</error>
procedure Put(RelativeUriToResource: Text; GraphOptionalParameters: Codeunit "Graph Optional Parameters"; RequestHttpContent: Codeunit "Http Content"; var HttpResponseMessage: Codeunit "Http Response Message"): Boolean
begin
exit(GraphClientImpl.Put(RelativeUriToResource, GraphOptionalParameters, RequestHttpContent, HttpResponseMessage));
end;

/// <summary>
/// Send a DELETE request to the microsoft graph API
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,16 @@ codeunit 9351 "Graph Client Impl."
exit(HttpResponseMessage.GetIsSuccessStatusCode());
end;

procedure Put(RelativeUriToResource: Text; GraphOptionalParameters: Codeunit "Graph Optional Parameters"; RequestHttpContent: Codeunit "Http Content"; var HttpResponseMessage: Codeunit "Http Response Message"): Boolean
var
GraphUriBuilder: Codeunit "Graph Uri Builder";
begin
GraphUriBuilder.Initialize(MicrosoftGraphBaseUrl, GraphAPIVersion, RelativeUriToResource, GraphOptionalParameters.GetQueryParameters());
GraphRequestHelper.SetRestClient(RestClient);
HttpResponseMessage := GraphRequestHelper.Put(GraphUriBuilder, GraphOptionalParameters, RequestHttpContent);
exit(HttpResponseMessage.GetIsSuccessStatusCode());
end;

procedure Delete(RelativeUriToResource: Text; GraphOptionalParameters: Codeunit "Graph Optional Parameters"; var HttpResponseMessage: Codeunit "Http Response Message"): Boolean
var
GraphUriBuilder: Codeunit "Graph Uri Builder";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ codeunit 9354 "Graph Request Helper"
HttpResponseMessage := SendRequest(Enum::"Http Method"::PATCH, GraphUriBuilder, GraphOptionalParameters, HttpContent);
end;

procedure Put(GraphUriBuilder: Codeunit "Graph Uri Builder"; GraphOptionalParameters: Codeunit "Graph Optional Parameters"; HttpContent: Codeunit "Http Content") HttpResponseMessage: Codeunit "Http Response Message"
begin
HttpResponseMessage := SendRequest(Enum::"Http Method"::PUT, GraphUriBuilder, GraphOptionalParameters, HttpContent);
end;

procedure Delete(GraphUriBuilder: Codeunit "Graph Uri Builder"; GraphOptionalParameters: Codeunit "Graph Optional Parameters") HttpResponseMessage: Codeunit "Http Response Message"
begin
PrepareRestClient(GraphOptionalParameters);
Expand Down
Loading