This repository was archived by the owner on Oct 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 191
Expand file tree
/
Copy pathitem_delta.py
More file actions
111 lines (88 loc) · 4.33 KB
/
Copy pathitem_delta.py
File metadata and controls
111 lines (88 loc) · 4.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# -*- coding: utf-8 -*-
'''
# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
#
# This file was generated and any changes will be overwritten.
'''
from ..collection_base import CollectionRequestBase
from ..request_builder_base import RequestBuilderBase
from ..options import *
import json
import asyncio
class ItemDeltaRequest(CollectionRequestBase):
def __init__(self, request_url, client, options, token=None):
super(ItemDeltaRequest, self).__init__(request_url, client, options)
self.method = "GET"
if token:
self._query_options["token"] = token
def get(self):
"""Sends the GET request
Returns:
:class:`ItemDeltaCollectionResponse<onedrivesdk.request.item_delta_collection.ItemDeltaCollectionResponse>`:
The resulting collection page from the operation
"""
collection_response = ItemDeltaCollectionResponse(json.loads(self.send().content))
return self._page_from_response(collection_response)
@asyncio.coroutine
def get_async(self):
"""Sends the GET request using an asyncio coroutine
Yields:
:class:`ItemDeltaCollectionResponse<onedrivesdk.request.item_delta_collection.ItemDeltaCollectionResponse>`:
The resulting collection page from the operation
"""
future = self._client._loop.run_in_executor(None,
self.get)
collection_response = yield from future
return collection_response
@staticmethod
def get_next_page_request(collection_page, client, options, token=None):
"""Gets the ItemDeltaRequest for the next page. Returns None if there is no next page
Yields:
:class:`ItemDeltaRequest<onedrivesdk.request.item_delta.ItemDeltaRequest>`:
The ItemDeltaRequest
"""
if collection_page._next_page_link:
return ItemDeltaRequest(collection_page._next_page_link, client, options, token)
else:
return None
class ItemDeltaRequestBuilder(RequestBuilderBase):
def __init__(self, request_url, client, token=None):
super(ItemDeltaRequestBuilder, self).__init__(request_url, client)
self._method_options = {}
self._method_options["token"] = token
def request(self, expand=None, select=None, top=None, order_by=None, options=None):
"""Builds the request for the ItemDelta
Args:
expand (str): Default None, comma-seperated list of relationships
to expand in the response.
select (str): Default None, comma-seperated list of properties to
include in the response.
top (int): Default None, the number of items to return in a result.
order_by (str): Default None, comma-seperated list of properties
that are used to sort the order of items in the response.
options (list of :class:`Option<onedrivesdk.options.Option>`):
Default to None, list of options to include in the request
Returns:
:class:`ItemDeltaRequest<onedrivesdk.request.item_delta.ItemDeltaRequest>`:
The request
"""
req = ItemDeltaRequest(self._request_url, self._client, options, token=self._method_options["token"])
req._set_query_options(expand=expand, select=select, top=top, order_by=order_by)
return req
def get(self):
"""Sends the GET request
Returns:
:class:`ItemDeltaCollectionResponse<onedrivesdk.request.item_delta_collection.ItemDeltaCollectionResponse>`:
The resulting ItemDeltaCollectionResponse from the operation
"""
return self.request().get()
@asyncio.coroutine
def get_async(self):
"""Sends the GET request using an asyncio coroutine
Yields:
:class:`ItemDeltaCollectionResponse<onedrivesdk.request.item_delta_collection.ItemDeltaCollectionResponse>`:
The resulting ItemDeltaCollectionResponse from the operation
"""
collection_page = yield from self.request().get_async()
return collection_page
from ..request.item_delta_collection import ItemDeltaCollectionResponse