|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace Microsoft\Graph\Generated\DeviceManagement\VirtualEndpoint\ServicePlans\Item; |
| 4 | + |
| 5 | +use Exception; |
| 6 | +use Http\Promise\Promise; |
| 7 | +use Microsoft\Graph\Generated\Models\CloudPcServicePlan; |
| 8 | +use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; |
| 9 | +use Microsoft\Kiota\Abstractions\BaseRequestBuilder; |
| 10 | +use Microsoft\Kiota\Abstractions\HttpMethod; |
| 11 | +use Microsoft\Kiota\Abstractions\RequestAdapter; |
| 12 | +use Microsoft\Kiota\Abstractions\RequestInformation; |
| 13 | + |
| 14 | +/** |
| 15 | + * Provides operations to manage the servicePlans property of the microsoft.graph.virtualEndpoint entity. |
| 16 | +*/ |
| 17 | +class CloudPcServicePlanItemRequestBuilder extends BaseRequestBuilder |
| 18 | +{ |
| 19 | + /** |
| 20 | + * Instantiates a new CloudPcServicePlanItemRequestBuilder and sets the default values. |
| 21 | + * @param array<string, mixed>|string $pathParametersOrRawUrl Path parameters for the request or a String representing the raw URL. |
| 22 | + * @param RequestAdapter $requestAdapter The request adapter to use to execute the requests. |
| 23 | + */ |
| 24 | + public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdapter) { |
| 25 | + parent::__construct($requestAdapter, [], '{+baseurl}/deviceManagement/virtualEndpoint/servicePlans/{cloudPcServicePlan%2Did}{?%24expand,%24select}'); |
| 26 | + if (is_array($pathParametersOrRawUrl)) { |
| 27 | + $this->pathParameters = $pathParametersOrRawUrl; |
| 28 | + } else { |
| 29 | + $this->pathParameters = ['request-raw-url' => $pathParametersOrRawUrl]; |
| 30 | + } |
| 31 | + } |
| 32 | + |
| 33 | + /** |
| 34 | + * A collection of Cloud PC service plans. |
| 35 | + * @param CloudPcServicePlanItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. |
| 36 | + * @return Promise<CloudPcServicePlan|null> |
| 37 | + * @throws Exception |
| 38 | + */ |
| 39 | + public function get(?CloudPcServicePlanItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { |
| 40 | + $requestInfo = $this->toGetRequestInformation($requestConfiguration); |
| 41 | + $errorMappings = [ |
| 42 | + 'XXX' => [ODataError::class, 'createFromDiscriminatorValue'], |
| 43 | + ]; |
| 44 | + return $this->requestAdapter->sendAsync($requestInfo, [CloudPcServicePlan::class, 'createFromDiscriminatorValue'], $errorMappings); |
| 45 | + } |
| 46 | + |
| 47 | + /** |
| 48 | + * A collection of Cloud PC service plans. |
| 49 | + * @param CloudPcServicePlanItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. |
| 50 | + * @return RequestInformation |
| 51 | + */ |
| 52 | + public function toGetRequestInformation(?CloudPcServicePlanItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): RequestInformation { |
| 53 | + $requestInfo = new RequestInformation(); |
| 54 | + $requestInfo->urlTemplate = $this->urlTemplate; |
| 55 | + $requestInfo->pathParameters = $this->pathParameters; |
| 56 | + $requestInfo->httpMethod = HttpMethod::GET; |
| 57 | + if ($requestConfiguration !== null) { |
| 58 | + $requestInfo->addHeaders($requestConfiguration->headers); |
| 59 | + if ($requestConfiguration->queryParameters !== null) { |
| 60 | + $requestInfo->setQueryParameters($requestConfiguration->queryParameters); |
| 61 | + } |
| 62 | + $requestInfo->addRequestOptions(...$requestConfiguration->options); |
| 63 | + } |
| 64 | + $requestInfo->tryAddHeader('Accept', "application/json"); |
| 65 | + return $requestInfo; |
| 66 | + } |
| 67 | + |
| 68 | + /** |
| 69 | + * Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. |
| 70 | + * @param string $rawUrl The raw URL to use for the request builder. |
| 71 | + * @return CloudPcServicePlanItemRequestBuilder |
| 72 | + */ |
| 73 | + public function withUrl(string $rawUrl): CloudPcServicePlanItemRequestBuilder { |
| 74 | + return new CloudPcServicePlanItemRequestBuilder($rawUrl, $this->requestAdapter); |
| 75 | + } |
| 76 | + |
| 77 | +} |
0 commit comments