|
| 1 | +from __future__ import annotations |
| 2 | +from collections.abc import Callable |
| 3 | +from dataclasses import dataclass, field |
| 4 | +from kiota_abstractions.base_request_builder import BaseRequestBuilder |
| 5 | +from kiota_abstractions.base_request_configuration import RequestConfiguration |
| 6 | +from kiota_abstractions.default_query_parameters import QueryParameters |
| 7 | +from kiota_abstractions.get_path_parameters import get_path_parameters |
| 8 | +from kiota_abstractions.method import Method |
| 9 | +from kiota_abstractions.request_adapter import RequestAdapter |
| 10 | +from kiota_abstractions.request_information import RequestInformation |
| 11 | +from kiota_abstractions.request_option import RequestOption |
| 12 | +from kiota_abstractions.serialization import Parsable, ParsableFactory |
| 13 | +from typing import Any, Optional, TYPE_CHECKING, Union |
| 14 | +from warnings import warn |
| 15 | + |
| 16 | +if TYPE_CHECKING: |
| 17 | + from .....models.o_data_errors.o_data_error import ODataError |
| 18 | + from .get_policy_id_with_type_with_name_get_response import GetPolicyIdWithTypeWithNameGetResponse |
| 19 | + |
| 20 | +class MicrosoftGraphTeamsAdministrationGetPolicyIdWithTypeWithNameRequestBuilder(BaseRequestBuilder): |
| 21 | + """ |
| 22 | + Provides operations to call the getPolicyId method. |
| 23 | + """ |
| 24 | + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]], name: Optional[str] = None, type: Optional[str] = None) -> None: |
| 25 | + """ |
| 26 | + Instantiates a new MicrosoftGraphTeamsAdministrationGetPolicyIdWithTypeWithNameRequestBuilder and sets the default values. |
| 27 | + param name: Usage: name='{name}' |
| 28 | + param path_parameters: The raw url or the url-template parameters for the request. |
| 29 | + param request_adapter: The request adapter to use to execute the requests. |
| 30 | + param type: Usage: type='{type}' |
| 31 | + Returns: None |
| 32 | + """ |
| 33 | + if isinstance(path_parameters, dict): |
| 34 | + path_parameters['name'] = name |
| 35 | + path_parameters['type'] = type |
| 36 | + super().__init__(request_adapter, "{+baseurl}/admin/teams/policy/microsoft.graph.teamsAdministration.getPolicyId(type='{type}',name='{name}'){?%24count,%24expand,%24filter,%24orderby,%24search,%24select,%24skip,%24top}", path_parameters) |
| 37 | + |
| 38 | + async def get(self,request_configuration: Optional[RequestConfiguration[MicrosoftGraphTeamsAdministrationGetPolicyIdWithTypeWithNameRequestBuilderGetQueryParameters]] = None) -> Optional[GetPolicyIdWithTypeWithNameGetResponse]: |
| 39 | + """ |
| 40 | + Get the policy ID for a given policy name and policy type within Teams administration. |
| 41 | + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. |
| 42 | + Returns: Optional[GetPolicyIdWithTypeWithNameGetResponse] |
| 43 | + Find more info here: https://learn.microsoft.com/graph/api/teamsadministration-teamspolicyassignment-getpolicyid?view=graph-rest-1.0 |
| 44 | + """ |
| 45 | + request_info = self.to_get_request_information( |
| 46 | + request_configuration |
| 47 | + ) |
| 48 | + from .....models.o_data_errors.o_data_error import ODataError |
| 49 | + |
| 50 | + error_mapping: dict[str, type[ParsableFactory]] = { |
| 51 | + "XXX": ODataError, |
| 52 | + } |
| 53 | + if not self.request_adapter: |
| 54 | + raise Exception("Http core is null") |
| 55 | + from .get_policy_id_with_type_with_name_get_response import GetPolicyIdWithTypeWithNameGetResponse |
| 56 | + |
| 57 | + return await self.request_adapter.send_async(request_info, GetPolicyIdWithTypeWithNameGetResponse, error_mapping) |
| 58 | + |
| 59 | + def to_get_request_information(self,request_configuration: Optional[RequestConfiguration[MicrosoftGraphTeamsAdministrationGetPolicyIdWithTypeWithNameRequestBuilderGetQueryParameters]] = None) -> RequestInformation: |
| 60 | + """ |
| 61 | + Get the policy ID for a given policy name and policy type within Teams administration. |
| 62 | + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. |
| 63 | + Returns: RequestInformation |
| 64 | + """ |
| 65 | + request_info = RequestInformation(Method.GET, self.url_template, self.path_parameters) |
| 66 | + request_info.configure(request_configuration) |
| 67 | + request_info.headers.try_add("Accept", "application/json") |
| 68 | + return request_info |
| 69 | + |
| 70 | + def with_url(self,raw_url: str) -> MicrosoftGraphTeamsAdministrationGetPolicyIdWithTypeWithNameRequestBuilder: |
| 71 | + """ |
| 72 | + Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. |
| 73 | + param raw_url: The raw URL to use for the request builder. |
| 74 | + Returns: MicrosoftGraphTeamsAdministrationGetPolicyIdWithTypeWithNameRequestBuilder |
| 75 | + """ |
| 76 | + if raw_url is None: |
| 77 | + raise TypeError("raw_url cannot be null.") |
| 78 | + return MicrosoftGraphTeamsAdministrationGetPolicyIdWithTypeWithNameRequestBuilder(self.request_adapter, raw_url) |
| 79 | + |
| 80 | + @dataclass |
| 81 | + class MicrosoftGraphTeamsAdministrationGetPolicyIdWithTypeWithNameRequestBuilderGetQueryParameters(): |
| 82 | + """ |
| 83 | + Get the policy ID for a given policy name and policy type within Teams administration. |
| 84 | + """ |
| 85 | + def get_query_parameter(self,original_name: str) -> str: |
| 86 | + """ |
| 87 | + Maps the query parameters names to their encoded names for the URI template parsing. |
| 88 | + param original_name: The original query parameter name in the class. |
| 89 | + Returns: str |
| 90 | + """ |
| 91 | + if original_name is None: |
| 92 | + raise TypeError("original_name cannot be null.") |
| 93 | + if original_name == "count": |
| 94 | + return "%24count" |
| 95 | + if original_name == "expand": |
| 96 | + return "%24expand" |
| 97 | + if original_name == "filter": |
| 98 | + return "%24filter" |
| 99 | + if original_name == "orderby": |
| 100 | + return "%24orderby" |
| 101 | + if original_name == "search": |
| 102 | + return "%24search" |
| 103 | + if original_name == "select": |
| 104 | + return "%24select" |
| 105 | + if original_name == "skip": |
| 106 | + return "%24skip" |
| 107 | + if original_name == "top": |
| 108 | + return "%24top" |
| 109 | + return original_name |
| 110 | + |
| 111 | + # Include count of items |
| 112 | + count: Optional[bool] = None |
| 113 | + |
| 114 | + # Expand related entities |
| 115 | + expand: Optional[list[str]] = None |
| 116 | + |
| 117 | + # Filter items by property values |
| 118 | + filter: Optional[str] = None |
| 119 | + |
| 120 | + # Order items by property values |
| 121 | + orderby: Optional[list[str]] = None |
| 122 | + |
| 123 | + # Search items by search phrases |
| 124 | + search: Optional[str] = None |
| 125 | + |
| 126 | + # Select properties to be returned |
| 127 | + select: Optional[list[str]] = None |
| 128 | + |
| 129 | + # Skip the first n items |
| 130 | + skip: Optional[int] = None |
| 131 | + |
| 132 | + # Show only the first n items |
| 133 | + top: Optional[int] = None |
| 134 | + |
| 135 | + |
| 136 | + @dataclass |
| 137 | + class MicrosoftGraphTeamsAdministrationGetPolicyIdWithTypeWithNameRequestBuilderGetRequestConfiguration(RequestConfiguration[MicrosoftGraphTeamsAdministrationGetPolicyIdWithTypeWithNameRequestBuilderGetQueryParameters]): |
| 138 | + """ |
| 139 | + Configuration for the request such as headers, query parameters, and middleware options. |
| 140 | + """ |
| 141 | + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) |
| 142 | + |
| 143 | + |
0 commit comments