|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace Microsoft\Graph\Generated\Admin\Teams\Policy\MicrosoftGraphTeamsAdministrationGetPolicyIdWithTypeWithName; |
| 4 | + |
| 5 | +use Exception; |
| 6 | +use Http\Promise\Promise; |
| 7 | +use Microsoft\Graph\Generated\Models\ODataErrors\ODataError; |
| 8 | +use Microsoft\Kiota\Abstractions\BaseRequestBuilder; |
| 9 | +use Microsoft\Kiota\Abstractions\HttpMethod; |
| 10 | +use Microsoft\Kiota\Abstractions\RequestAdapter; |
| 11 | +use Microsoft\Kiota\Abstractions\RequestInformation; |
| 12 | + |
| 13 | +/** |
| 14 | + * Provides operations to call the getPolicyId method. |
| 15 | +*/ |
| 16 | +class MicrosoftGraphTeamsAdministrationGetPolicyIdWithTypeWithNameRequestBuilder extends BaseRequestBuilder |
| 17 | +{ |
| 18 | + /** |
| 19 | + * Instantiates a new MicrosoftGraphTeamsAdministrationGetPolicyIdWithTypeWithNameRequestBuilder and sets the default values. |
| 20 | + * @param array<string, mixed>|string $pathParametersOrRawUrl Path parameters for the request or a String representing the raw URL. |
| 21 | + * @param RequestAdapter $requestAdapter The request adapter to use to execute the requests. |
| 22 | + * @param string|null $name Usage: name='{name}' |
| 23 | + * @param string|null $type Usage: type='{type}' |
| 24 | + */ |
| 25 | + public function __construct($pathParametersOrRawUrl, RequestAdapter $requestAdapter, ?string $name = null, ?string $type = null) { |
| 26 | + parent::__construct($requestAdapter, [], '{+baseurl}/admin/teams/policy/microsoft.graph.teamsAdministration.getPolicyId(type=\'{type}\',name=\'{name}\'){?%24count,%24expand,%24filter,%24orderby,%24search,%24select,%24skip,%24top}'); |
| 27 | + if (is_array($pathParametersOrRawUrl)) { |
| 28 | + $urlTplParams = $pathParametersOrRawUrl; |
| 29 | + $urlTplParams['name'] = $name; |
| 30 | + $urlTplParams['type'] = $type; |
| 31 | + $this->pathParameters = $urlTplParams; |
| 32 | + } else { |
| 33 | + $this->pathParameters = ['request-raw-url' => $pathParametersOrRawUrl]; |
| 34 | + } |
| 35 | + } |
| 36 | + |
| 37 | + /** |
| 38 | + * Get the policy ID for a given policy name and policy type within Teams administration. |
| 39 | + * @param MicrosoftGraphTeamsAdministrationGetPolicyIdWithTypeWithNameRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. |
| 40 | + * @return Promise<GetPolicyIdWithTypeWithNameGetResponse|null> |
| 41 | + * @throws Exception |
| 42 | + * @link https://learn.microsoft.com/graph/api/teamsadministration-teamspolicyassignment-getpolicyid?view=graph-rest-1.0 Find more info here |
| 43 | + */ |
| 44 | + public function get(?MicrosoftGraphTeamsAdministrationGetPolicyIdWithTypeWithNameRequestBuilderGetRequestConfiguration $requestConfiguration = null): Promise { |
| 45 | + $requestInfo = $this->toGetRequestInformation($requestConfiguration); |
| 46 | + $errorMappings = [ |
| 47 | + 'XXX' => [ODataError::class, 'createFromDiscriminatorValue'], |
| 48 | + ]; |
| 49 | + return $this->requestAdapter->sendAsync($requestInfo, [GetPolicyIdWithTypeWithNameGetResponse::class, 'createFromDiscriminatorValue'], $errorMappings); |
| 50 | + } |
| 51 | + |
| 52 | + /** |
| 53 | + * Get the policy ID for a given policy name and policy type within Teams administration. |
| 54 | + * @param MicrosoftGraphTeamsAdministrationGetPolicyIdWithTypeWithNameRequestBuilderGetRequestConfiguration|null $requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. |
| 55 | + * @return RequestInformation |
| 56 | + */ |
| 57 | + public function toGetRequestInformation(?MicrosoftGraphTeamsAdministrationGetPolicyIdWithTypeWithNameRequestBuilderGetRequestConfiguration $requestConfiguration = null): RequestInformation { |
| 58 | + $requestInfo = new RequestInformation(); |
| 59 | + $requestInfo->urlTemplate = $this->urlTemplate; |
| 60 | + $requestInfo->pathParameters = $this->pathParameters; |
| 61 | + $requestInfo->httpMethod = HttpMethod::GET; |
| 62 | + if ($requestConfiguration !== null) { |
| 63 | + $requestInfo->addHeaders($requestConfiguration->headers); |
| 64 | + if ($requestConfiguration->queryParameters !== null) { |
| 65 | + $requestInfo->setQueryParameters($requestConfiguration->queryParameters); |
| 66 | + } |
| 67 | + $requestInfo->addRequestOptions(...$requestConfiguration->options); |
| 68 | + } |
| 69 | + $requestInfo->tryAddHeader('Accept', "application/json"); |
| 70 | + return $requestInfo; |
| 71 | + } |
| 72 | + |
| 73 | + /** |
| 74 | + * Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. |
| 75 | + * @param string $rawUrl The raw URL to use for the request builder. |
| 76 | + * @return MicrosoftGraphTeamsAdministrationGetPolicyIdWithTypeWithNameRequestBuilder |
| 77 | + */ |
| 78 | + public function withUrl(string $rawUrl): MicrosoftGraphTeamsAdministrationGetPolicyIdWithTypeWithNameRequestBuilder { |
| 79 | + return new MicrosoftGraphTeamsAdministrationGetPolicyIdWithTypeWithNameRequestBuilder($rawUrl, $this->requestAdapter); |
| 80 | + } |
| 81 | + |
| 82 | +} |
0 commit comments