diff --git a/vsts/setup.py b/vsts/setup.py index 470f6add..0fa30ee9 100644 --- a/vsts/setup.py +++ b/vsts/setup.py @@ -6,7 +6,7 @@ from setuptools import setup, find_packages NAME = "vsts" -VERSION = "0.1.22" +VERSION = "0.1.23" # To install the library, run the following # diff --git a/vsts/vsts/build/v4_0/build_client.py b/vsts/vsts/build/v4_0/build_client.py index 2d711f5e..92d52d34 100644 --- a/vsts/vsts/build/v4_0/build_client.py +++ b/vsts/vsts/build/v4_0/build_client.py @@ -69,7 +69,7 @@ def get_artifact(self, build_id, artifact_name, project=None): query_parameters=query_parameters) return self._deserialize('BuildArtifact', response) - def get_artifact_content_zip(self, build_id, artifact_name, project=None): + def get_artifact_content_zip(self, build_id, artifact_name, project=None, **kwargs): """GetArtifactContentZip. Gets a specific artifact for a build :param int build_id: @@ -89,8 +89,13 @@ def get_artifact_content_zip(self, build_id, artifact_name, project=None): location_id='1db06c96-014e-44e1-ac91-90b2d4b3e984', version='4.0', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_artifacts(self, build_id, project=None): """GetArtifacts. @@ -700,7 +705,7 @@ def update_folder(self, folder, project, path): content=content) return self._deserialize('Folder', response) - def get_build_log(self, project, build_id, log_id, start_line=None, end_line=None): + def get_build_log(self, project, build_id, log_id, start_line=None, end_line=None, **kwargs): """GetBuildLog. Gets a log :param str project: Project ID or project name @@ -726,8 +731,13 @@ def get_build_log(self, project, build_id, log_id, start_line=None, end_line=Non location_id='35a80daf-7f30-45fc-86e8-6b813d9c90df', version='4.0', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='text/plain') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_build_log_lines(self, project, build_id, log_id, start_line=None, end_line=None): """GetBuildLogLines. @@ -776,7 +786,7 @@ def get_build_logs(self, project, build_id): route_values=route_values) return self._deserialize('[BuildLog]', self._unwrap_collection(response)) - def get_build_logs_zip(self, project, build_id): + def get_build_logs_zip(self, project, build_id, **kwargs): """GetBuildLogsZip. Gets logs for a build :param str project: Project ID or project name @@ -791,8 +801,13 @@ def get_build_logs_zip(self, project, build_id): response = self._send(http_method='GET', location_id='35a80daf-7f30-45fc-86e8-6b813d9c90df', version='4.0', - route_values=route_values) - return self._deserialize('object', response) + route_values=route_values, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_project_metrics(self, project, metric_aggregation_type=None, min_metrics_time=None): """GetProjectMetrics. @@ -970,7 +985,7 @@ def get_build_report(self, project, build_id, type=None): query_parameters=query_parameters) return self._deserialize('BuildReportMetadata', response) - def get_build_report_html_content(self, project, build_id, type=None): + def get_build_report_html_content(self, project, build_id, type=None, **kwargs): """GetBuildReportHtmlContent. [Preview API] Gets report for a build :param str project: Project ID or project name @@ -990,8 +1005,13 @@ def get_build_report_html_content(self, project, build_id, type=None): location_id='45bcaa88-67e1-4042-a035-56d3b4a7d44c', version='4.0-preview.2', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='text/html') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_resource_usage(self): """GetResourceUsage. diff --git a/vsts/vsts/build/v4_1/build_client.py b/vsts/vsts/build/v4_1/build_client.py index 8c8ba959..d8813954 100644 --- a/vsts/vsts/build/v4_1/build_client.py +++ b/vsts/vsts/build/v4_1/build_client.py @@ -69,7 +69,7 @@ def get_artifact(self, build_id, artifact_name, project=None): query_parameters=query_parameters) return self._deserialize('BuildArtifact', response) - def get_artifact_content_zip(self, build_id, artifact_name, project=None): + def get_artifact_content_zip(self, build_id, artifact_name, project=None, **kwargs): """GetArtifactContentZip. Gets a specific artifact for a build. :param int build_id: The ID of the build. @@ -89,8 +89,13 @@ def get_artifact_content_zip(self, build_id, artifact_name, project=None): location_id='1db06c96-014e-44e1-ac91-90b2d4b3e984', version='4.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_artifacts(self, build_id, project=None): """GetArtifacts. @@ -131,7 +136,7 @@ def get_attachments(self, project, build_id, type): route_values=route_values) return self._deserialize('[Attachment]', self._unwrap_collection(response)) - def get_attachment(self, project, build_id, timeline_id, record_id, type, name): + def get_attachment(self, project, build_id, timeline_id, record_id, type, name, **kwargs): """GetAttachment. [Preview API] Gets a specific attachment. :param str project: Project ID or project name @@ -158,8 +163,13 @@ def get_attachment(self, project, build_id, timeline_id, record_id, type, name): response = self._send(http_method='GET', location_id='af5122d3-3438-485e-a25a-2dbbfde84ee6', version='4.1-preview.1', - route_values=route_values) - return self._deserialize('object', response) + route_values=route_values, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_badge(self, project, definition_id, branch_name=None): """GetBadge. @@ -668,54 +678,6 @@ def get_definitions(self, project=None, name=None, repository_id=None, repositor query_parameters=query_parameters) return self._deserialize('[BuildDefinitionReference]', self._unwrap_collection(response)) - def reset_counter(self, definition_id, counter_id, project=None): - """ResetCounter. - Resets the counter variable Value back to the Seed. - :param int definition_id: The ID of the definition. - :param int counter_id: The ID of the counter. - :param str project: Project ID or project name - """ - route_values = {} - if project is not None: - route_values['project'] = self._serialize.url('project', project, 'str') - if definition_id is not None: - route_values['definitionId'] = self._serialize.url('definition_id', definition_id, 'int') - query_parameters = {} - if counter_id is not None: - query_parameters['counterId'] = self._serialize.query('counter_id', counter_id, 'int') - self._send(http_method='POST', - location_id='dbeaf647-6167-421a-bda9-c9327b25e2e6', - version='4.1', - route_values=route_values, - query_parameters=query_parameters) - - def update_counter_seed(self, definition_id, counter_id, new_seed, reset_value, project=None): - """UpdateCounterSeed. - Changes the counter variable Seed, and optionally resets the Value to this new Seed. Note that if Seed is being set above Value, then Value will be updated regardless. - :param int definition_id: The ID of the definition. - :param int counter_id: The ID of the counter. - :param long new_seed: The new Seed value. - :param bool reset_value: Flag indicating if Value should also be reset. - :param str project: Project ID or project name - """ - route_values = {} - if project is not None: - route_values['project'] = self._serialize.url('project', project, 'str') - if definition_id is not None: - route_values['definitionId'] = self._serialize.url('definition_id', definition_id, 'int') - query_parameters = {} - if counter_id is not None: - query_parameters['counterId'] = self._serialize.query('counter_id', counter_id, 'int') - if new_seed is not None: - query_parameters['newSeed'] = self._serialize.query('new_seed', new_seed, 'long') - if reset_value is not None: - query_parameters['resetValue'] = self._serialize.query('reset_value', reset_value, 'bool') - self._send(http_method='POST', - location_id='dbeaf647-6167-421a-bda9-c9327b25e2e6', - version='4.1', - route_values=route_values, - query_parameters=query_parameters) - def update_definition(self, definition, definition_id, project=None, secrets_source_definition_id=None, secrets_source_definition_revision=None): """UpdateDefinition. Updates an existing definition. @@ -745,7 +707,7 @@ def update_definition(self, definition, definition_id, project=None, secrets_sou content=content) return self._deserialize('BuildDefinition', response) - def get_file_contents(self, project, provider_name, service_endpoint_id=None, repository=None, commit_or_branch=None, path=None): + def get_file_contents(self, project, provider_name, service_endpoint_id=None, repository=None, commit_or_branch=None, path=None, **kwargs): """GetFileContents. [Preview API] Gets the contents of a file in the given source code repository. :param str project: Project ID or project name @@ -774,8 +736,13 @@ def get_file_contents(self, project, provider_name, service_endpoint_id=None, re location_id='29d12225-b1d9-425f-b668-6c594a981313', version='4.1-preview.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='text/plain') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def create_folder(self, folder, project, path): """CreateFolder. @@ -858,7 +825,7 @@ def update_folder(self, folder, project, path): content=content) return self._deserialize('Folder', response) - def get_build_log(self, project, build_id, log_id, start_line=None, end_line=None): + def get_build_log(self, project, build_id, log_id, start_line=None, end_line=None, **kwargs): """GetBuildLog. Gets an individual log file for a build. :param str project: Project ID or project name @@ -884,8 +851,13 @@ def get_build_log(self, project, build_id, log_id, start_line=None, end_line=Non location_id='35a80daf-7f30-45fc-86e8-6b813d9c90df', version='4.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='text/plain') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_build_log_lines(self, project, build_id, log_id, start_line=None, end_line=None): """GetBuildLogLines. @@ -934,7 +906,7 @@ def get_build_logs(self, project, build_id): route_values=route_values) return self._deserialize('[BuildLog]', self._unwrap_collection(response)) - def get_build_logs_zip(self, project, build_id): + def get_build_logs_zip(self, project, build_id, **kwargs): """GetBuildLogsZip. Gets the logs for a build. :param str project: Project ID or project name @@ -949,8 +921,13 @@ def get_build_logs_zip(self, project, build_id): response = self._send(http_method='GET', location_id='35a80daf-7f30-45fc-86e8-6b813d9c90df', version='4.1', - route_values=route_values) - return self._deserialize('object', response) + route_values=route_values, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_project_metrics(self, project, metric_aggregation_type=None, min_metrics_time=None): """GetProjectMetrics. @@ -1160,7 +1137,7 @@ def get_build_report(self, project, build_id, type=None): query_parameters=query_parameters) return self._deserialize('BuildReportMetadata', response) - def get_build_report_html_content(self, project, build_id, type=None): + def get_build_report_html_content(self, project, build_id, type=None, **kwargs): """GetBuildReportHtmlContent. [Preview API] Gets a build report. :param str project: Project ID or project name @@ -1180,8 +1157,13 @@ def get_build_report_html_content(self, project, build_id, type=None): location_id='45bcaa88-67e1-4042-a035-56d3b4a7d44c', version='4.1-preview.2', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='text/html') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def list_repositories(self, project, provider_name, service_endpoint_id=None, repository=None, result_set=None, page_results=None, continuation_token=None): """ListRepositories. @@ -1536,7 +1518,7 @@ def save_template(self, template, project, template_id): content=content) return self._deserialize('BuildDefinitionTemplate', response) - def get_ticketed_artifact_content_zip(self, build_id, project_id, artifact_name, download_ticket): + def get_ticketed_artifact_content_zip(self, build_id, project_id, artifact_name, download_ticket, **kwargs): """GetTicketedArtifactContentZip. [Preview API] Gets a Zip file of the artifact with the given name for a build. :param int build_id: The ID of the build. @@ -1557,10 +1539,15 @@ def get_ticketed_artifact_content_zip(self, build_id, project_id, artifact_name, location_id='731b7e7a-0b6c-4912-af75-de04fe4899db', version='4.1-preview.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) - - def get_ticketed_logs_content_zip(self, build_id, project_id, download_ticket): + query_parameters=query_parameters, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_ticketed_logs_content_zip(self, build_id, project_id, download_ticket, **kwargs): """GetTicketedLogsContentZip. [Preview API] Gets a Zip file of the logs for a given build. :param int build_id: The ID of the build. @@ -1578,8 +1565,13 @@ def get_ticketed_logs_content_zip(self, build_id, project_id, download_ticket): location_id='917890d1-a6b5-432d-832a-6afcf6bb0734', version='4.1-preview.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_build_timeline(self, project, build_id, timeline_id=None, change_id=None, plan_id=None): """GetBuildTimeline. diff --git a/vsts/vsts/gallery/v4_0/gallery_client.py b/vsts/vsts/gallery/v4_0/gallery_client.py index 0e6c027e..475c17af 100644 --- a/vsts/vsts/gallery/v4_0/gallery_client.py +++ b/vsts/vsts/gallery/v4_0/gallery_client.py @@ -134,7 +134,7 @@ def request_acquisition(self, acquisition_request): content=content) return self._deserialize('ExtensionAcquisitionRequest', response) - def get_asset_by_name(self, publisher_name, extension_name, version, asset_type, account_token=None, accept_default=None): + def get_asset_by_name(self, publisher_name, extension_name, version, asset_type, account_token=None, accept_default=None, **kwargs): """GetAssetByName. [Preview API] :param str publisher_name: @@ -163,10 +163,15 @@ def get_asset_by_name(self, publisher_name, extension_name, version, asset_type, location_id='7529171f-a002-4180-93ba-685f358a0482', version='4.0-preview.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) - - def get_asset(self, extension_id, version, asset_type, account_token=None, accept_default=None): + query_parameters=query_parameters, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_asset(self, extension_id, version, asset_type, account_token=None, accept_default=None, **kwargs): """GetAsset. [Preview API] :param str extension_id: @@ -192,10 +197,15 @@ def get_asset(self, extension_id, version, asset_type, account_token=None, accep location_id='5d545f3d-ef47-488b-8be3-f5ee1517856c', version='4.0-preview.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) - - def get_asset_authenticated(self, publisher_name, extension_name, version, asset_type, account_token=None): + query_parameters=query_parameters, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_asset_authenticated(self, publisher_name, extension_name, version, asset_type, account_token=None, **kwargs): """GetAssetAuthenticated. [Preview API] :param str publisher_name: @@ -221,8 +231,13 @@ def get_asset_authenticated(self, publisher_name, extension_name, version, asset location_id='506aff36-2622-4f70-8063-77cce6366d20', version='4.0-preview.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def associate_azure_publisher(self, publisher_name, azure_publisher_id): """AssociateAzurePublisher. @@ -364,7 +379,7 @@ def get_root_categories(self, product, lcid=None, source=None, product_version=N query_parameters=query_parameters) return self._deserialize('ProductCategoriesResult', response) - def get_certificate(self, publisher_name, extension_name, version=None): + def get_certificate(self, publisher_name, extension_name, version=None, **kwargs): """GetCertificate. [Preview API] :param str publisher_name: @@ -382,8 +397,13 @@ def get_certificate(self, publisher_name, extension_name, version=None): response = self._send(http_method='GET', location_id='e905ad6a-3f1f-4d08-9f6d-7d357ff8b7d0', version='4.0-preview.1', - route_values=route_values) - return self._deserialize('object', response) + route_values=route_values, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_extension_events(self, publisher_name, extension_name, count=None, after_date=None, include=None, include_property=None): """GetExtensionEvents. @@ -652,7 +672,7 @@ def send_notifications(self, notification_data): version='4.0-preview.1', content=content) - def get_package(self, publisher_name, extension_name, version, account_token=None, accept_default=None): + def get_package(self, publisher_name, extension_name, version, account_token=None, accept_default=None, **kwargs): """GetPackage. [Preview API] :param str publisher_name: @@ -678,10 +698,15 @@ def get_package(self, publisher_name, extension_name, version, account_token=Non location_id='7cb576f8-1cae-4c4b-b7b1-e4af5759e965', version='4.0-preview.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) - - def get_asset_with_token(self, publisher_name, extension_name, version, asset_type, asset_token=None, account_token=None, accept_default=None): + query_parameters=query_parameters, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_asset_with_token(self, publisher_name, extension_name, version, asset_type, asset_token=None, account_token=None, accept_default=None, **kwargs): """GetAssetWithToken. [Preview API] :param str publisher_name: @@ -713,8 +738,13 @@ def get_asset_with_token(self, publisher_name, extension_name, version, asset_ty location_id='364415a1-0077-4a41-a7a0-06edd4497492', version='4.0-preview.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def query_publishers(self, publisher_query): """QueryPublishers. @@ -1307,7 +1337,7 @@ def increment_extension_daily_stat(self, publisher_name, extension_name, version route_values=route_values, query_parameters=query_parameters) - def get_verification_log(self, publisher_name, extension_name, version): + def get_verification_log(self, publisher_name, extension_name, version, **kwargs): """GetVerificationLog. [Preview API] :param str publisher_name: @@ -1325,6 +1355,11 @@ def get_verification_log(self, publisher_name, extension_name, version): response = self._send(http_method='GET', location_id='c5523abe-b843-437f-875b-5833064efe4d', version='4.0-preview.1', - route_values=route_values) - return self._deserialize('object', response) + route_values=route_values, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) diff --git a/vsts/vsts/gallery/v4_1/gallery_client.py b/vsts/vsts/gallery/v4_1/gallery_client.py index 433aae3f..24536a77 100644 --- a/vsts/vsts/gallery/v4_1/gallery_client.py +++ b/vsts/vsts/gallery/v4_1/gallery_client.py @@ -134,7 +134,7 @@ def request_acquisition(self, acquisition_request): content=content) return self._deserialize('ExtensionAcquisitionRequest', response) - def get_asset_by_name(self, publisher_name, extension_name, version, asset_type, account_token=None, accept_default=None): + def get_asset_by_name(self, publisher_name, extension_name, version, asset_type, account_token=None, accept_default=None, **kwargs): """GetAssetByName. [Preview API] :param str publisher_name: @@ -163,10 +163,15 @@ def get_asset_by_name(self, publisher_name, extension_name, version, asset_type, location_id='7529171f-a002-4180-93ba-685f358a0482', version='4.1-preview.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) - - def get_asset(self, extension_id, version, asset_type, account_token=None, accept_default=None): + query_parameters=query_parameters, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_asset(self, extension_id, version, asset_type, account_token=None, accept_default=None, **kwargs): """GetAsset. [Preview API] :param str extension_id: @@ -192,10 +197,15 @@ def get_asset(self, extension_id, version, asset_type, account_token=None, accep location_id='5d545f3d-ef47-488b-8be3-f5ee1517856c', version='4.1-preview.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) - - def get_asset_authenticated(self, publisher_name, extension_name, version, asset_type, account_token=None): + query_parameters=query_parameters, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_asset_authenticated(self, publisher_name, extension_name, version, asset_type, account_token=None, **kwargs): """GetAssetAuthenticated. [Preview API] :param str publisher_name: @@ -221,8 +231,13 @@ def get_asset_authenticated(self, publisher_name, extension_name, version, asset location_id='506aff36-2622-4f70-8063-77cce6366d20', version='4.1-preview.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def associate_azure_publisher(self, publisher_name, azure_publisher_id): """AssociateAzurePublisher. @@ -364,7 +379,7 @@ def get_root_categories(self, product, lcid=None, source=None, product_version=N query_parameters=query_parameters) return self._deserialize('ProductCategoriesResult', response) - def get_certificate(self, publisher_name, extension_name, version=None): + def get_certificate(self, publisher_name, extension_name, version=None, **kwargs): """GetCertificate. [Preview API] :param str publisher_name: @@ -382,8 +397,13 @@ def get_certificate(self, publisher_name, extension_name, version=None): response = self._send(http_method='GET', location_id='e905ad6a-3f1f-4d08-9f6d-7d357ff8b7d0', version='4.1-preview.1', - route_values=route_values) - return self._deserialize('object', response) + route_values=route_values, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def create_draft_for_edit_extension(self, publisher_name, extension_name): """CreateDraftForEditExtension. @@ -571,7 +591,7 @@ def add_asset_for_new_extension_draft(self, upload_stream, publisher_name, draft media_type='application/octet-stream') return self._deserialize('ExtensionDraftAsset', response) - def get_asset_from_edit_extension_draft(self, publisher_name, draft_id, asset_type, extension_name): + def get_asset_from_edit_extension_draft(self, publisher_name, draft_id, asset_type, extension_name, **kwargs): """GetAssetFromEditExtensionDraft. [Preview API] :param str publisher_name: @@ -594,10 +614,15 @@ def get_asset_from_edit_extension_draft(self, publisher_name, draft_id, asset_ty location_id='88c0b1c8-b4f1-498a-9b2a-8446ef9f32e7', version='4.1-preview.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) - - def get_asset_from_new_extension_draft(self, publisher_name, draft_id, asset_type): + query_parameters=query_parameters, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_asset_from_new_extension_draft(self, publisher_name, draft_id, asset_type, **kwargs): """GetAssetFromNewExtensionDraft. [Preview API] :param str publisher_name: @@ -615,8 +640,13 @@ def get_asset_from_new_extension_draft(self, publisher_name, draft_id, asset_typ response = self._send(http_method='GET', location_id='88c0b1c8-b4f1-498a-9b2a-8446ef9f32e7', version='4.1-preview.1', - route_values=route_values) - return self._deserialize('object', response) + route_values=route_values, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_extension_events(self, publisher_name, extension_name, count=None, after_date=None, include=None, include_property=None): """GetExtensionEvents. @@ -885,7 +915,7 @@ def send_notifications(self, notification_data): version='4.1-preview.1', content=content) - def get_package(self, publisher_name, extension_name, version, account_token=None, accept_default=None): + def get_package(self, publisher_name, extension_name, version, account_token=None, accept_default=None, **kwargs): """GetPackage. [Preview API] This endpoint gets hit when you download a VSTS extension from the Web UI :param str publisher_name: @@ -911,10 +941,15 @@ def get_package(self, publisher_name, extension_name, version, account_token=Non location_id='7cb576f8-1cae-4c4b-b7b1-e4af5759e965', version='4.1-preview.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) - - def get_asset_with_token(self, publisher_name, extension_name, version, asset_type, asset_token=None, account_token=None, accept_default=None): + query_parameters=query_parameters, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_asset_with_token(self, publisher_name, extension_name, version, asset_type, asset_token=None, account_token=None, accept_default=None, **kwargs): """GetAssetWithToken. [Preview API] :param str publisher_name: @@ -946,8 +981,13 @@ def get_asset_with_token(self, publisher_name, extension_name, version, asset_ty location_id='364415a1-0077-4a41-a7a0-06edd4497492', version='4.1-preview.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def delete_publisher_asset(self, publisher_name, asset_type=None): """DeletePublisherAsset. @@ -967,7 +1007,7 @@ def delete_publisher_asset(self, publisher_name, asset_type=None): route_values=route_values, query_parameters=query_parameters) - def get_publisher_asset(self, publisher_name, asset_type=None): + def get_publisher_asset(self, publisher_name, asset_type=None, **kwargs): """GetPublisherAsset. [Preview API] Get publisher asset like logo as a stream :param str publisher_name: Internal name of the publisher @@ -984,8 +1024,13 @@ def get_publisher_asset(self, publisher_name, asset_type=None): location_id='21143299-34f9-4c62-8ca8-53da691192f9', version='4.1-preview.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def update_publisher_asset(self, upload_stream, publisher_name, asset_type=None, file_name=None): """UpdatePublisherAsset. @@ -1603,7 +1648,7 @@ def increment_extension_daily_stat(self, publisher_name, extension_name, version route_values=route_values, query_parameters=query_parameters) - def get_verification_log(self, publisher_name, extension_name, version): + def get_verification_log(self, publisher_name, extension_name, version, **kwargs): """GetVerificationLog. [Preview API] :param str publisher_name: @@ -1621,6 +1666,11 @@ def get_verification_log(self, publisher_name, extension_name, version): response = self._send(http_method='GET', location_id='c5523abe-b843-437f-875b-5833064efe4d', version='4.1-preview.1', - route_values=route_values) - return self._deserialize('object', response) + route_values=route_values, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) diff --git a/vsts/vsts/git/v4_0/git_client_base.py b/vsts/vsts/git/v4_0/git_client_base.py index 1c714b6b..f174a315 100644 --- a/vsts/vsts/git/v4_0/git_client_base.py +++ b/vsts/vsts/git/v4_0/git_client_base.py @@ -96,7 +96,7 @@ def get_blob(self, repository_id, sha1, project=None, download=None, file_name=N query_parameters=query_parameters) return self._deserialize('GitBlobRef', response) - def get_blob_content(self, repository_id, sha1, project=None, download=None, file_name=None): + def get_blob_content(self, repository_id, sha1, project=None, download=None, file_name=None, **kwargs): """GetBlobContent. Gets a single blob. :param str repository_id: @@ -122,10 +122,15 @@ def get_blob_content(self, repository_id, sha1, project=None, download=None, fil location_id='7b28e929-2c99-405d-9c5c-6167a06e6816', version='4.0', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) - - def get_blobs_zip(self, blob_ids, repository_id, project=None, filename=None): + query_parameters=query_parameters, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_blobs_zip(self, blob_ids, repository_id, project=None, filename=None, **kwargs): """GetBlobsZip. Gets one or more blobs in a zip file download. :param [str] blob_ids: @@ -148,10 +153,15 @@ def get_blobs_zip(self, blob_ids, repository_id, project=None, filename=None): version='4.0', route_values=route_values, query_parameters=query_parameters, - content=content) - return self._deserialize('object', response) - - def get_blob_zip(self, repository_id, sha1, project=None, download=None, file_name=None): + content=content, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_blob_zip(self, repository_id, sha1, project=None, download=None, file_name=None, **kwargs): """GetBlobZip. Gets a single blob. :param str repository_id: @@ -177,8 +187,13 @@ def get_blob_zip(self, repository_id, sha1, project=None, download=None, file_na location_id='7b28e929-2c99-405d-9c5c-6167a06e6816', version='4.0', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_branch(self, repository_id, name, project=None, base_version_descriptor=None): """GetBranch. @@ -813,7 +828,7 @@ def get_item(self, repository_id, path, project=None, scope_path=None, recursion query_parameters=query_parameters) return self._deserialize('GitItem', response) - def get_item_content(self, repository_id, path, project=None, scope_path=None, recursion_level=None, include_content_metadata=None, latest_processed_change=None, download=None, version_descriptor=None): + def get_item_content(self, repository_id, path, project=None, scope_path=None, recursion_level=None, include_content_metadata=None, latest_processed_change=None, download=None, version_descriptor=None, **kwargs): """GetItemContent. Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download. :param str repository_id: @@ -856,8 +871,13 @@ def get_item_content(self, repository_id, path, project=None, scope_path=None, r location_id='fb93c0db-47ed-4a31-8c20-47552878fb44', version='4.0', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_items(self, repository_id, project=None, scope_path=None, recursion_level=None, include_content_metadata=None, latest_processed_change=None, download=None, include_links=None, version_descriptor=None): """GetItems. @@ -905,7 +925,7 @@ def get_items(self, repository_id, project=None, scope_path=None, recursion_leve query_parameters=query_parameters) return self._deserialize('[GitItem]', self._unwrap_collection(response)) - def get_item_text(self, repository_id, path, project=None, scope_path=None, recursion_level=None, include_content_metadata=None, latest_processed_change=None, download=None, version_descriptor=None): + def get_item_text(self, repository_id, path, project=None, scope_path=None, recursion_level=None, include_content_metadata=None, latest_processed_change=None, download=None, version_descriptor=None, **kwargs): """GetItemText. Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download. :param str repository_id: @@ -948,10 +968,15 @@ def get_item_text(self, repository_id, path, project=None, scope_path=None, recu location_id='fb93c0db-47ed-4a31-8c20-47552878fb44', version='4.0', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) - - def get_item_zip(self, repository_id, path, project=None, scope_path=None, recursion_level=None, include_content_metadata=None, latest_processed_change=None, download=None, version_descriptor=None): + query_parameters=query_parameters, + accept_media_type='text/plain') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_item_zip(self, repository_id, path, project=None, scope_path=None, recursion_level=None, include_content_metadata=None, latest_processed_change=None, download=None, version_descriptor=None, **kwargs): """GetItemZip. Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download. :param str repository_id: @@ -994,8 +1019,13 @@ def get_item_zip(self, repository_id, path, project=None, scope_path=None, recur location_id='fb93c0db-47ed-4a31-8c20-47552878fb44', version='4.0', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_items_batch(self, request_data, repository_id, project=None): """GetItemsBatch. @@ -1068,7 +1098,7 @@ def delete_attachment(self, file_name, repository_id, pull_request_id, project=N version='4.0-preview.1', route_values=route_values) - def get_attachment_content(self, file_name, repository_id, pull_request_id, project=None): + def get_attachment_content(self, file_name, repository_id, pull_request_id, project=None, **kwargs): """GetAttachmentContent. [Preview API] :param str file_name: @@ -1089,8 +1119,13 @@ def get_attachment_content(self, file_name, repository_id, pull_request_id, proj response = self._send(http_method='GET', location_id='965d9361-878b-413b-a494-45d5b5fd8ab7', version='4.0-preview.1', - route_values=route_values) - return self._deserialize('object', response) + route_values=route_values, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_attachments(self, repository_id, pull_request_id, project=None): """GetAttachments. @@ -1113,7 +1148,7 @@ def get_attachments(self, repository_id, pull_request_id, project=None): route_values=route_values) return self._deserialize('[Attachment]', self._unwrap_collection(response)) - def get_attachment_zip(self, file_name, repository_id, pull_request_id, project=None): + def get_attachment_zip(self, file_name, repository_id, pull_request_id, project=None, **kwargs): """GetAttachmentZip. [Preview API] :param str file_name: @@ -1134,8 +1169,13 @@ def get_attachment_zip(self, file_name, repository_id, pull_request_id, project= response = self._send(http_method='GET', location_id='965d9361-878b-413b-a494-45d5b5fd8ab7', version='4.0-preview.1', - route_values=route_values) - return self._deserialize('object', response) + route_values=route_values, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def create_like(self, repository_id, pull_request_id, thread_id, comment_id, project=None): """CreateLike. @@ -2763,7 +2803,7 @@ def get_tree(self, repository_id, sha1, project=None, project_id=None, recursive query_parameters=query_parameters) return self._deserialize('GitTreeRef', response) - def get_tree_zip(self, repository_id, sha1, project=None, project_id=None, recursive=None, file_name=None): + def get_tree_zip(self, repository_id, sha1, project=None, project_id=None, recursive=None, file_name=None, **kwargs): """GetTreeZip. :param str repository_id: :param str sha1: @@ -2791,6 +2831,11 @@ def get_tree_zip(self, repository_id, sha1, project=None, project_id=None, recur location_id='729f6437-6f92-44ec-8bee-273a7111063c', version='4.0', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) diff --git a/vsts/vsts/git/v4_1/git_client_base.py b/vsts/vsts/git/v4_1/git_client_base.py index 37802cf2..e91e63b4 100644 --- a/vsts/vsts/git/v4_1/git_client_base.py +++ b/vsts/vsts/git/v4_1/git_client_base.py @@ -96,7 +96,7 @@ def get_blob(self, repository_id, sha1, project=None, download=None, file_name=N query_parameters=query_parameters) return self._deserialize('GitBlobRef', response) - def get_blob_content(self, repository_id, sha1, project=None, download=None, file_name=None): + def get_blob_content(self, repository_id, sha1, project=None, download=None, file_name=None, **kwargs): """GetBlobContent. Get a single blob. :param str repository_id: The name or ID of the repository. @@ -122,10 +122,15 @@ def get_blob_content(self, repository_id, sha1, project=None, download=None, fil location_id='7b28e929-2c99-405d-9c5c-6167a06e6816', version='4.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) - - def get_blobs_zip(self, blob_ids, repository_id, project=None, filename=None): + query_parameters=query_parameters, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_blobs_zip(self, blob_ids, repository_id, project=None, filename=None, **kwargs): """GetBlobsZip. Gets one or more blobs in a zip file download. :param [str] blob_ids: Blob IDs (SHA1 hashes) to be returned in the zip file. @@ -148,10 +153,15 @@ def get_blobs_zip(self, blob_ids, repository_id, project=None, filename=None): version='4.1', route_values=route_values, query_parameters=query_parameters, - content=content) - return self._deserialize('object', response) - - def get_blob_zip(self, repository_id, sha1, project=None, download=None, file_name=None): + content=content, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_blob_zip(self, repository_id, sha1, project=None, download=None, file_name=None, **kwargs): """GetBlobZip. Get a single blob. :param str repository_id: The name or ID of the repository. @@ -177,8 +187,13 @@ def get_blob_zip(self, repository_id, sha1, project=None, download=None, file_na location_id='7b28e929-2c99-405d-9c5c-6167a06e6816', version='4.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_branch(self, repository_id, name, project=None, base_version_descriptor=None): """GetBranch. @@ -795,7 +810,7 @@ def get_item(self, repository_id, path, project=None, scope_path=None, recursion query_parameters=query_parameters) return self._deserialize('GitItem', response) - def get_item_content(self, repository_id, path, project=None, scope_path=None, recursion_level=None, include_content_metadata=None, latest_processed_change=None, download=None, version_descriptor=None, include_content=None): + def get_item_content(self, repository_id, path, project=None, scope_path=None, recursion_level=None, include_content_metadata=None, latest_processed_change=None, download=None, version_descriptor=None, include_content=None, **kwargs): """GetItemContent. Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content, which is always returned as a download. :param str repository_id: The Id of the repository. @@ -841,8 +856,13 @@ def get_item_content(self, repository_id, path, project=None, scope_path=None, r location_id='fb93c0db-47ed-4a31-8c20-47552878fb44', version='4.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_items(self, repository_id, project=None, scope_path=None, recursion_level=None, include_content_metadata=None, latest_processed_change=None, download=None, include_links=None, version_descriptor=None): """GetItems. @@ -890,7 +910,7 @@ def get_items(self, repository_id, project=None, scope_path=None, recursion_leve query_parameters=query_parameters) return self._deserialize('[GitItem]', self._unwrap_collection(response)) - def get_item_text(self, repository_id, path, project=None, scope_path=None, recursion_level=None, include_content_metadata=None, latest_processed_change=None, download=None, version_descriptor=None, include_content=None): + def get_item_text(self, repository_id, path, project=None, scope_path=None, recursion_level=None, include_content_metadata=None, latest_processed_change=None, download=None, version_descriptor=None, include_content=None, **kwargs): """GetItemText. Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content, which is always returned as a download. :param str repository_id: The Id of the repository. @@ -936,10 +956,15 @@ def get_item_text(self, repository_id, path, project=None, scope_path=None, recu location_id='fb93c0db-47ed-4a31-8c20-47552878fb44', version='4.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) - - def get_item_zip(self, repository_id, path, project=None, scope_path=None, recursion_level=None, include_content_metadata=None, latest_processed_change=None, download=None, version_descriptor=None, include_content=None): + query_parameters=query_parameters, + accept_media_type='text/plain') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_item_zip(self, repository_id, path, project=None, scope_path=None, recursion_level=None, include_content_metadata=None, latest_processed_change=None, download=None, version_descriptor=None, include_content=None, **kwargs): """GetItemZip. Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content, which is always returned as a download. :param str repository_id: The Id of the repository. @@ -985,8 +1010,13 @@ def get_item_zip(self, repository_id, path, project=None, scope_path=None, recur location_id='fb93c0db-47ed-4a31-8c20-47552878fb44', version='4.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_items_batch(self, request_data, repository_id, project=None): """GetItemsBatch. @@ -1091,7 +1121,7 @@ def delete_attachment(self, file_name, repository_id, pull_request_id, project=N version='4.1-preview.1', route_values=route_values) - def get_attachment_content(self, file_name, repository_id, pull_request_id, project=None): + def get_attachment_content(self, file_name, repository_id, pull_request_id, project=None, **kwargs): """GetAttachmentContent. [Preview API] Get the file content of a pull request attachment. :param str file_name: The name of the attachment. @@ -1112,8 +1142,13 @@ def get_attachment_content(self, file_name, repository_id, pull_request_id, proj response = self._send(http_method='GET', location_id='965d9361-878b-413b-a494-45d5b5fd8ab7', version='4.1-preview.1', - route_values=route_values) - return self._deserialize('object', response) + route_values=route_values, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_attachments(self, repository_id, pull_request_id, project=None): """GetAttachments. @@ -1136,7 +1171,7 @@ def get_attachments(self, repository_id, pull_request_id, project=None): route_values=route_values) return self._deserialize('[Attachment]', self._unwrap_collection(response)) - def get_attachment_zip(self, file_name, repository_id, pull_request_id, project=None): + def get_attachment_zip(self, file_name, repository_id, pull_request_id, project=None, **kwargs): """GetAttachmentZip. [Preview API] Get the file content of a pull request attachment. :param str file_name: The name of the attachment. @@ -1157,8 +1192,13 @@ def get_attachment_zip(self, file_name, repository_id, pull_request_id, project= response = self._send(http_method='GET', location_id='965d9361-878b-413b-a494-45d5b5fd8ab7', version='4.1-preview.1', - route_values=route_values) - return self._deserialize('object', response) + route_values=route_values, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def create_like(self, repository_id, pull_request_id, thread_id, comment_id, project=None): """CreateLike. @@ -2991,7 +3031,7 @@ def get_tree(self, repository_id, sha1, project=None, project_id=None, recursive query_parameters=query_parameters) return self._deserialize('GitTreeRef', response) - def get_tree_zip(self, repository_id, sha1, project=None, project_id=None, recursive=None, file_name=None): + def get_tree_zip(self, repository_id, sha1, project=None, project_id=None, recursive=None, file_name=None, **kwargs): """GetTreeZip. The Tree endpoint returns the collection of objects underneath the specified tree. Trees are folders in a Git repository. :param str repository_id: Repository Id. @@ -3020,6 +3060,11 @@ def get_tree_zip(self, repository_id, sha1, project=None, project_id=None, recur location_id='729f6437-6f92-44ec-8bee-273a7111063c', version='4.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) diff --git a/vsts/vsts/licensing/v4_0/licensing_client.py b/vsts/vsts/licensing/v4_0/licensing_client.py index efe2b865..aa151162 100644 --- a/vsts/vsts/licensing/v4_0/licensing_client.py +++ b/vsts/vsts/licensing/v4_0/licensing_client.py @@ -35,15 +35,20 @@ def get_extension_license_usage(self): version='4.0-preview.1') return self._deserialize('[AccountLicenseExtensionUsage]', self._unwrap_collection(response)) - def get_certificate(self): + def get_certificate(self, **kwargs): """GetCertificate. [Preview API] :rtype: object """ response = self._send(http_method='GET', location_id='2e0dbce7-a327-4bc0-a291-056139393f6d', - version='4.0-preview.1') - return self._deserialize('object', response) + version='4.0-preview.1', + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_client_rights(self, right_name=None, product_version=None, edition=None, rel_type=None, include_certificate=None, canary=None, machine_id=None): """GetClientRights. diff --git a/vsts/vsts/licensing/v4_1/licensing_client.py b/vsts/vsts/licensing/v4_1/licensing_client.py index b23da943..526afdeb 100644 --- a/vsts/vsts/licensing/v4_1/licensing_client.py +++ b/vsts/vsts/licensing/v4_1/licensing_client.py @@ -35,15 +35,20 @@ def get_extension_license_usage(self): version='4.1-preview.1') return self._deserialize('[AccountLicenseExtensionUsage]', self._unwrap_collection(response)) - def get_certificate(self): + def get_certificate(self, **kwargs): """GetCertificate. [Preview API] :rtype: object """ response = self._send(http_method='GET', location_id='2e0dbce7-a327-4bc0-a291-056139393f6d', - version='4.1-preview.1') - return self._deserialize('object', response) + version='4.1-preview.1', + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_client_rights(self, right_name=None, product_version=None, edition=None, rel_type=None, include_certificate=None, canary=None, machine_id=None): """GetClientRights. diff --git a/vsts/vsts/npm/v4_1/npm_client.py b/vsts/vsts/npm/v4_1/npm_client.py index 141118c2..8ab09b36 100644 --- a/vsts/vsts/npm/v4_1/npm_client.py +++ b/vsts/vsts/npm/v4_1/npm_client.py @@ -1,4 +1,4 @@ -# -------------------------------------------------------------------------------------------- +# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- @@ -25,7 +25,7 @@ def __init__(self, base_url=None, creds=None): resource_area_identifier = '4c83cfc1-f33a-477e-a789-29d38ffca52e' - def get_content_scoped_package(self, feed_id, package_scope, unscoped_package_name, package_version): + def get_content_scoped_package(self, feed_id, package_scope, unscoped_package_name, package_version, **kwargs): """GetContentScopedPackage. [Preview API] :param str feed_id: @@ -46,10 +46,15 @@ def get_content_scoped_package(self, feed_id, package_scope, unscoped_package_na response = self._send(http_method='GET', location_id='09a4eafd-123a-495c-979c-0eda7bdb9a14', version='4.1-preview.1', - route_values=route_values) - return self._deserialize('object', response) + route_values=route_values, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) - def get_content_unscoped_package(self, feed_id, package_name, package_version): + def get_content_unscoped_package(self, feed_id, package_name, package_version, **kwargs): """GetContentUnscopedPackage. [Preview API] :param str feed_id: @@ -67,8 +72,13 @@ def get_content_unscoped_package(self, feed_id, package_name, package_version): response = self._send(http_method='GET', location_id='75caa482-cb1e-47cd-9f2c-c048a4b7a43e', version='4.1-preview.1', - route_values=route_values) - return self._deserialize('object', response) + route_values=route_values, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def update_packages(self, batch_request, feed_id): """UpdatePackages. @@ -86,7 +96,7 @@ def update_packages(self, batch_request, feed_id): route_values=route_values, content=content) - def get_readme_scoped_package(self, feed_id, package_scope, unscoped_package_name, package_version): + def get_readme_scoped_package(self, feed_id, package_scope, unscoped_package_name, package_version, **kwargs): """GetReadmeScopedPackage. [Preview API] :param str feed_id: @@ -107,10 +117,15 @@ def get_readme_scoped_package(self, feed_id, package_scope, unscoped_package_nam response = self._send(http_method='GET', location_id='6d4db777-7e4a-43b2-afad-779a1d197301', version='4.1-preview.1', - route_values=route_values) - return self._deserialize('object', response) + route_values=route_values, + accept_media_type='text/plain') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) - def get_readme_unscoped_package(self, feed_id, package_name, package_version): + def get_readme_unscoped_package(self, feed_id, package_name, package_version, **kwargs): """GetReadmeUnscopedPackage. [Preview API] :param str feed_id: @@ -128,8 +143,13 @@ def get_readme_unscoped_package(self, feed_id, package_name, package_version): response = self._send(http_method='GET', location_id='1099a396-b310-41d4-a4b6-33d134ce3fcf', version='4.1-preview.1', - route_values=route_values) - return self._deserialize('object', response) + route_values=route_values, + accept_media_type='text/plain') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def delete_scoped_package_version_from_recycle_bin(self, feed_id, package_scope, unscoped_package_name, package_version): """DeleteScopedPackageVersionFromRecycleBin. diff --git a/vsts/vsts/release/v4_0/release_client.py b/vsts/vsts/release/v4_0/release_client.py index 78928aef..2ba06910 100644 --- a/vsts/vsts/release/v4_0/release_client.py +++ b/vsts/vsts/release/v4_0/release_client.py @@ -294,7 +294,7 @@ def get_release_definition(self, project, definition_id, property_filters=None): query_parameters=query_parameters) return self._deserialize('ReleaseDefinition', response) - def get_release_definition_revision(self, project, definition_id, revision): + def get_release_definition_revision(self, project, definition_id, revision, **kwargs): """GetReleaseDefinitionRevision. [Preview API] Get release definition of a given revision. :param str project: Project ID or project name @@ -314,8 +314,13 @@ def get_release_definition_revision(self, project, definition_id, revision): location_id='d8f96f24-8ea7-4cb6-baab-2df8fc515665', version='4.0-preview.3', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='text/plain') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_release_definitions(self, project, search_text=None, expand=None, artifact_type=None, artifact_source_id=None, top=None, continuation_token=None, query_order=None, path=None, is_exact_name_match=None, tag_filter=None, property_filters=None, definition_id_filter=None): """GetReleaseDefinitions. @@ -791,7 +796,7 @@ def get_issues(self, project, build_id, source_id=None): query_parameters=query_parameters) return self._deserialize('[AutoTriggerIssue]', self._unwrap_collection(response)) - def get_log(self, project, release_id, environment_id, task_id, attempt_id=None): + def get_log(self, project, release_id, environment_id, task_id, attempt_id=None, **kwargs): """GetLog. [Preview API] Gets logs :param str project: Project ID or project name @@ -817,10 +822,15 @@ def get_log(self, project, release_id, environment_id, task_id, attempt_id=None) location_id='e71ba1ed-c0a4-4a28-a61f-2dd5f68cf3fd', version='4.0-preview.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) - - def get_logs(self, project, release_id): + query_parameters=query_parameters, + accept_media_type='text/plain') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_logs(self, project, release_id, **kwargs): """GetLogs. [Preview API] Get logs for a release Id. :param str project: Project ID or project name @@ -835,10 +845,15 @@ def get_logs(self, project, release_id): response = self._send(http_method='GET', location_id='c37fbab5-214b-48e4-a55b-cb6b4f6e4038', version='4.0-preview.2', - route_values=route_values) - return self._deserialize('object', response) - - def get_task_log(self, project, release_id, environment_id, release_deploy_phase_id, task_id): + route_values=route_values, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_task_log(self, project, release_id, environment_id, release_deploy_phase_id, task_id, **kwargs): """GetTaskLog. [Preview API] Gets the task log of a release as a plain text file. :param str project: Project ID or project name @@ -862,8 +877,13 @@ def get_task_log(self, project, release_id, environment_id, release_deploy_phase response = self._send(http_method='GET', location_id='17c91af7-09fd-4256-bff1-c24ee4f73bc0', version='4.0-preview.2', - route_values=route_values) - return self._deserialize('object', response) + route_values=route_values, + accept_media_type='text/plain') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_manual_intervention(self, project, release_id, manual_intervention_id): """GetManualIntervention. @@ -1138,7 +1158,7 @@ def get_release_definition_summary(self, project, definition_id, release_count, query_parameters=query_parameters) return self._deserialize('ReleaseDefinitionSummary', response) - def get_release_revision(self, project, release_id, definition_snapshot_revision): + def get_release_revision(self, project, release_id, definition_snapshot_revision, **kwargs): """GetReleaseRevision. [Preview API] Get release for a given revision number. :param str project: Project ID or project name @@ -1158,8 +1178,13 @@ def get_release_revision(self, project, release_id, definition_snapshot_revision location_id='a166fde7-27ad-408e-ba75-703c2cc9d500', version='4.0-preview.4', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='text/plain') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def undelete_release(self, project, release_id, comment): """UndeleteRelease. @@ -1257,7 +1282,7 @@ def update_release_settings(self, release_settings, project): content=content) return self._deserialize('ReleaseSettings', response) - def get_definition_revision(self, project, definition_id, revision): + def get_definition_revision(self, project, definition_id, revision, **kwargs): """GetDefinitionRevision. [Preview API] :param str project: Project ID or project name @@ -1275,8 +1300,13 @@ def get_definition_revision(self, project, definition_id, revision): response = self._send(http_method='GET', location_id='258b82e0-9d41-43f3-86d6-fef14ddd44bc', version='4.0-preview.1', - route_values=route_values) - return self._deserialize('object', response) + route_values=route_values, + accept_media_type='text/plain') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_release_definition_history(self, project, definition_id): """GetReleaseDefinitionHistory. diff --git a/vsts/vsts/release/v4_1/release_client.py b/vsts/vsts/release/v4_1/release_client.py index ee5c8f05..7c4b252a 100644 --- a/vsts/vsts/release/v4_1/release_client.py +++ b/vsts/vsts/release/v4_1/release_client.py @@ -88,7 +88,7 @@ def update_release_approval(self, approval, project, approval_id): content=content) return self._deserialize('ReleaseApproval', response) - def get_task_attachment_content(self, project, release_id, environment_id, attempt_id, timeline_id, record_id, type, name): + def get_task_attachment_content(self, project, release_id, environment_id, attempt_id, timeline_id, record_id, type, name, **kwargs): """GetTaskAttachmentContent. [Preview API] :param str project: Project ID or project name @@ -121,8 +121,13 @@ def get_task_attachment_content(self, project, release_id, environment_id, attem response = self._send(http_method='GET', location_id='c4071f6d-3697-46ca-858e-8b10ff09e52f', version='4.1-preview.1', - route_values=route_values) - return self._deserialize('object', response) + route_values=route_values, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_task_attachments(self, project, release_id, environment_id, attempt_id, timeline_id, type): """GetTaskAttachments. @@ -380,7 +385,7 @@ def update_release_environment(self, environment_update_data, project, release_i content=content) return self._deserialize('ReleaseEnvironment', response) - def get_logs(self, project, release_id): + def get_logs(self, project, release_id, **kwargs): """GetLogs. [Preview API] Get logs for a release Id. :param str project: Project ID or project name @@ -395,10 +400,15 @@ def get_logs(self, project, release_id): response = self._send(http_method='GET', location_id='c37fbab5-214b-48e4-a55b-cb6b4f6e4038', version='4.1-preview.2', - route_values=route_values) - return self._deserialize('object', response) + route_values=route_values, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) - def get_task_log(self, project, release_id, environment_id, release_deploy_phase_id, task_id, start_line=None, end_line=None): + def get_task_log(self, project, release_id, environment_id, release_deploy_phase_id, task_id, start_line=None, end_line=None, **kwargs): """GetTaskLog. [Preview API] Gets the task log of a release as a plain text file. :param str project: Project ID or project name @@ -430,8 +440,13 @@ def get_task_log(self, project, release_id, environment_id, release_deploy_phase location_id='17c91af7-09fd-4256-bff1-c24ee4f73bc0', version='4.1-preview.2', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='text/plain') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_manual_intervention(self, project, release_id, manual_intervention_id): """GetManualIntervention. @@ -651,7 +666,7 @@ def get_release_definition_summary(self, project, definition_id, release_count, query_parameters=query_parameters) return self._deserialize('ReleaseDefinitionSummary', response) - def get_release_revision(self, project, release_id, definition_snapshot_revision): + def get_release_revision(self, project, release_id, definition_snapshot_revision, **kwargs): """GetReleaseRevision. [Preview API] Get release for a given revision number. :param str project: Project ID or project name @@ -671,8 +686,13 @@ def get_release_revision(self, project, release_id, definition_snapshot_revision location_id='a166fde7-27ad-408e-ba75-703c2cc9d500', version='4.1-preview.6', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='text/plain') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def update_release(self, release, project, release_id): """UpdateRelease. @@ -716,7 +736,7 @@ def update_release_resource(self, release_update_metadata, project, release_id): content=content) return self._deserialize('Release', response) - def get_definition_revision(self, project, definition_id, revision): + def get_definition_revision(self, project, definition_id, revision, **kwargs): """GetDefinitionRevision. [Preview API] Get release definition for a given definitionId and revision :param str project: Project ID or project name @@ -734,8 +754,13 @@ def get_definition_revision(self, project, definition_id, revision): response = self._send(http_method='GET', location_id='258b82e0-9d41-43f3-86d6-fef14ddd44bc', version='4.1-preview.1', - route_values=route_values) - return self._deserialize('object', response) + route_values=route_values, + accept_media_type='text/plain') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_release_definition_history(self, project, definition_id): """GetReleaseDefinitionHistory. diff --git a/vsts/vsts/task/v4_0/task_client.py b/vsts/vsts/task/v4_0/task_client.py index 77dd33ea..1d18c989 100644 --- a/vsts/vsts/task/v4_0/task_client.py +++ b/vsts/vsts/task/v4_0/task_client.py @@ -119,7 +119,7 @@ def get_attachment(self, scope_identifier, hub_name, plan_id, timeline_id, recor route_values=route_values) return self._deserialize('TaskAttachment', response) - def get_attachment_content(self, scope_identifier, hub_name, plan_id, timeline_id, record_id, type, name): + def get_attachment_content(self, scope_identifier, hub_name, plan_id, timeline_id, record_id, type, name, **kwargs): """GetAttachmentContent. [Preview API] :param str scope_identifier: The project GUID to scope the request @@ -149,8 +149,13 @@ def get_attachment_content(self, scope_identifier, hub_name, plan_id, timeline_i response = self._send(http_method='GET', location_id='7898f959-9cdf-4096-b29e-7f293031629e', version='4.0-preview.1', - route_values=route_values) - return self._deserialize('object', response) + route_values=route_values, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_attachments(self, scope_identifier, hub_name, plan_id, timeline_id, record_id, type): """GetAttachments. diff --git a/vsts/vsts/task/v4_1/task_client.py b/vsts/vsts/task/v4_1/task_client.py index f8d7ef3b..fd618acb 100644 --- a/vsts/vsts/task/v4_1/task_client.py +++ b/vsts/vsts/task/v4_1/task_client.py @@ -119,7 +119,7 @@ def get_attachment(self, scope_identifier, hub_name, plan_id, timeline_id, recor route_values=route_values) return self._deserialize('TaskAttachment', response) - def get_attachment_content(self, scope_identifier, hub_name, plan_id, timeline_id, record_id, type, name): + def get_attachment_content(self, scope_identifier, hub_name, plan_id, timeline_id, record_id, type, name, **kwargs): """GetAttachmentContent. [Preview API] :param str scope_identifier: The project GUID to scope the request @@ -149,8 +149,13 @@ def get_attachment_content(self, scope_identifier, hub_name, plan_id, timeline_i response = self._send(http_method='GET', location_id='7898f959-9cdf-4096-b29e-7f293031629e', version='4.1-preview.1', - route_values=route_values) - return self._deserialize('object', response) + route_values=route_values, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_attachments(self, scope_identifier, hub_name, plan_id, timeline_id, record_id, type): """GetAttachments. diff --git a/vsts/vsts/task_agent/v4_0/task_agent_client.py b/vsts/vsts/task_agent/v4_0/task_agent_client.py index a9289e35..b88abe6c 100644 --- a/vsts/vsts/task_agent/v4_0/task_agent_client.py +++ b/vsts/vsts/task_agent/v4_0/task_agent_client.py @@ -1107,7 +1107,7 @@ def get_agent_pool_maintenance_job(self, pool_id, job_id): route_values=route_values) return self._deserialize('TaskAgentPoolMaintenanceJob', response) - def get_agent_pool_maintenance_job_logs(self, pool_id, job_id): + def get_agent_pool_maintenance_job_logs(self, pool_id, job_id, **kwargs): """GetAgentPoolMaintenanceJobLogs. [Preview API] :param int pool_id: @@ -1122,8 +1122,13 @@ def get_agent_pool_maintenance_job_logs(self, pool_id, job_id): response = self._send(http_method='GET', location_id='15e7ab6e-abce-4601-a6d8-e111fe148f46', version='4.0-preview.1', - route_values=route_values) - return self._deserialize('object', response) + route_values=route_values, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_agent_pool_maintenance_jobs(self, pool_id, definition_id=None): """GetAgentPoolMaintenanceJobs. @@ -1562,7 +1567,7 @@ def delete_secure_file(self, project, secure_file_id): version='4.0-preview.1', route_values=route_values) - def download_secure_file(self, project, secure_file_id, ticket, download=None): + def download_secure_file(self, project, secure_file_id, ticket, download=None, **kwargs): """DownloadSecureFile. [Preview API] Download a secure file by Id :param str project: Project ID or project name @@ -1585,8 +1590,13 @@ def download_secure_file(self, project, secure_file_id, ticket, download=None): location_id='adcfd8bc-b184-43ba-bd84-7c8c6a2ff421', version='4.0-preview.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_secure_file(self, project, secure_file_id, include_download_ticket=None): """GetSecureFile. @@ -2012,7 +2022,7 @@ def get_task_group(self, project, task_group_id, version_spec, expanded=None): query_parameters=query_parameters) return self._deserialize('TaskGroup', response) - def get_task_group_revision(self, project, task_group_id, revision): + def get_task_group_revision(self, project, task_group_id, revision, **kwargs): """GetTaskGroupRevision. [Preview API] :param str project: Project ID or project name @@ -2032,8 +2042,13 @@ def get_task_group_revision(self, project, task_group_id, revision): location_id='6c08ffbf-dbf1-4f9a-94e5-a1cbd47005e7', version='4.0-preview.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='text/plain') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_task_groups(self, project, task_group_id=None, expanded=None, task_id_filter=None, deleted=None): """GetTaskGroups. @@ -2161,7 +2176,7 @@ def delete_task_definition(self, task_id): version='4.0', route_values=route_values) - def get_task_content_zip(self, task_id, version_string, visibility=None, scope_local=None): + def get_task_content_zip(self, task_id, version_string, visibility=None, scope_local=None, **kwargs): """GetTaskContentZip. :param str task_id: :param str version_string: @@ -2183,8 +2198,13 @@ def get_task_content_zip(self, task_id, version_string, visibility=None, scope_l location_id='60aac929-f0cd-4bc8-9ce4-6b30e8f1b1bd', version='4.0', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_task_definition(self, task_id, version_string, visibility=None, scope_local=None): """GetTaskDefinition. diff --git a/vsts/vsts/test/v4_0/test_client.py b/vsts/vsts/test/v4_0/test_client.py index 641cb417..8ba88027 100644 --- a/vsts/vsts/test/v4_0/test_client.py +++ b/vsts/vsts/test/v4_0/test_client.py @@ -107,7 +107,7 @@ def create_test_result_attachment(self, attachment_request_model, project, run_i content=content) return self._deserialize('TestAttachmentReference', response) - def get_test_result_attachment_content(self, project, run_id, test_case_result_id, attachment_id): + def get_test_result_attachment_content(self, project, run_id, test_case_result_id, attachment_id, **kwargs): """GetTestResultAttachmentContent. [Preview API] Returns a test result attachment :param str project: Project ID or project name @@ -128,8 +128,13 @@ def get_test_result_attachment_content(self, project, run_id, test_case_result_i response = self._send(http_method='GET', location_id='2bffebe9-2f0f-4639-9af8-56129e9fed2d', version='4.0-preview.1', - route_values=route_values) - return self._deserialize('object', response) + route_values=route_values, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_test_result_attachments(self, project, run_id, test_case_result_id): """GetTestResultAttachments. @@ -152,7 +157,7 @@ def get_test_result_attachments(self, project, run_id, test_case_result_id): route_values=route_values) return self._deserialize('[TestAttachment]', self._unwrap_collection(response)) - def get_test_result_attachment_zip(self, project, run_id, test_case_result_id, attachment_id): + def get_test_result_attachment_zip(self, project, run_id, test_case_result_id, attachment_id, **kwargs): """GetTestResultAttachmentZip. [Preview API] Returns a test result attachment :param str project: Project ID or project name @@ -173,8 +178,13 @@ def get_test_result_attachment_zip(self, project, run_id, test_case_result_id, a response = self._send(http_method='GET', location_id='2bffebe9-2f0f-4639-9af8-56129e9fed2d', version='4.0-preview.1', - route_values=route_values) - return self._deserialize('object', response) + route_values=route_values, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def create_test_run_attachment(self, attachment_request_model, project, run_id): """CreateTestRunAttachment. @@ -197,7 +207,7 @@ def create_test_run_attachment(self, attachment_request_model, project, run_id): content=content) return self._deserialize('TestAttachmentReference', response) - def get_test_run_attachment_content(self, project, run_id, attachment_id): + def get_test_run_attachment_content(self, project, run_id, attachment_id, **kwargs): """GetTestRunAttachmentContent. [Preview API] Returns a test run attachment :param str project: Project ID or project name @@ -215,8 +225,13 @@ def get_test_run_attachment_content(self, project, run_id, attachment_id): response = self._send(http_method='GET', location_id='4f004af4-a507-489c-9b13-cb62060beb11', version='4.0-preview.1', - route_values=route_values) - return self._deserialize('object', response) + route_values=route_values, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_test_run_attachments(self, project, run_id): """GetTestRunAttachments. @@ -236,7 +251,7 @@ def get_test_run_attachments(self, project, run_id): route_values=route_values) return self._deserialize('[TestAttachment]', self._unwrap_collection(response)) - def get_test_run_attachment_zip(self, project, run_id, attachment_id): + def get_test_run_attachment_zip(self, project, run_id, attachment_id, **kwargs): """GetTestRunAttachmentZip. [Preview API] Returns a test run attachment :param str project: Project ID or project name @@ -254,8 +269,13 @@ def get_test_run_attachment_zip(self, project, run_id, attachment_id): response = self._send(http_method='GET', location_id='4f004af4-a507-489c-9b13-cb62060beb11', version='4.0-preview.1', - route_values=route_values) - return self._deserialize('object', response) + route_values=route_values, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_bugs_linked_to_test_result(self, project, run_id, test_case_result_id): """GetBugsLinkedToTestResult. diff --git a/vsts/vsts/test/v4_1/test_client.py b/vsts/vsts/test/v4_1/test_client.py index ac5ae58b..02ca78f8 100644 --- a/vsts/vsts/test/v4_1/test_client.py +++ b/vsts/vsts/test/v4_1/test_client.py @@ -107,7 +107,7 @@ def create_test_result_attachment(self, attachment_request_model, project, run_i content=content) return self._deserialize('TestAttachmentReference', response) - def get_test_result_attachment_content(self, project, run_id, test_case_result_id, attachment_id): + def get_test_result_attachment_content(self, project, run_id, test_case_result_id, attachment_id, **kwargs): """GetTestResultAttachmentContent. [Preview API] Returns a test result attachment :param str project: Project ID or project name @@ -128,8 +128,13 @@ def get_test_result_attachment_content(self, project, run_id, test_case_result_i response = self._send(http_method='GET', location_id='2bffebe9-2f0f-4639-9af8-56129e9fed2d', version='4.1-preview.1', - route_values=route_values) - return self._deserialize('object', response) + route_values=route_values, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_test_result_attachments(self, project, run_id, test_case_result_id): """GetTestResultAttachments. @@ -152,7 +157,7 @@ def get_test_result_attachments(self, project, run_id, test_case_result_id): route_values=route_values) return self._deserialize('[TestAttachment]', self._unwrap_collection(response)) - def get_test_result_attachment_zip(self, project, run_id, test_case_result_id, attachment_id): + def get_test_result_attachment_zip(self, project, run_id, test_case_result_id, attachment_id, **kwargs): """GetTestResultAttachmentZip. [Preview API] Returns a test result attachment :param str project: Project ID or project name @@ -173,8 +178,13 @@ def get_test_result_attachment_zip(self, project, run_id, test_case_result_id, a response = self._send(http_method='GET', location_id='2bffebe9-2f0f-4639-9af8-56129e9fed2d', version='4.1-preview.1', - route_values=route_values) - return self._deserialize('object', response) + route_values=route_values, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def create_test_run_attachment(self, attachment_request_model, project, run_id): """CreateTestRunAttachment. @@ -197,7 +207,7 @@ def create_test_run_attachment(self, attachment_request_model, project, run_id): content=content) return self._deserialize('TestAttachmentReference', response) - def get_test_run_attachment_content(self, project, run_id, attachment_id): + def get_test_run_attachment_content(self, project, run_id, attachment_id, **kwargs): """GetTestRunAttachmentContent. [Preview API] Returns a test run attachment :param str project: Project ID or project name @@ -215,8 +225,13 @@ def get_test_run_attachment_content(self, project, run_id, attachment_id): response = self._send(http_method='GET', location_id='4f004af4-a507-489c-9b13-cb62060beb11', version='4.1-preview.1', - route_values=route_values) - return self._deserialize('object', response) + route_values=route_values, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_test_run_attachments(self, project, run_id): """GetTestRunAttachments. @@ -236,7 +251,7 @@ def get_test_run_attachments(self, project, run_id): route_values=route_values) return self._deserialize('[TestAttachment]', self._unwrap_collection(response)) - def get_test_run_attachment_zip(self, project, run_id, attachment_id): + def get_test_run_attachment_zip(self, project, run_id, attachment_id, **kwargs): """GetTestRunAttachmentZip. [Preview API] Returns a test run attachment :param str project: Project ID or project name @@ -254,8 +269,13 @@ def get_test_run_attachment_zip(self, project, run_id, attachment_id): response = self._send(http_method='GET', location_id='4f004af4-a507-489c-9b13-cb62060beb11', version='4.1-preview.1', - route_values=route_values) - return self._deserialize('object', response) + route_values=route_values, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_bugs_linked_to_test_result(self, project, run_id, test_case_result_id): """GetBugsLinkedToTestResult. diff --git a/vsts/vsts/tfvc/v4_0/tfvc_client.py b/vsts/vsts/tfvc/v4_0/tfvc_client.py index 4eb5b215..e6d410dc 100644 --- a/vsts/vsts/tfvc/v4_0/tfvc_client.py +++ b/vsts/vsts/tfvc/v4_0/tfvc_client.py @@ -300,7 +300,7 @@ def get_items_batch(self, item_request_data, project=None): content=content) return self._deserialize('[[TfvcItem]]', self._unwrap_collection(response)) - def get_items_batch_zip(self, item_request_data, project=None): + def get_items_batch_zip(self, item_request_data, project=None, **kwargs): """GetItemsBatchZip. Post for retrieving a set of items given a list of paths or a long path. Allows for specifying the recursionLevel and version descriptors for each path. :param :class:` ` item_request_data: @@ -315,8 +315,13 @@ def get_items_batch_zip(self, item_request_data, project=None): location_id='fe6f827b-5f64-480f-b8af-1eca3b80e833', version='4.0', route_values=route_values, - content=content) - return self._deserialize('object', response) + content=content, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_item(self, path, project=None, file_name=None, download=None, scope_path=None, recursion_level=None, version_descriptor=None): """GetItem. @@ -358,7 +363,7 @@ def get_item(self, path, project=None, file_name=None, download=None, scope_path query_parameters=query_parameters) return self._deserialize('TfvcItem', response) - def get_item_content(self, path, project=None, file_name=None, download=None, scope_path=None, recursion_level=None, version_descriptor=None): + def get_item_content(self, path, project=None, file_name=None, download=None, scope_path=None, recursion_level=None, version_descriptor=None, **kwargs): """GetItemContent. Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download. :param str path: @@ -395,8 +400,13 @@ def get_item_content(self, path, project=None, file_name=None, download=None, sc location_id='ba9fc436-9a38-4578-89d6-e4f3241f5040', version='4.0', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_items(self, project=None, scope_path=None, recursion_level=None, include_links=None, version_descriptor=None): """GetItems. @@ -432,7 +442,7 @@ def get_items(self, project=None, scope_path=None, recursion_level=None, include query_parameters=query_parameters) return self._deserialize('[TfvcItem]', self._unwrap_collection(response)) - def get_item_text(self, path, project=None, file_name=None, download=None, scope_path=None, recursion_level=None, version_descriptor=None): + def get_item_text(self, path, project=None, file_name=None, download=None, scope_path=None, recursion_level=None, version_descriptor=None, **kwargs): """GetItemText. Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download. :param str path: @@ -469,10 +479,15 @@ def get_item_text(self, path, project=None, file_name=None, download=None, scope location_id='ba9fc436-9a38-4578-89d6-e4f3241f5040', version='4.0', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='text/plain') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) - def get_item_zip(self, path, project=None, file_name=None, download=None, scope_path=None, recursion_level=None, version_descriptor=None): + def get_item_zip(self, path, project=None, file_name=None, download=None, scope_path=None, recursion_level=None, version_descriptor=None, **kwargs): """GetItemZip. Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download. :param str path: @@ -509,8 +524,13 @@ def get_item_zip(self, path, project=None, file_name=None, download=None, scope_ location_id='ba9fc436-9a38-4578-89d6-e4f3241f5040', version='4.0', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_label_items(self, label_id, top=None, skip=None): """GetLabelItems. diff --git a/vsts/vsts/tfvc/v4_1/tfvc_client.py b/vsts/vsts/tfvc/v4_1/tfvc_client.py index cf5cd3ad..91493652 100644 --- a/vsts/vsts/tfvc/v4_1/tfvc_client.py +++ b/vsts/vsts/tfvc/v4_1/tfvc_client.py @@ -302,7 +302,7 @@ def get_items_batch(self, item_request_data, project=None): content=content) return self._deserialize('[[TfvcItem]]', self._unwrap_collection(response)) - def get_items_batch_zip(self, item_request_data, project=None): + def get_items_batch_zip(self, item_request_data, project=None, **kwargs): """GetItemsBatchZip. Post for retrieving a set of items given a list of paths or a long path. Allows for specifying the recursionLevel and version descriptors for each path. :param :class:` ` item_request_data: @@ -317,8 +317,13 @@ def get_items_batch_zip(self, item_request_data, project=None): location_id='fe6f827b-5f64-480f-b8af-1eca3b80e833', version='4.1', route_values=route_values, - content=content) - return self._deserialize('object', response) + content=content, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_item(self, path, project=None, file_name=None, download=None, scope_path=None, recursion_level=None, version_descriptor=None, include_content=None): """GetItem. @@ -363,7 +368,7 @@ def get_item(self, path, project=None, file_name=None, download=None, scope_path query_parameters=query_parameters) return self._deserialize('TfvcItem', response) - def get_item_content(self, path, project=None, file_name=None, download=None, scope_path=None, recursion_level=None, version_descriptor=None, include_content=None): + def get_item_content(self, path, project=None, file_name=None, download=None, scope_path=None, recursion_level=None, version_descriptor=None, include_content=None, **kwargs): """GetItemContent. Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download. :param str path: Version control path of an individual item to return. @@ -403,8 +408,13 @@ def get_item_content(self, path, project=None, file_name=None, download=None, sc location_id='ba9fc436-9a38-4578-89d6-e4f3241f5040', version='4.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_items(self, project=None, scope_path=None, recursion_level=None, include_links=None, version_descriptor=None): """GetItems. @@ -440,7 +450,7 @@ def get_items(self, project=None, scope_path=None, recursion_level=None, include query_parameters=query_parameters) return self._deserialize('[TfvcItem]', self._unwrap_collection(response)) - def get_item_text(self, path, project=None, file_name=None, download=None, scope_path=None, recursion_level=None, version_descriptor=None, include_content=None): + def get_item_text(self, path, project=None, file_name=None, download=None, scope_path=None, recursion_level=None, version_descriptor=None, include_content=None, **kwargs): """GetItemText. Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download. :param str path: Version control path of an individual item to return. @@ -480,10 +490,15 @@ def get_item_text(self, path, project=None, file_name=None, download=None, scope location_id='ba9fc436-9a38-4578-89d6-e4f3241f5040', version='4.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='text/plain') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) - def get_item_zip(self, path, project=None, file_name=None, download=None, scope_path=None, recursion_level=None, version_descriptor=None, include_content=None): + def get_item_zip(self, path, project=None, file_name=None, download=None, scope_path=None, recursion_level=None, version_descriptor=None, include_content=None, **kwargs): """GetItemZip. Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download. :param str path: Version control path of an individual item to return. @@ -523,8 +538,13 @@ def get_item_zip(self, path, project=None, file_name=None, download=None, scope_ location_id='ba9fc436-9a38-4578-89d6-e4f3241f5040', version='4.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_label_items(self, label_id, top=None, skip=None): """GetLabelItems. diff --git a/vsts/vsts/version.py b/vsts/vsts/version.py index 59301c2a..2a55b701 100644 --- a/vsts/vsts/version.py +++ b/vsts/vsts/version.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -VERSION = "0.1.22" +VERSION = "0.1.23" diff --git a/vsts/vsts/vss_client.py b/vsts/vsts/vss_client.py index 16a01c76..29b4283a 100644 --- a/vsts/vsts/vss_client.py +++ b/vsts/vsts/vss_client.py @@ -31,7 +31,8 @@ class VssClient(object): def __init__(self, base_url=None, creds=None): self.config = VssClientConfiguration(base_url) - self._client = ServiceClient(creds, self.config) + self.config.credentials = creds + self._client = ServiceClient(creds, config=self.config) _base_client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._base_deserialize = Deserializer(_base_client_models) self._base_serialize = Serializer(_base_client_models) @@ -64,7 +65,7 @@ def _send_request(self, request, headers=None, content=None, **operation_config) return response def _send(self, http_method, location_id, version, route_values=None, - query_parameters=None, content=None, media_type='application/json'): + query_parameters=None, content=None, media_type='application/json', accept_media_type='application/json'): request = self._create_request_message(http_method=http_method, location_id=location_id, route_values=route_values, @@ -82,7 +83,7 @@ def _send(self, http_method, location_id, version, route_values=None, # Construct headers headers = {'Content-Type': media_type + '; charset=utf-8', - 'Accept': 'application/json;api-version=' + negotiated_version} + 'Accept': accept_media_type + ';api-version=' + negotiated_version} if self.config.additional_headers is not None: for key in self.config.additional_headers: headers[key] = self.config.additional_headers[key] diff --git a/vsts/vsts/wiki/v4_0/wiki_client.py b/vsts/vsts/wiki/v4_0/wiki_client.py index 7e6815a8..ebd75092 100644 --- a/vsts/vsts/wiki/v4_0/wiki_client.py +++ b/vsts/vsts/wiki/v4_0/wiki_client.py @@ -115,7 +115,7 @@ def get_pages(self, project, wiki_id, path=None, recursion_level=None, version_d query_parameters=query_parameters) return self._deserialize('[WikiPage]', self._unwrap_collection(response)) - def get_page_text(self, project, wiki_id, path=None, recursion_level=None, version_descriptor=None): + def get_page_text(self, project, wiki_id, path=None, recursion_level=None, version_descriptor=None, **kwargs): """GetPageText. [Preview API] Gets metadata or content of the wiki pages under the provided page path. :param str project: Project ID or project name @@ -146,10 +146,15 @@ def get_page_text(self, project, wiki_id, path=None, recursion_level=None, versi location_id='25d3fbc7-fe3d-46cb-b5a5-0b6f79caf27b', version='4.0-preview.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='text/plain') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) - def get_page_zip(self, project, wiki_id, path=None, recursion_level=None, version_descriptor=None): + def get_page_zip(self, project, wiki_id, path=None, recursion_level=None, version_descriptor=None, **kwargs): """GetPageZip. [Preview API] Gets metadata or content of the wiki pages under the provided page path. :param str project: Project ID or project name @@ -180,8 +185,13 @@ def get_page_zip(self, project, wiki_id, path=None, recursion_level=None, versio location_id='25d3fbc7-fe3d-46cb-b5a5-0b6f79caf27b', version='4.0-preview.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def create_update(self, update, project, wiki_id, version_descriptor=None): """CreateUpdate. diff --git a/vsts/vsts/wiki/v4_1/wiki_client.py b/vsts/vsts/wiki/v4_1/wiki_client.py index 6071035f..26764617 100644 --- a/vsts/vsts/wiki/v4_1/wiki_client.py +++ b/vsts/vsts/wiki/v4_1/wiki_client.py @@ -184,7 +184,7 @@ def get_page(self, project, wiki_identifier, path=None, recursion_level=None, ve response_object.eTag = response.headers.get('ETag') return response_object - def get_page_text(self, project, wiki_identifier, path=None, recursion_level=None, version_descriptor=None, include_content=None): + def get_page_text(self, project, wiki_identifier, path=None, recursion_level=None, version_descriptor=None, include_content=None, **kwargs): """GetPageText. Gets metadata or content of the wiki page for the provided path. Content negotiation is done based on the `Accept` header sent in the request. :param str project: Project ID or project name @@ -218,10 +218,15 @@ def get_page_text(self, project, wiki_identifier, path=None, recursion_level=Non location_id='25d3fbc7-fe3d-46cb-b5a5-0b6f79caf27b', version='4.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='text/plain') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) - def get_page_zip(self, project, wiki_identifier, path=None, recursion_level=None, version_descriptor=None, include_content=None): + def get_page_zip(self, project, wiki_identifier, path=None, recursion_level=None, version_descriptor=None, include_content=None, **kwargs): """GetPageZip. Gets metadata or content of the wiki page for the provided path. Content negotiation is done based on the `Accept` header sent in the request. :param str project: Project ID or project name @@ -255,8 +260,13 @@ def get_page_zip(self, project, wiki_identifier, path=None, recursion_level=None location_id='25d3fbc7-fe3d-46cb-b5a5-0b6f79caf27b', version='4.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def create_wiki(self, wiki_create_params, project=None): """CreateWiki. diff --git a/vsts/vsts/work_item_tracking/v4_0/work_item_tracking_client.py b/vsts/vsts/work_item_tracking/v4_0/work_item_tracking_client.py index ccc70891..69e222cf 100644 --- a/vsts/vsts/work_item_tracking/v4_0/work_item_tracking_client.py +++ b/vsts/vsts/work_item_tracking/v4_0/work_item_tracking_client.py @@ -73,7 +73,7 @@ def create_attachment(self, upload_stream, file_name=None, upload_type=None, are media_type='application/octet-stream') return self._deserialize('AttachmentReference', response) - def get_attachment_content(self, id, file_name=None): + def get_attachment_content(self, id, file_name=None, **kwargs): """GetAttachmentContent. Returns an attachment :param str id: @@ -90,10 +90,15 @@ def get_attachment_content(self, id, file_name=None): location_id='e07b5fa4-1499-494d-a496-64b860fd64ff', version='4.0', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) - - def get_attachment_zip(self, id, file_name=None): + query_parameters=query_parameters, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_attachment_zip(self, id, file_name=None, **kwargs): """GetAttachmentZip. Returns an attachment :param str id: @@ -110,8 +115,13 @@ def get_attachment_zip(self, id, file_name=None): location_id='e07b5fa4-1499-494d-a496-64b860fd64ff', version='4.0', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_root_nodes(self, project, depth=None): """GetRootNodes. @@ -988,7 +998,7 @@ def get_work_item_icons(self): version='4.0-preview.1') return self._deserialize('[WorkItemIcon]', self._unwrap_collection(response)) - def get_work_item_icon_svg(self, icon, color=None, v=None): + def get_work_item_icon_svg(self, icon, color=None, v=None, **kwargs): """GetWorkItemIconSvg. [Preview API] Get a work item icon svg by icon friendly name and icon color :param str icon: @@ -1008,8 +1018,13 @@ def get_work_item_icon_svg(self, icon, color=None, v=None): location_id='4e1eb4a5-1970-4228-a682-ec48eb2dca30', version='4.0-preview.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='image/svg+xml') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_reporting_links(self, project=None, types=None, continuation_token=None, start_date_time=None): """GetReportingLinks. diff --git a/vsts/vsts/work_item_tracking/v4_1/work_item_tracking_client.py b/vsts/vsts/work_item_tracking/v4_1/work_item_tracking_client.py index 947ad0da..eb586023 100644 --- a/vsts/vsts/work_item_tracking/v4_1/work_item_tracking_client.py +++ b/vsts/vsts/work_item_tracking/v4_1/work_item_tracking_client.py @@ -83,7 +83,7 @@ def create_attachment(self, upload_stream, project=None, file_name=None, upload_ media_type='application/octet-stream') return self._deserialize('AttachmentReference', response) - def get_attachment_content(self, id, project=None, file_name=None, download=None): + def get_attachment_content(self, id, project=None, file_name=None, download=None, **kwargs): """GetAttachmentContent. Downloads an attachment. :param str id: Attachment ID @@ -106,10 +106,15 @@ def get_attachment_content(self, id, project=None, file_name=None, download=None location_id='e07b5fa4-1499-494d-a496-64b860fd64ff', version='4.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) - - def get_attachment_zip(self, id, project=None, file_name=None, download=None): + query_parameters=query_parameters, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_attachment_zip(self, id, project=None, file_name=None, download=None, **kwargs): """GetAttachmentZip. Downloads an attachment. :param str id: Attachment ID @@ -132,8 +137,13 @@ def get_attachment_zip(self, id, project=None, file_name=None, download=None): location_id='e07b5fa4-1499-494d-a496-64b860fd64ff', version='4.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_classification_nodes(self, project, ids, depth=None, error_policy=None): """GetClassificationNodes. @@ -1041,7 +1051,7 @@ def get_work_item_icons(self): version='4.1-preview.1') return self._deserialize('[WorkItemIcon]', self._unwrap_collection(response)) - def get_work_item_icon_svg(self, icon, color=None, v=None): + def get_work_item_icon_svg(self, icon, color=None, v=None, **kwargs): """GetWorkItemIconSvg. [Preview API] Get a work item icon given the friendly name and icon color. :param str icon: The name of the icon @@ -1061,8 +1071,13 @@ def get_work_item_icon_svg(self, icon, color=None, v=None): location_id='4e1eb4a5-1970-4228-a682-ec48eb2dca30', version='4.1-preview.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='image/svg+xml') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def get_reporting_links_by_link_type(self, project=None, link_types=None, types=None, continuation_token=None, start_date_time=None): """GetReportingLinksByLinkType. diff --git a/vsts/vsts/work_item_tracking_process_template/v4_0/work_item_tracking_process_template_client.py b/vsts/vsts/work_item_tracking_process_template/v4_0/work_item_tracking_process_template_client.py index 4c9071e4..9a290a73 100644 --- a/vsts/vsts/work_item_tracking_process_template/v4_0/work_item_tracking_process_template_client.py +++ b/vsts/vsts/work_item_tracking_process_template/v4_0/work_item_tracking_process_template_client.py @@ -77,7 +77,7 @@ def check_template_existence(self, upload_stream): media_type='application/octet-stream') return self._deserialize('CheckTemplateExistenceResult', response) - def export_process_template(self, id): + def export_process_template(self, id, **kwargs): """ExportProcessTemplate. [Preview API] Returns requested process template :param str id: @@ -92,8 +92,13 @@ def export_process_template(self, id): location_id='29e1f38d-9e9c-4358-86a5-cdf9896a5759', version='4.0-preview.1', route_values=route_values, - query_parameters=query_parameters) - return self._deserialize('object', response) + query_parameters=query_parameters, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def import_process_template(self, upload_stream, ignore_warnings=None): """ImportProcessTemplate. diff --git a/vsts/vsts/work_item_tracking_process_template/v4_1/work_item_tracking_process_template_client.py b/vsts/vsts/work_item_tracking_process_template/v4_1/work_item_tracking_process_template_client.py index 2de60dbb..19a8b8fa 100644 --- a/vsts/vsts/work_item_tracking_process_template/v4_1/work_item_tracking_process_template_client.py +++ b/vsts/vsts/work_item_tracking_process_template/v4_1/work_item_tracking_process_template_client.py @@ -77,7 +77,7 @@ def check_template_existence(self, upload_stream): media_type='application/octet-stream') return self._deserialize('CheckTemplateExistenceResult', response) - def export_process_template(self, id): + def export_process_template(self, id, **kwargs): """ExportProcessTemplate. [Preview API] Returns requested process template. :param str id: The ID of the process @@ -90,8 +90,13 @@ def export_process_template(self, id): response = self._send(http_method='GET', location_id='29e1f38d-9e9c-4358-86a5-cdf9896a5759', version='4.1-preview.1', - route_values=route_values) - return self._deserialize('object', response) + route_values=route_values, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) def import_process_template(self, upload_stream, ignore_warnings=None): """ImportProcessTemplate.