|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace Microsoft\Graph\Generated\Directory\RemoteTenantGroups\Item; |
| 4 | + |
| 5 | +use Exception; |
| 6 | +use Http\Promise\Promise; |
| 7 | +use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; |
| 8 | +use Microsoft\Graph\Generated\Models\RemoteTenantGroup; |
| 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 remoteTenantGroups property of the microsoft.graph.directory entity. |
| 16 | +*/ |
| 17 | +class RemoteTenantGroupItemRequestBuilder extends BaseRequestBuilder |
| 18 | +{ |
| 19 | + /** |
| 20 | + * Instantiates a new RemoteTenantGroupItemRequestBuilder 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}/directory/remoteTenantGroups/{remoteTenantGroup%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 | + * Delete navigation property remoteTenantGroups for directory |
| 35 | + * @param RemoteTenantGroupItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. |
| 36 | + * @return Promise<void|null> |
| 37 | + * @throws Exception |
| 38 | + */ |
| 39 | + public function delete(?RemoteTenantGroupItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): Promise { |
| 40 | + $requestInfo = $this->toDeleteRequestInformation($requestConfiguration); |
| 41 | + $errorMappings = [ |
| 42 | + 'XXX' => [ODataError::class, 'createFromDiscriminatorValue'], |
| 43 | + ]; |
| 44 | + return $this->requestAdapter->sendNoContentAsync($requestInfo, $errorMappings); |
| 45 | + } |
| 46 | + |
| 47 | + /** |
| 48 | + * Read the properties and relationships of a remoteTenantGroup object. |
| 49 | + * @param RemoteTenantGroupItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. |
| 50 | + * @return Promise<RemoteTenantGroup|null> |
| 51 | + * @throws Exception |
| 52 | + * @link https://learn.microsoft.com/graph/api/remotetenantgroup-get?view=graph-rest-1.0 Find more info here |
| 53 | + */ |
| 54 | + public function get(?RemoteTenantGroupItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { |
| 55 | + $requestInfo = $this->toGetRequestInformation($requestConfiguration); |
| 56 | + $errorMappings = [ |
| 57 | + 'XXX' => [ODataError::class, 'createFromDiscriminatorValue'], |
| 58 | + ]; |
| 59 | + return $this->requestAdapter->sendAsync($requestInfo, [RemoteTenantGroup::class, 'createFromDiscriminatorValue'], $errorMappings); |
| 60 | + } |
| 61 | + |
| 62 | + /** |
| 63 | + * Update the navigation property remoteTenantGroups in directory |
| 64 | + * @param RemoteTenantGroup $body The request body |
| 65 | + * @param RemoteTenantGroupItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. |
| 66 | + * @return Promise<RemoteTenantGroup|null> |
| 67 | + * @throws Exception |
| 68 | + */ |
| 69 | + public function patch(RemoteTenantGroup $body, ?RemoteTenantGroupItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): Promise { |
| 70 | + $requestInfo = $this->toPatchRequestInformation($body, $requestConfiguration); |
| 71 | + $errorMappings = [ |
| 72 | + 'XXX' => [ODataError::class, 'createFromDiscriminatorValue'], |
| 73 | + ]; |
| 74 | + return $this->requestAdapter->sendAsync($requestInfo, [RemoteTenantGroup::class, 'createFromDiscriminatorValue'], $errorMappings); |
| 75 | + } |
| 76 | + |
| 77 | + /** |
| 78 | + * Delete navigation property remoteTenantGroups for directory |
| 79 | + * @param RemoteTenantGroupItemRequestBuilderDeleteRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. |
| 80 | + * @return RequestInformation |
| 81 | + */ |
| 82 | + public function toDeleteRequestInformation(?RemoteTenantGroupItemRequestBuilderDeleteRequestConfiguration $requestConfiguration = null): RequestInformation { |
| 83 | + $requestInfo = new RequestInformation(); |
| 84 | + $requestInfo->urlTemplate = $this->urlTemplate; |
| 85 | + $requestInfo->pathParameters = $this->pathParameters; |
| 86 | + $requestInfo->httpMethod = HttpMethod::DELETE; |
| 87 | + if ($requestConfiguration !== null) { |
| 88 | + $requestInfo->addHeaders($requestConfiguration->headers); |
| 89 | + $requestInfo->addRequestOptions(...$requestConfiguration->options); |
| 90 | + } |
| 91 | + $requestInfo->tryAddHeader('Accept', "application/json"); |
| 92 | + return $requestInfo; |
| 93 | + } |
| 94 | + |
| 95 | + /** |
| 96 | + * Read the properties and relationships of a remoteTenantGroup object. |
| 97 | + * @param RemoteTenantGroupItemRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. |
| 98 | + * @return RequestInformation |
| 99 | + */ |
| 100 | + public function toGetRequestInformation(?RemoteTenantGroupItemRequestBuilderGetRequestConfiguration $requestConfiguration = null): RequestInformation { |
| 101 | + $requestInfo = new RequestInformation(); |
| 102 | + $requestInfo->urlTemplate = $this->urlTemplate; |
| 103 | + $requestInfo->pathParameters = $this->pathParameters; |
| 104 | + $requestInfo->httpMethod = HttpMethod::GET; |
| 105 | + if ($requestConfiguration !== null) { |
| 106 | + $requestInfo->addHeaders($requestConfiguration->headers); |
| 107 | + if ($requestConfiguration->queryParameters !== null) { |
| 108 | + $requestInfo->setQueryParameters($requestConfiguration->queryParameters); |
| 109 | + } |
| 110 | + $requestInfo->addRequestOptions(...$requestConfiguration->options); |
| 111 | + } |
| 112 | + $requestInfo->tryAddHeader('Accept', "application/json"); |
| 113 | + return $requestInfo; |
| 114 | + } |
| 115 | + |
| 116 | + /** |
| 117 | + * Update the navigation property remoteTenantGroups in directory |
| 118 | + * @param RemoteTenantGroup $body The request body |
| 119 | + * @param RemoteTenantGroupItemRequestBuilderPatchRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. |
| 120 | + * @return RequestInformation |
| 121 | + */ |
| 122 | + public function toPatchRequestInformation(RemoteTenantGroup $body, ?RemoteTenantGroupItemRequestBuilderPatchRequestConfiguration $requestConfiguration = null): RequestInformation { |
| 123 | + $requestInfo = new RequestInformation(); |
| 124 | + $requestInfo->urlTemplate = $this->urlTemplate; |
| 125 | + $requestInfo->pathParameters = $this->pathParameters; |
| 126 | + $requestInfo->httpMethod = HttpMethod::PATCH; |
| 127 | + if ($requestConfiguration !== null) { |
| 128 | + $requestInfo->addHeaders($requestConfiguration->headers); |
| 129 | + $requestInfo->addRequestOptions(...$requestConfiguration->options); |
| 130 | + } |
| 131 | + $requestInfo->tryAddHeader('Accept', "application/json"); |
| 132 | + $requestInfo->setContentFromParsable($this->requestAdapter, "application/json", $body); |
| 133 | + return $requestInfo; |
| 134 | + } |
| 135 | + |
| 136 | + /** |
| 137 | + * Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. |
| 138 | + * @param string $rawUrl The raw URL to use for the request builder. |
| 139 | + * @return RemoteTenantGroupItemRequestBuilder |
| 140 | + */ |
| 141 | + public function withUrl(string $rawUrl): RemoteTenantGroupItemRequestBuilder { |
| 142 | + return new RemoteTenantGroupItemRequestBuilder($rawUrl, $this->requestAdapter); |
| 143 | + } |
| 144 | + |
| 145 | +} |
0 commit comments