Skip to content

Commit 3afb533

Browse files
authored
Merge pull request #243 from microsoft/dev
M153, released 5.1 clients
2 parents 72ea082 + fd407ed commit 3afb533

File tree

143 files changed

+8330
-4555
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+8330
-4555
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ for project in projects:
4242

4343
## API documentation
4444

45-
This Python library provides a thin wrapper around the Azure DevOps REST APIs. See the [Azure DevOps REST API reference](https://docs.microsoft.com/en-us/rest/api/vsts/?view=vsts-rest-5.0) for details on calling different APIs.
45+
This Python library provides a thin wrapper around the Azure DevOps REST APIs. See the [Azure DevOps REST API reference](https://docs.microsoft.com/en-us/rest/api/azure/devops/?view=azure-devops-rest-5.1) for details on calling different APIs.
4646

4747
## Samples
4848

azure-devops/azure/devops/client.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,24 +124,23 @@ def _create_request_message(self, http_method, location_id, route_values=None,
124124
route_values = {}
125125
route_values['area'] = location.area
126126
route_values['resource'] = location.resource_name
127-
route_template = self._remove_optional_route_parameters(location.route_template,
128-
route_values)
127+
url = self._transform_route_template(location.route_template, route_values)
129128
logger.debug('Route template: %s', location.route_template)
130-
url = self._client.format_url(route_template, **route_values)
131129
request = ClientRequest(method=http_method, url=self._client.format_url(url))
132130
if query_parameters:
133131
request.format_parameters(query_parameters)
134132
return request
135133

136134
@staticmethod
137-
def _remove_optional_route_parameters(route_template, route_values):
135+
def _transform_route_template(route_template, route_values):
138136
new_template = ''
139137
route_template = route_template.replace('{*', '{')
140138
for path_segment in route_template.split('/'):
141139
if (len(path_segment) <= 2 or not path_segment[0] == '{'
142-
or not path_segment[len(path_segment) - 1] == '}'
143-
or path_segment[1:len(path_segment) - 1] in route_values):
140+
or not path_segment[len(path_segment) - 1] == '}'):
144141
new_template = new_template + '/' + path_segment
142+
elif path_segment[1:len(path_segment) - 1] in route_values:
143+
new_template = new_template + '/' + route_values[path_segment[1:len(path_segment) - 1]]
145144
return new_template
146145

147146
def _get_resource_location(self, location_id):
@@ -222,7 +221,7 @@ def _negotiate_request_version(location, version):
222221
else:
223222
# We can send at the requested api version. Make sure the resource version
224223
# is not bigger than what the server supports
225-
negotiated_version = str(requested_api_version)
224+
negotiated_version = match.group(1)
226225
is_preview = match.group(3) is not None
227226
if is_preview:
228227
negotiated_version += '-preview'
@@ -267,7 +266,7 @@ def _handle_error(self, request, response):
267266
raise AzureDevOpsAuthenticationError(full_message_format.format(error_message=error_message,
268267
url=request.url))
269268
else:
270-
full_message_format = '{error_message}Operation returned an invalid status code of {status_code}.'
269+
full_message_format = '{error_message}Operation returned a {status_code} status code.'
271270
raise AzureDevOpsClientRequestError(full_message_format.format(error_message=error_message,
272271
status_code=response.status_code))
273272

azure-devops/azure/devops/released/accounts/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------------------------
88

9-
from ...v5_0.accounts.models import *
9+
from ...v5_1.accounts.models import *
1010
from .accounts_client import AccountsClient
1111

1212
__all__ = [

azure-devops/azure/devops/released/accounts/accounts_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from msrest import Serializer, Deserializer
1010
from ...client import Client
11-
from ...v5_0.accounts import models
11+
from ...v5_1.accounts import models
1212

1313

1414
class AccountsClient(Client):
@@ -42,7 +42,7 @@ def get_accounts(self, owner_id=None, member_id=None, properties=None):
4242
query_parameters['properties'] = self._serialize.query('properties', properties, 'str')
4343
response = self._send(http_method='GET',
4444
location_id='229a6a53-b428-4ffb-a835-e8f36b5b4b1e',
45-
version='5.0',
45+
version='5.1',
4646
query_parameters=query_parameters)
4747
return self._deserialize('[Account]', self._unwrap_collection(response))
4848

azure-devops/azure/devops/released/build/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------------------------
88

9-
from ...v5_0.build.models import *
9+
from ...v5_1.build.models import *
1010
from .build_client import BuildClient
1111

1212
__all__ = [
1313
'AgentPoolQueue',
14+
'AgentSpecification',
1415
'AggregatedResultsAnalysis',
1516
'AggregatedResultsByOutcome',
1617
'AggregatedResultsDifference',

0 commit comments

Comments
 (0)