-
Notifications
You must be signed in to change notification settings - Fork 43
Large File Upload Task #530
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
Merged
Merged
Changes from 22 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
6ed2bfa
Intitialize Large file upload models'
shemogumbe da8660f
Implement model classes for large file upload
shemogumbe d5db8bd
Large file upload draft implementation
shemogumbe cd6ad7f
Large file upload-code customization
shemogumbe 32b5c40
convert upload session to data class
shemogumbe 533fc96
update parse node methods
shemogumbe 0f98833
Update Large file upload create session
shemogumbe 0d4aafc
test file upload
shemogumbe 77c67e1
Tested upload session does an upload
shemogumbe d7cd14f
debug create upload sesion
shemogumbe 06270a0
Fix Create large file upload session
shemogumbe b506460
Fix upload and cencellation
shemogumbe 0d5d0d7
Merge branch 'main' into shem/large_file_upload
shemogumbe 405ff07
fix code formating
shemogumbe 93909f9
fix linting issues
shemogumbe 1f396da
Fixed LFU making it possible to upload files to drive in chunks
shemogumbe 00896f4
ignore type on async session
shemogumbe 3b2441d
Fixed upload
shemogumbe 4aed868
Fixed upload session and upload task
shemogumbe b1f3eee
Fix linting issues
shemogumbe 8207762
clean up code
shemogumbe 4a4ab93
Update changelong ad API Version
shemogumbe 073e0a9
Update src/msgraph_core/tasks/large_file_upload.py
shemogumbe c7ad84d
remove unnecesary code
shemogumbe 70b2477
Merge branch 'shem/large_file_upload' of github.com:microsoftgraph/ms…
shemogumbe 3d4e11d
use generic request adapter
shemogumbe 1271d90
implement upload result
shemogumbe ff2fd27
fix missing fieldsd in result type
shemogumbe f65b9f0
fix missing fieldsd in result type
shemogumbe 69643db
allow custom Parsable in LFU construtor
shemogumbe 221ede5
Fixed response for drive item
shemogumbe 9754d1c
fixed response type for drive item
shemogumbe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,3 +133,4 @@ dmypy.json | |
.idea/ | ||
|
||
app*.py | ||
app* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
from .page_result import PageResult | ||
from .large_file_upload_session import LargeFileUploadSession | ||
from .large_file_upload_create_session_body import LargeFileUploadCreateSessionBody | ||
|
||
__all__ = ['PageResult'] | ||
__all__ = ['PageResult', 'LargeFileUploadSession', 'LargeFileUploadCreateSessionBody'] |
33 changes: 33 additions & 0 deletions
33
src/msgraph_core/models/large_file_upload_create_session_body.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from kiota_abstractions.serialization.additional_data_holder import AdditionalDataHolder | ||
from kiota_abstractions.serialization.parsable import Parsable | ||
from kiota_abstractions.serialization.serialization_writer import SerializationWriter | ||
from kiota_abstractions.store.backed_model import BackedModel | ||
from kiota_abstractions.store.backing_store import BackingStore | ||
from kiota_abstractions.store.backing_store_factory_singleton import BackingStoreFactorySingleton | ||
|
||
|
||
class LargeFileUploadCreateSessionBody(Parsable, AdditionalDataHolder, BackedModel): | ||
|
||
def __init__(self): | ||
singleton = BackingStoreFactorySingleton.get_instance() | ||
factory = singleton.backing_store_factory | ||
self.backing_store = factory.create_backing_store( | ||
) # throws error -AttributeError: type object | ||
#'BackingStoreFactorySingleton' has no attribute | ||
# '_BackingStoreFactorySingleton__instance' | ||
self.set_additional_data([]) | ||
|
||
def get_additional_data(self): | ||
return self.backing_store.get('additional_data') | ||
|
||
def set_additional_data(self, value): | ||
self.backing_store.set('additional_data', value) | ||
|
||
def get_field_deserializers(self): | ||
return {} | ||
|
||
def serialize(self, writer: SerializationWriter): | ||
writer.write_additional_data_value(self.get_additional_data()) | ||
|
||
def get_backing_store(self): | ||
return self.backing_store |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
from __future__ import annotations | ||
from typing import Any, Callable, Dict, List, Optional, TYPE_CHECKING, Union | ||
import datetime | ||
from dataclasses import dataclass, field | ||
|
||
from kiota_abstractions.serialization import ( | ||
AdditionalDataHolder, Parsable, ParseNode, SerializationWriter | ||
) | ||
|
||
|
||
@dataclass | ||
class LargeFileUploadSession(AdditionalDataHolder, Parsable): | ||
|
||
additional_data: Dict[str, Any] = field(default_factory=dict) | ||
expiration_date_time: Optional[datetime.datetime] = None | ||
next_expected_ranges: Optional[List[str]] = None | ||
is_cancelled: Optional[bool] = False | ||
odata_type: Optional[str] = None | ||
# The URL endpoint that accepts PUT requests for byte ranges of the file. | ||
upload_url: Optional[str] = None | ||
|
||
@staticmethod | ||
def create_from_discriminator_value( | ||
parse_node: Optional[ParseNode] = None | ||
) -> LargeFileUploadSession: | ||
""" | ||
Creates a new instance of the appropriate class based | ||
on discriminator value param parse_node: The parse node | ||
to use to read the discriminator value and create the object | ||
Returns: UploadSession | ||
""" | ||
if not parse_node: | ||
raise TypeError("parse_node cannot be null.") | ||
return LargeFileUploadSession() | ||
|
||
def get_field_deserializers(self, ) -> Dict[str, Callable[[ParseNode], None]]: | ||
""" | ||
The deserialization information for the current model | ||
Returns: Dict[str, Callable[[ParseNode], None]] | ||
""" | ||
fields: Dict[str, Callable[[Any], None]] = { | ||
"expirationDateTime": | ||
lambda n: setattr(self, 'expiration_date_time', n.get_datetime_value()), | ||
"nextExpectedRanges": | ||
lambda n: | ||
setattr(self, 'next_expected_ranges', n.get_collection_of_primitive_values(str)), | ||
"@odata.type": | ||
lambda n: setattr(self, 'odata_type', n.get_str_value()), | ||
"uploadUrl": | ||
lambda n: setattr(self, 'upload_url', n.get_str_value()), | ||
} | ||
return fields | ||
|
||
def serialize(self, writer: SerializationWriter) -> None: | ||
""" | ||
Serializes information the current object | ||
param writer: Serialization writer to use to serialize this model | ||
Returns: None | ||
""" | ||
if not writer: | ||
raise TypeError("writer cannot be null.") | ||
writer.write_datetime_value("expirationDateTime", self.expiration_date_time) | ||
writer.write_collection_of_primitive_values("nextExpectedRanges", self.next_expected_ranges) | ||
writer.write_str_value("@odata.type", self.odata_type) | ||
writer.write_str_value("uploadUrl", self.upload_url) | ||
writer.write_additional_data_value(self.additional_data) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
from .page_iterator import PageIterator | ||
from .large_file_upload import LargeFileUploadTask | ||
|
||
__all__ = ['PageIterator', 'LargeFileUploadTask'] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.