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 #433

Merged
merged 7 commits into from
Oct 27, 2023
Merged
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.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.0rc0] - 2023-10-27

### Added

### Changed
- Refactored request headers from dictionary to headercollection.

## [1.0.0a16] - 2023-09-19

### Added
Expand Down
2 changes: 1 addition & 1 deletion docs/general_samples.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ from msgraph.generated.users.item.messages.messages_request_builder import Messa

async def get_user_messages():
request_config = MessagesRequestBuilder.MessagesRequestBuilderGetRequestConfiguration(
headers={"prefer": "outlook.body-content-type=text"}
)
request_config.headers.add("prefer", "outlook.body-content-type=text")

messages = await (client.users.by_user_id('USER_ID')
.messages
Expand Down
3 changes: 2 additions & 1 deletion docs/users_samples.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ async def find_user(user_name: str, client: GraphServiceClient) -> None:
)
request_configuration = (
UsersRequestBuilder.UsersRequestBuilderGetRequestConfiguration(
query_parameters=query_params, headers={"ConsistencyLevel": "eventual"}
query_parameters=query_params,
)
)
request_configuration.headers.add("ConsistencyLevel", "eventual")

response = await client.users.get(request_configuration=request_configuration)
if response.value:
Expand Down
2 changes: 1 addition & 1 deletion msgraph/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION: str = '1.0.0a16'
VERSION: str = '1.0.0rc0'
28 changes: 19 additions & 9 deletions msgraph/generated/admin/admin_request_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from ..models.admin import Admin
from ..models.o_data_errors.o_data_error import ODataError
from .edge.edge_request_builder import EdgeRequestBuilder
from .people.people_request_builder import PeopleRequestBuilder
from .service_announcement.service_announcement_request_builder import ServiceAnnouncementRequestBuilder
from .sharepoint.sharepoint_request_builder import SharepointRequestBuilder

Expand Down Expand Up @@ -81,14 +82,14 @@ def to_get_request_information(self,request_configuration: Optional[AdminRequest
Returns: RequestInformation
"""
request_info = RequestInformation()
request_info.url_template = self.url_template
request_info.path_parameters = self.path_parameters
request_info.http_method = Method.GET
request_info.headers["Accept"] = ["application/json"]
if request_configuration:
request_info.add_request_headers(request_configuration.headers)
request_info.headers.add_all(request_configuration.headers)
request_info.set_query_string_parameters_from_raw_object(request_configuration.query_parameters)
request_info.add_request_options(request_configuration.options)
request_info.url_template = self.url_template
request_info.path_parameters = self.path_parameters
request_info.http_method = Method.GET
request_info.headers.try_add("Accept", "application/json;q=1")
return request_info

def to_patch_request_information(self,body: Optional[Admin] = None, request_configuration: Optional[AdminRequestBuilderPatchRequestConfiguration] = None) -> RequestInformation:
Expand All @@ -101,13 +102,13 @@ def to_patch_request_information(self,body: Optional[Admin] = None, request_conf
if not body:
raise TypeError("body cannot be null.")
request_info = RequestInformation()
if request_configuration:
request_info.headers.add_all(request_configuration.headers)
request_info.add_request_options(request_configuration.options)
request_info.url_template = self.url_template
request_info.path_parameters = self.path_parameters
request_info.http_method = Method.PATCH
request_info.headers["Accept"] = ["application/json"]
if request_configuration:
request_info.add_request_headers(request_configuration.headers)
request_info.add_request_options(request_configuration.options)
request_info.headers.try_add("Accept", "application/json;q=1")
request_info.set_content_from_parsable(self.request_adapter, "application/json", body)
return request_info

Expand All @@ -130,6 +131,15 @@ def edge(self) -> EdgeRequestBuilder:

return EdgeRequestBuilder(self.request_adapter, self.path_parameters)

@property
def people(self) -> PeopleRequestBuilder:
"""
Provides operations to manage the people property of the microsoft.graph.admin entity.
"""
from .people.people_request_builder import PeopleRequestBuilder

return PeopleRequestBuilder(self.request_adapter, self.path_parameters)

@property
def service_announcement(self) -> ServiceAnnouncementRequestBuilder:
"""
Expand Down
25 changes: 13 additions & 12 deletions msgraph/generated/admin/edge/edge_request_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,13 @@ def to_delete_request_information(self,request_configuration: Optional[EdgeReque
Returns: RequestInformation
"""
request_info = RequestInformation()
if request_configuration:
request_info.headers.add_all(request_configuration.headers)
request_info.add_request_options(request_configuration.options)
request_info.url_template = self.url_template
request_info.path_parameters = self.path_parameters
request_info.http_method = Method.DELETE
if request_configuration:
request_info.add_request_headers(request_configuration.headers)
request_info.add_request_options(request_configuration.options)
request_info.headers.try_add("Accept", "application/json, application/json")
return request_info

def to_get_request_information(self,request_configuration: Optional[EdgeRequestBuilderGetRequestConfiguration] = None) -> RequestInformation:
Expand All @@ -113,14 +114,14 @@ def to_get_request_information(self,request_configuration: Optional[EdgeRequestB
Returns: RequestInformation
"""
request_info = RequestInformation()
request_info.url_template = self.url_template
request_info.path_parameters = self.path_parameters
request_info.http_method = Method.GET
request_info.headers["Accept"] = ["application/json"]
if request_configuration:
request_info.add_request_headers(request_configuration.headers)
request_info.headers.add_all(request_configuration.headers)
request_info.set_query_string_parameters_from_raw_object(request_configuration.query_parameters)
request_info.add_request_options(request_configuration.options)
request_info.url_template = self.url_template
request_info.path_parameters = self.path_parameters
request_info.http_method = Method.GET
request_info.headers.try_add("Accept", "application/json;q=1")
return request_info

def to_patch_request_information(self,body: Optional[Edge] = None, request_configuration: Optional[EdgeRequestBuilderPatchRequestConfiguration] = None) -> RequestInformation:
Expand All @@ -133,13 +134,13 @@ def to_patch_request_information(self,body: Optional[Edge] = None, request_confi
if not body:
raise TypeError("body cannot be null.")
request_info = RequestInformation()
if request_configuration:
request_info.headers.add_all(request_configuration.headers)
request_info.add_request_options(request_configuration.options)
request_info.url_template = self.url_template
request_info.path_parameters = self.path_parameters
request_info.http_method = Method.PATCH
request_info.headers["Accept"] = ["application/json"]
if request_configuration:
request_info.add_request_headers(request_configuration.headers)
request_info.add_request_options(request_configuration.options)
request_info.headers.try_add("Accept", "application/json;q=1")
request_info.set_content_from_parsable(self.request_adapter, "application/json", body)
return request_info

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,13 @@ def to_delete_request_information(self,request_configuration: Optional[InternetE
Returns: RequestInformation
"""
request_info = RequestInformation()
if request_configuration:
request_info.headers.add_all(request_configuration.headers)
request_info.add_request_options(request_configuration.options)
request_info.url_template = self.url_template
request_info.path_parameters = self.path_parameters
request_info.http_method = Method.DELETE
if request_configuration:
request_info.add_request_headers(request_configuration.headers)
request_info.add_request_options(request_configuration.options)
request_info.headers.try_add("Accept", "application/json, application/json")
return request_info

def to_get_request_information(self,request_configuration: Optional[InternetExplorerModeRequestBuilderGetRequestConfiguration] = None) -> RequestInformation:
Expand All @@ -113,14 +114,14 @@ def to_get_request_information(self,request_configuration: Optional[InternetExpl
Returns: RequestInformation
"""
request_info = RequestInformation()
request_info.url_template = self.url_template
request_info.path_parameters = self.path_parameters
request_info.http_method = Method.GET
request_info.headers["Accept"] = ["application/json"]
if request_configuration:
request_info.add_request_headers(request_configuration.headers)
request_info.headers.add_all(request_configuration.headers)
request_info.set_query_string_parameters_from_raw_object(request_configuration.query_parameters)
request_info.add_request_options(request_configuration.options)
request_info.url_template = self.url_template
request_info.path_parameters = self.path_parameters
request_info.http_method = Method.GET
request_info.headers.try_add("Accept", "application/json;q=1")
return request_info

def to_patch_request_information(self,body: Optional[InternetExplorerMode] = None, request_configuration: Optional[InternetExplorerModeRequestBuilderPatchRequestConfiguration] = None) -> RequestInformation:
Expand All @@ -133,13 +134,13 @@ def to_patch_request_information(self,body: Optional[InternetExplorerMode] = Non
if not body:
raise TypeError("body cannot be null.")
request_info = RequestInformation()
if request_configuration:
request_info.headers.add_all(request_configuration.headers)
request_info.add_request_options(request_configuration.options)
request_info.url_template = self.url_template
request_info.path_parameters = self.path_parameters
request_info.http_method = Method.PATCH
request_info.headers["Accept"] = ["application/json"]
if request_configuration:
request_info.add_request_headers(request_configuration.headers)
request_info.add_request_options(request_configuration.options)
request_info.headers.try_add("Accept", "application/json;q=1")
request_info.set_content_from_parsable(self.request_adapter, "application/json", body)
return request_info

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ def to_get_request_information(self,request_configuration: Optional[CountRequest
Returns: RequestInformation
"""
request_info = RequestInformation()
request_info.url_template = self.url_template
request_info.path_parameters = self.path_parameters
request_info.http_method = Method.GET
request_info.headers["Accept"] = ["text/plain"]
if request_configuration:
request_info.add_request_headers(request_configuration.headers)
request_info.headers.add_all(request_configuration.headers)
request_info.set_query_string_parameters_from_raw_object(request_configuration.query_parameters)
request_info.add_request_options(request_configuration.options)
request_info.url_template = self.url_template
request_info.path_parameters = self.path_parameters
request_info.http_method = Method.GET
request_info.headers.try_add("Accept", "text/plain;q=0.9")
return request_info

def with_url(self,raw_url: Optional[str] = None) -> CountRequestBuilder:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(self,request_adapter: RequestAdapter, path_parameters: Optional[Uni

async def delete(self,request_configuration: Optional[BrowserSiteListItemRequestBuilderDeleteRequestConfiguration] = None) -> None:
"""
Delete a browserSiteList object.
Delete a browserSiteList object. This API is available in the following national cloud deployments.
param request_configuration: Configuration for the request such as headers, query parameters, and middleware options.
Returns: None
Find more info here: https://learn.microsoft.com/graph/api/internetexplorermode-delete-sitelists?view=graph-rest-1.0
Expand All @@ -51,7 +51,7 @@ async def delete(self,request_configuration: Optional[BrowserSiteListItemRequest

async def get(self,request_configuration: Optional[BrowserSiteListItemRequestBuilderGetRequestConfiguration] = None) -> Optional[BrowserSiteList]:
"""
Get a browserSiteList that contains browserSite and browserSharedCookie resources.
Get a browserSiteList that contains browserSite and browserSharedCookie resources. This API is available in the following national cloud deployments.
param request_configuration: Configuration for the request such as headers, query parameters, and middleware options.
Returns: Optional[BrowserSiteList]
Find more info here: https://learn.microsoft.com/graph/api/browsersitelist-get?view=graph-rest-1.0
Expand All @@ -73,7 +73,7 @@ async def get(self,request_configuration: Optional[BrowserSiteListItemRequestBui

async def patch(self,body: Optional[BrowserSiteList] = None, request_configuration: Optional[BrowserSiteListItemRequestBuilderPatchRequestConfiguration] = None) -> Optional[BrowserSiteList]:
"""
Update the properties of a browserSiteList object.
Update the properties of a browserSiteList object. This API is available in the following national cloud deployments.
param body: The request body
param request_configuration: Configuration for the request such as headers, query parameters, and middleware options.
Returns: Optional[BrowserSiteList]
Expand All @@ -98,53 +98,54 @@ async def patch(self,body: Optional[BrowserSiteList] = None, request_configurati

def to_delete_request_information(self,request_configuration: Optional[BrowserSiteListItemRequestBuilderDeleteRequestConfiguration] = None) -> RequestInformation:
"""
Delete a browserSiteList object.
Delete a browserSiteList object. This API is available in the following national cloud deployments.
param request_configuration: Configuration for the request such as headers, query parameters, and middleware options.
Returns: RequestInformation
"""
request_info = RequestInformation()
if request_configuration:
request_info.headers.add_all(request_configuration.headers)
request_info.add_request_options(request_configuration.options)
request_info.url_template = self.url_template
request_info.path_parameters = self.path_parameters
request_info.http_method = Method.DELETE
if request_configuration:
request_info.add_request_headers(request_configuration.headers)
request_info.add_request_options(request_configuration.options)
request_info.headers.try_add("Accept", "application/json, application/json")
return request_info

def to_get_request_information(self,request_configuration: Optional[BrowserSiteListItemRequestBuilderGetRequestConfiguration] = None) -> RequestInformation:
"""
Get a browserSiteList that contains browserSite and browserSharedCookie resources.
Get a browserSiteList that contains browserSite and browserSharedCookie resources. This API is available in the following national cloud deployments.
param request_configuration: Configuration for the request such as headers, query parameters, and middleware options.
Returns: RequestInformation
"""
request_info = RequestInformation()
request_info.url_template = self.url_template
request_info.path_parameters = self.path_parameters
request_info.http_method = Method.GET
request_info.headers["Accept"] = ["application/json"]
if request_configuration:
request_info.add_request_headers(request_configuration.headers)
request_info.headers.add_all(request_configuration.headers)
request_info.set_query_string_parameters_from_raw_object(request_configuration.query_parameters)
request_info.add_request_options(request_configuration.options)
request_info.url_template = self.url_template
request_info.path_parameters = self.path_parameters
request_info.http_method = Method.GET
request_info.headers.try_add("Accept", "application/json;q=1")
return request_info

def to_patch_request_information(self,body: Optional[BrowserSiteList] = None, request_configuration: Optional[BrowserSiteListItemRequestBuilderPatchRequestConfiguration] = None) -> RequestInformation:
"""
Update the properties of a browserSiteList object.
Update the properties of a browserSiteList object. This API is available in the following national cloud deployments.
param body: The request body
param request_configuration: Configuration for the request such as headers, query parameters, and middleware options.
Returns: RequestInformation
"""
if not body:
raise TypeError("body cannot be null.")
request_info = RequestInformation()
if request_configuration:
request_info.headers.add_all(request_configuration.headers)
request_info.add_request_options(request_configuration.options)
request_info.url_template = self.url_template
request_info.path_parameters = self.path_parameters
request_info.http_method = Method.PATCH
request_info.headers["Accept"] = ["application/json"]
if request_configuration:
request_info.add_request_headers(request_configuration.headers)
request_info.add_request_options(request_configuration.options)
request_info.headers.try_add("Accept", "application/json;q=1")
request_info.set_content_from_parsable(self.request_adapter, "application/json", body)
return request_info

Expand Down Expand Up @@ -198,7 +199,7 @@ class BrowserSiteListItemRequestBuilderDeleteRequestConfiguration(BaseRequestCon
@dataclass
class BrowserSiteListItemRequestBuilderGetQueryParameters():
"""
Get a browserSiteList that contains browserSite and browserSharedCookie resources.
Get a browserSiteList that contains browserSite and browserSharedCookie resources. This API is available in the following national cloud deployments.
"""
def get_query_parameter(self,original_name: Optional[str] = None) -> str:
"""
Expand Down
Loading