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

Generated models and request builders #1386

Closed
Closed
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
],
"require": {
"php": "^8.0 || ^7.4",
"microsoft/microsoft-graph-core": "2.0.0-RC11"
"microsoft/microsoft-graph-core": "2.0.0-RC12"
},
"require-dev": {
"phpunit/phpunit": "^8.0 || ^9.0",
Expand Down
39 changes: 16 additions & 23 deletions src/Generated/Admin/AdminRequestBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Exception;
use Http\Promise\Promise;
use Http\Promise\RejectedPromise;
use Microsoft\Graph\Generated\Admin\Edge\EdgeRequestBuilder;
use Microsoft\Graph\Generated\Admin\People\PeopleRequestBuilder;
use Microsoft\Graph\Generated\Admin\ServiceAnnouncement\ServiceAnnouncementRequestBuilder;
Expand Down Expand Up @@ -66,38 +65,32 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap
/**
* Get admin
* @param AdminRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @return Promise
* @return Promise<Admin|null>
* @throws Exception
*/
public function get(?AdminRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise {
$requestInfo = $this->toGetRequestInformation($requestConfiguration);
try {
$errorMappings = [
'4XX' => [ODataError::class, 'createFromDiscriminatorValue'],
'5XX' => [ODataError::class, 'createFromDiscriminatorValue'],
];
return $this->requestAdapter->sendAsync($requestInfo, [Admin::class, 'createFromDiscriminatorValue'], $errorMappings);
} catch(Exception $ex) {
return new RejectedPromise($ex);
}
$errorMappings = [
'4XX' => [ODataError::class, 'createFromDiscriminatorValue'],
'5XX' => [ODataError::class, 'createFromDiscriminatorValue'],
];
return $this->requestAdapter->sendAsync($requestInfo, [Admin::class, 'createFromDiscriminatorValue'], $errorMappings);
}

/**
* Update admin
* @param Admin $body The request body
* @param AdminRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @return Promise
* @return Promise<Admin|null>
* @throws Exception
*/
public function patch(Admin $body, ?AdminRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise {
$requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration);
try {
$errorMappings = [
'4XX' => [ODataError::class, 'createFromDiscriminatorValue'],
'5XX' => [ODataError::class, 'createFromDiscriminatorValue'],
];
return $this->requestAdapter->sendAsync($requestInfo, [Admin::class, 'createFromDiscriminatorValue'], $errorMappings);
} catch(Exception $ex) {
return new RejectedPromise($ex);
}
$errorMappings = [
'4XX' => [ODataError::class, 'createFromDiscriminatorValue'],
'5XX' => [ODataError::class, 'createFromDiscriminatorValue'],
];
return $this->requestAdapter->sendAsync($requestInfo, [Admin::class, 'createFromDiscriminatorValue'], $errorMappings);
}

/**
Expand All @@ -110,14 +103,14 @@ public function toGetRequestInformation(?AdminRequestBuilderGetRequestConfigurat
$requestInfo->urlTemplate = $this->urlTemplate;
$requestInfo->pathParameters = $this->pathParameters;
$requestInfo->httpMethod = HttpMethod::GET;
$requestInfo->addHeader('Accept', "application/json");
if ($requestConfiguration !== null) {
$requestInfo->addHeaders($requestConfiguration->headers);
if ($requestConfiguration->queryParameters !== null) {
$requestInfo->setQueryParameters($requestConfiguration->queryParameters);
}
$requestInfo->addRequestOptions(...$requestConfiguration->options);
}
$requestInfo->tryAddHeader('Accept', "application/json;q=1");
return $requestInfo;
}

Expand All @@ -132,11 +125,11 @@ public function toPatchRequestInformation(Admin $body, ?AdminRequestBuilderPatch
$requestInfo->urlTemplate = $this->urlTemplate;
$requestInfo->pathParameters = $this->pathParameters;
$requestInfo->httpMethod = HttpMethod::PATCH;
$requestInfo->addHeader('Accept', "application/json");
if ($requestConfiguration !== null) {
$requestInfo->addHeaders($requestConfiguration->headers);
$requestInfo->addRequestOptions(...$requestConfiguration->options);
}
$requestInfo->tryAddHeader('Accept', "application/json;q=1");
$requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body);
return $requestInfo;
}
Expand Down
57 changes: 24 additions & 33 deletions src/Generated/Admin/Edge/EdgeRequestBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Exception;
use Http\Promise\Promise;
use Http\Promise\RejectedPromise;
use Microsoft\Graph\Generated\Admin\Edge\InternetExplorerMode\InternetExplorerModeRequestBuilder;
use Microsoft\Graph\Generated\Models\Edge;
use Microsoft\Graph\Generated\Models\ODataErrors\ODataError;
Expand Down Expand Up @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap
/**
* Delete navigation property edge for admin
* @param EdgeRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @return Promise
* @return Promise<void|null>
* @throws Exception
*/
public function delete(?EdgeRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise {
$requestInfo = $this->toDeleteRequestInformation($requestConfiguration);
try {
$errorMappings = [
'4XX' => [ODataError::class, 'createFromDiscriminatorValue'],
'5XX' => [ODataError::class, 'createFromDiscriminatorValue'],
];
return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings);
} catch(Exception $ex) {
return new RejectedPromise($ex);
}
$errorMappings = [
'4XX' => [ODataError::class, 'createFromDiscriminatorValue'],
'5XX' => [ODataError::class, 'createFromDiscriminatorValue'],
];
return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings);
}

/**
* A container for Microsoft Edge resources. Read-only.
* @param EdgeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @return Promise
* @return Promise<Edge|null>
* @throws Exception
*/
public function get(?EdgeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise {
$requestInfo = $this->toGetRequestInformation($requestConfiguration);
try {
$errorMappings = [
'4XX' => [ODataError::class, 'createFromDiscriminatorValue'],
'5XX' => [ODataError::class, 'createFromDiscriminatorValue'],
];
return $this->requestAdapter->sendAsync($requestInfo, [Edge::class, 'createFromDiscriminatorValue'], $errorMappings);
} catch(Exception $ex) {
return new RejectedPromise($ex);
}
$errorMappings = [
'4XX' => [ODataError::class, 'createFromDiscriminatorValue'],
'5XX' => [ODataError::class, 'createFromDiscriminatorValue'],
];
return $this->requestAdapter->sendAsync($requestInfo, [Edge::class, 'createFromDiscriminatorValue'], $errorMappings);
}

/**
* Update the navigation property edge in admin
* @param Edge $body The request body
* @param EdgeRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @return Promise
* @return Promise<Edge|null>
* @throws Exception
*/
public function patch(Edge $body, ?EdgeRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise {
$requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration);
try {
$errorMappings = [
'4XX' => [ODataError::class, 'createFromDiscriminatorValue'],
'5XX' => [ODataError::class, 'createFromDiscriminatorValue'],
];
return $this->requestAdapter->sendAsync($requestInfo, [Edge::class, 'createFromDiscriminatorValue'], $errorMappings);
} catch(Exception $ex) {
return new RejectedPromise($ex);
}
$errorMappings = [
'4XX' => [ODataError::class, 'createFromDiscriminatorValue'],
'5XX' => [ODataError::class, 'createFromDiscriminatorValue'],
];
return $this->requestAdapter->sendAsync($requestInfo, [Edge::class, 'createFromDiscriminatorValue'], $errorMappings);
}

/**
Expand All @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?EdgeRequestBuilderDeleteRequestConfi
$requestInfo->addHeaders($requestConfiguration->headers);
$requestInfo->addRequestOptions(...$requestConfiguration->options);
}
$requestInfo->tryAddHeader('Accept', "application/json, application/json");
return $requestInfo;
}

Expand All @@ -121,14 +112,14 @@ public function toGetRequestInformation(?EdgeRequestBuilderGetRequestConfigurati
$requestInfo->urlTemplate = $this->urlTemplate;
$requestInfo->pathParameters = $this->pathParameters;
$requestInfo->httpMethod = HttpMethod::GET;
$requestInfo->addHeader('Accept', "application/json");
if ($requestConfiguration !== null) {
$requestInfo->addHeaders($requestConfiguration->headers);
if ($requestConfiguration->queryParameters !== null) {
$requestInfo->setQueryParameters($requestConfiguration->queryParameters);
}
$requestInfo->addRequestOptions(...$requestConfiguration->options);
}
$requestInfo->tryAddHeader('Accept', "application/json;q=1");
return $requestInfo;
}

Expand All @@ -143,11 +134,11 @@ public function toPatchRequestInformation(Edge $body, ?EdgeRequestBuilderPatchRe
$requestInfo->urlTemplate = $this->urlTemplate;
$requestInfo->pathParameters = $this->pathParameters;
$requestInfo->httpMethod = HttpMethod::PATCH;
$requestInfo->addHeader('Accept', "application/json");
if ($requestConfiguration !== null) {
$requestInfo->addHeaders($requestConfiguration->headers);
$requestInfo->addRequestOptions(...$requestConfiguration->options);
}
$requestInfo->tryAddHeader('Accept', "application/json;q=1");
$requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body);
return $requestInfo;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Exception;
use Http\Promise\Promise;
use Http\Promise\RejectedPromise;
use Microsoft\Graph\Generated\Admin\Edge\InternetExplorerMode\SiteLists\SiteListsRequestBuilder;
use Microsoft\Graph\Generated\Models\InternetExplorerMode;
use Microsoft\Graph\Generated\Models\ODataErrors\ODataError;
Expand Down Expand Up @@ -42,56 +41,47 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap
/**
* Delete navigation property internetExplorerMode for admin
* @param InternetExplorerModeRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @return Promise
* @return Promise<void|null>
* @throws Exception
*/
public function delete(?InternetExplorerModeRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise {
$requestInfo = $this->toDeleteRequestInformation($requestConfiguration);
try {
$errorMappings = [
'4XX' => [ODataError::class, 'createFromDiscriminatorValue'],
'5XX' => [ODataError::class, 'createFromDiscriminatorValue'],
];
return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings);
} catch(Exception $ex) {
return new RejectedPromise($ex);
}
$errorMappings = [
'4XX' => [ODataError::class, 'createFromDiscriminatorValue'],
'5XX' => [ODataError::class, 'createFromDiscriminatorValue'],
];
return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings);
}

/**
* A container for Internet Explorer mode resources.
* @param InternetExplorerModeRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @return Promise
* @return Promise<InternetExplorerMode|null>
* @throws Exception
*/
public function get(?InternetExplorerModeRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise {
$requestInfo = $this->toGetRequestInformation($requestConfiguration);
try {
$errorMappings = [
'4XX' => [ODataError::class, 'createFromDiscriminatorValue'],
'5XX' => [ODataError::class, 'createFromDiscriminatorValue'],
];
return $this->requestAdapter->sendAsync($requestInfo, [InternetExplorerMode::class, 'createFromDiscriminatorValue'], $errorMappings);
} catch(Exception $ex) {
return new RejectedPromise($ex);
}
$errorMappings = [
'4XX' => [ODataError::class, 'createFromDiscriminatorValue'],
'5XX' => [ODataError::class, 'createFromDiscriminatorValue'],
];
return $this->requestAdapter->sendAsync($requestInfo, [InternetExplorerMode::class, 'createFromDiscriminatorValue'], $errorMappings);
}

/**
* Update the navigation property internetExplorerMode in admin
* @param InternetExplorerMode $body The request body
* @param InternetExplorerModeRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @return Promise
* @return Promise<InternetExplorerMode|null>
* @throws Exception
*/
public function patch(InternetExplorerMode $body, ?InternetExplorerModeRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise {
$requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration);
try {
$errorMappings = [
'4XX' => [ODataError::class, 'createFromDiscriminatorValue'],
'5XX' => [ODataError::class, 'createFromDiscriminatorValue'],
];
return $this->requestAdapter->sendAsync($requestInfo, [InternetExplorerMode::class, 'createFromDiscriminatorValue'], $errorMappings);
} catch(Exception $ex) {
return new RejectedPromise($ex);
}
$errorMappings = [
'4XX' => [ODataError::class, 'createFromDiscriminatorValue'],
'5XX' => [ODataError::class, 'createFromDiscriminatorValue'],
];
return $this->requestAdapter->sendAsync($requestInfo, [InternetExplorerMode::class, 'createFromDiscriminatorValue'], $errorMappings);
}

/**
Expand All @@ -108,6 +98,7 @@ public function toDeleteRequestInformation(?InternetExplorerModeRequestBuilderDe
$requestInfo->addHeaders($requestConfiguration->headers);
$requestInfo->addRequestOptions(...$requestConfiguration->options);
}
$requestInfo->tryAddHeader('Accept', "application/json, application/json");
return $requestInfo;
}

Expand All @@ -121,14 +112,14 @@ public function toGetRequestInformation(?InternetExplorerModeRequestBuilderGetRe
$requestInfo->urlTemplate = $this->urlTemplate;
$requestInfo->pathParameters = $this->pathParameters;
$requestInfo->httpMethod = HttpMethod::GET;
$requestInfo->addHeader('Accept', "application/json");
if ($requestConfiguration !== null) {
$requestInfo->addHeaders($requestConfiguration->headers);
if ($requestConfiguration->queryParameters !== null) {
$requestInfo->setQueryParameters($requestConfiguration->queryParameters);
}
$requestInfo->addRequestOptions(...$requestConfiguration->options);
}
$requestInfo->tryAddHeader('Accept', "application/json;q=1");
return $requestInfo;
}

Expand All @@ -143,11 +134,11 @@ public function toPatchRequestInformation(InternetExplorerMode $body, ?InternetE
$requestInfo->urlTemplate = $this->urlTemplate;
$requestInfo->pathParameters = $this->pathParameters;
$requestInfo->httpMethod = HttpMethod::PATCH;
$requestInfo->addHeader('Accept', "application/json");
if ($requestConfiguration !== null) {
$requestInfo->addHeaders($requestConfiguration->headers);
$requestInfo->addRequestOptions(...$requestConfiguration->options);
}
$requestInfo->tryAddHeader('Accept', "application/json;q=1");
$requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body);
return $requestInfo;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Exception;
use Http\Promise\Promise;
use Http\Promise\RejectedPromise;
use Microsoft\Graph\Generated\Models\ODataErrors\ODataError;
use Microsoft\Kiota\Abstractions\BaseRequestBuilder;
use Microsoft\Kiota\Abstractions\HttpMethod;
Expand Down Expand Up @@ -33,19 +32,18 @@ public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdap
/**
* Get the number of the resource
* @param CountRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @return Promise
* @return Promise<int|null>
* @throws Exception
*/
public function get(?CountRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise {
$requestInfo = $this->toGetRequestInformation($requestConfiguration);
try {
$errorMappings = [
'4XX' => [ODataError::class, 'createFromDiscriminatorValue'],
'5XX' => [ODataError::class, 'createFromDiscriminatorValue'],
];
return $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings);
} catch(Exception $ex) {
return new RejectedPromise($ex);
}
$errorMappings = [
'4XX' => [ODataError::class, 'createFromDiscriminatorValue'],
'5XX' => [ODataError::class, 'createFromDiscriminatorValue'],
];
/** @var Promise<int|null> $result */
$result = $this->requestAdapter->sendPrimitiveAsync($requestInfo, 'int', $errorMappings);
return $result;
}

/**
Expand All @@ -58,14 +56,14 @@ public function toGetRequestInformation(?CountRequestBuilderGetRequestConfigurat
$requestInfo->urlTemplate = $this->urlTemplate;
$requestInfo->pathParameters = $this->pathParameters;
$requestInfo->httpMethod = HttpMethod::GET;
$requestInfo->addHeader('Accept', "text/plain");
if ($requestConfiguration !== null) {
$requestInfo->addHeaders($requestConfiguration->headers);
if ($requestConfiguration->queryParameters !== null) {
$requestInfo->setQueryParameters($requestConfiguration->queryParameters);
}
$requestInfo->addRequestOptions(...$requestConfiguration->options);
}
$requestInfo->tryAddHeader('Accept', "text/plain;q=0.9");
return $requestInfo;
}

Expand Down
Loading
Loading