Skip to content

Commit 68af3c8

Browse files
authored
Merge pull request #50 from Microsoft/dev
Merge latest dev, including latest 4.0 and 4.1 apis.
2 parents bc23366 + 74c3ea2 commit 68af3c8

File tree

1,656 files changed

+90906
-1086
lines changed

Some content is hidden

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

1,656 files changed

+90906
-1086
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,3 +293,8 @@ __pycache__/
293293
*.btm.cs
294294
*.odx.cs
295295
*.xsd.cs
296+
.vscode/
297+
vsts/build/bdist.win32/
298+
299+
# don't ignore release managment client
300+
!vsts/vsts/release

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,37 @@
55

66
This repository contains Microsoft Visual Studio Team Services Python API. This API is used to build the Visual Studio Team Services CLI. To learn more about the VSTS CLI, check out our [github repo](https://github.com/Microsoft/vsts-cli).
77

8+
# Installation
9+
10+
```pip install vsts```
11+
12+
# Getting Started
13+
14+
Following is an example how to use the API directly:
15+
16+
```
17+
from vsts.vss_connection import VssConnection
18+
from msrest.authentication import BasicAuthentication
19+
import pprint
20+
21+
token='REDACTED'
22+
team_instance='https://REDACTED.visualstudio.com'
23+
24+
credentials = BasicAuthentication('', token)
25+
connection = VssConnection(base_url=team_instance, creds=credentials)
26+
core_client = connection.get_client('vsts.core.v4_0.core_client.CoreClient')
27+
28+
team_projects = core_client.get_projects()
29+
30+
for project in team_projects:
31+
pprint.pprint(project.__dict__)
32+
```
33+
34+
# VSTS REST API Documentation
35+
36+
The python SDK is a thin wrapper around the VSTS REST APIs. Please consult our REST API documentation for API specific details while working with this python SDK.
37+
38+
[VSTS REST API Documentation](https://docs.microsoft.com/en-us/rest/api/vsts)
839

940
# Contributing
1041

vsts/setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from setuptools import setup, find_packages
77

88
NAME = "vsts"
9-
VERSION = "0.1.0b2"
9+
VERSION = "0.1.1"
1010

1111
# To install the library, run the following
1212
#
@@ -16,7 +16,7 @@
1616
# http://pypi.python.org/pypi/setuptools
1717

1818
REQUIRES = [
19-
"msrest>=0.4.5"
19+
"msrest~=0.4.19"
2020
]
2121

2222
CLASSIFIERS = [

vsts/vsts/accounts/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
# --------------------------------------------------------------------------------------------
5+
# Generated file, DO NOT EDIT
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------------------------

vsts/vsts/accounts/v4_0/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
# --------------------------------------------------------------------------------------------
5+
# Generated file, DO NOT EDIT
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------------------------
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
# --------------------------------------------------------------------------------------------
5+
# Generated file, DO NOT EDIT
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------------------------
8+
9+
from msrest import Serializer, Deserializer
10+
from ...vss_client import VssClient
11+
from . import models
12+
13+
14+
class AccountsClient(VssClient):
15+
"""Accounts
16+
:param str base_url: Service URL
17+
:param Authentication creds: Authenticated credentials.
18+
"""
19+
20+
def __init__(self, base_url=None, creds=None):
21+
super(AccountsClient, self).__init__(base_url, creds)
22+
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
23+
self._serialize = Serializer(client_models)
24+
self._deserialize = Deserializer(client_models)
25+
26+
resource_area_identifier = '0d55247a-1c47-4462-9b1f-5e2125590ee6'
27+
28+
def create_account(self, info, use_precreated=None):
29+
"""CreateAccount.
30+
:param :class:`<AccountCreateInfoInternal> <accounts.v4_0.models.AccountCreateInfoInternal>` info:
31+
:param bool use_precreated:
32+
:rtype: :class:`<Account> <accounts.v4_0.models.Account>`
33+
"""
34+
query_parameters = {}
35+
if use_precreated is not None:
36+
query_parameters['usePrecreated'] = self._serialize.query('use_precreated', use_precreated, 'bool')
37+
content = self._serialize.body(info, 'AccountCreateInfoInternal')
38+
response = self._send(http_method='POST',
39+
location_id='229a6a53-b428-4ffb-a835-e8f36b5b4b1e',
40+
version='4.0',
41+
query_parameters=query_parameters,
42+
content=content)
43+
return self._deserialize('Account', response)
44+
45+
def get_account(self, account_id):
46+
"""GetAccount.
47+
:param str account_id:
48+
:rtype: :class:`<Account> <accounts.v4_0.models.Account>`
49+
"""
50+
route_values = {}
51+
if account_id is not None:
52+
route_values['accountId'] = self._serialize.url('account_id', account_id, 'str')
53+
response = self._send(http_method='GET',
54+
location_id='229a6a53-b428-4ffb-a835-e8f36b5b4b1e',
55+
version='4.0',
56+
route_values=route_values)
57+
return self._deserialize('Account', response)
58+
59+
def get_accounts(self, owner_id=None, member_id=None, properties=None):
60+
"""GetAccounts.
61+
A new version GetAccounts API. Only supports limited set of parameters, returns a list of account ref objects that only contains AccountUrl, AccountName and AccountId information, will use collection host Id as the AccountId.
62+
:param str owner_id: Owner Id to query for
63+
:param str member_id: Member Id to query for
64+
:param str properties: Only support service URL properties
65+
:rtype: [Account]
66+
"""
67+
query_parameters = {}
68+
if owner_id is not None:
69+
query_parameters['ownerId'] = self._serialize.query('owner_id', owner_id, 'str')
70+
if member_id is not None:
71+
query_parameters['memberId'] = self._serialize.query('member_id', member_id, 'str')
72+
if properties is not None:
73+
query_parameters['properties'] = self._serialize.query('properties', properties, 'str')
74+
response = self._send(http_method='GET',
75+
location_id='229a6a53-b428-4ffb-a835-e8f36b5b4b1e',
76+
version='4.0',
77+
query_parameters=query_parameters,
78+
returns_collection=True)
79+
return self._deserialize('[Account]', response)
80+
81+
def get_account_settings(self):
82+
"""GetAccountSettings.
83+
[Preview API]
84+
:rtype: {str}
85+
"""
86+
response = self._send(http_method='GET',
87+
location_id='4e012dd4-f8e1-485d-9bb3-c50d83c5b71b',
88+
version='4.0-preview.1',
89+
returns_collection=True)
90+
return self._deserialize('{str}', response)
91+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
# --------------------------------------------------------------------------------------------
5+
# Generated file, DO NOT EDIT
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------------------------
8+
9+
from .account import Account
10+
from .account_create_info_internal import AccountCreateInfoInternal
11+
from .account_preferences_internal import AccountPreferencesInternal
12+
13+
__all__ = [
14+
'Account',
15+
'AccountCreateInfoInternal',
16+
'AccountPreferencesInternal',
17+
]
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
# --------------------------------------------------------------------------------------------
5+
# Generated file, DO NOT EDIT
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------------------------
8+
9+
from msrest.serialization import Model
10+
11+
12+
class Account(Model):
13+
"""Account.
14+
15+
:param account_id: Identifier for an Account
16+
:type account_id: str
17+
:param account_name: Name for an account
18+
:type account_name: str
19+
:param account_owner: Owner of account
20+
:type account_owner: str
21+
:param account_status: Current account status
22+
:type account_status: object
23+
:param account_type: Type of account: Personal, Organization
24+
:type account_type: object
25+
:param account_uri: Uri for an account
26+
:type account_uri: str
27+
:param created_by: Who created the account
28+
:type created_by: str
29+
:param created_date: Date account was created
30+
:type created_date: datetime
31+
:param has_moved:
32+
:type has_moved: bool
33+
:param last_updated_by: Identity of last person to update the account
34+
:type last_updated_by: str
35+
:param last_updated_date: Date account was last updated
36+
:type last_updated_date: datetime
37+
:param namespace_id: Namespace for an account
38+
:type namespace_id: str
39+
:param new_collection_id:
40+
:type new_collection_id: str
41+
:param organization_name: Organization that created the account
42+
:type organization_name: str
43+
:param properties: Extended properties
44+
:type properties: :class:`object <accounts.v4_0.models.object>`
45+
:param status_reason: Reason for current status
46+
:type status_reason: str
47+
"""
48+
49+
_attribute_map = {
50+
'account_id': {'key': 'accountId', 'type': 'str'},
51+
'account_name': {'key': 'accountName', 'type': 'str'},
52+
'account_owner': {'key': 'accountOwner', 'type': 'str'},
53+
'account_status': {'key': 'accountStatus', 'type': 'object'},
54+
'account_type': {'key': 'accountType', 'type': 'object'},
55+
'account_uri': {'key': 'accountUri', 'type': 'str'},
56+
'created_by': {'key': 'createdBy', 'type': 'str'},
57+
'created_date': {'key': 'createdDate', 'type': 'iso-8601'},
58+
'has_moved': {'key': 'hasMoved', 'type': 'bool'},
59+
'last_updated_by': {'key': 'lastUpdatedBy', 'type': 'str'},
60+
'last_updated_date': {'key': 'lastUpdatedDate', 'type': 'iso-8601'},
61+
'namespace_id': {'key': 'namespaceId', 'type': 'str'},
62+
'new_collection_id': {'key': 'newCollectionId', 'type': 'str'},
63+
'organization_name': {'key': 'organizationName', 'type': 'str'},
64+
'properties': {'key': 'properties', 'type': 'object'},
65+
'status_reason': {'key': 'statusReason', 'type': 'str'}
66+
}
67+
68+
def __init__(self, account_id=None, account_name=None, account_owner=None, account_status=None, account_type=None, account_uri=None, created_by=None, created_date=None, has_moved=None, last_updated_by=None, last_updated_date=None, namespace_id=None, new_collection_id=None, organization_name=None, properties=None, status_reason=None):
69+
super(Account, self).__init__()
70+
self.account_id = account_id
71+
self.account_name = account_name
72+
self.account_owner = account_owner
73+
self.account_status = account_status
74+
self.account_type = account_type
75+
self.account_uri = account_uri
76+
self.created_by = created_by
77+
self.created_date = created_date
78+
self.has_moved = has_moved
79+
self.last_updated_by = last_updated_by
80+
self.last_updated_date = last_updated_date
81+
self.namespace_id = namespace_id
82+
self.new_collection_id = new_collection_id
83+
self.organization_name = organization_name
84+
self.properties = properties
85+
self.status_reason = status_reason
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
# --------------------------------------------------------------------------------------------
5+
# Generated file, DO NOT EDIT
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------------------------
8+
9+
from msrest.serialization import Model
10+
11+
12+
class AccountCreateInfoInternal(Model):
13+
"""AccountCreateInfoInternal.
14+
15+
:param account_name:
16+
:type account_name: str
17+
:param creator:
18+
:type creator: str
19+
:param organization:
20+
:type organization: str
21+
:param preferences:
22+
:type preferences: :class:`AccountPreferencesInternal <accounts.v4_0.models.AccountPreferencesInternal>`
23+
:param properties:
24+
:type properties: :class:`object <accounts.v4_0.models.object>`
25+
:param service_definitions:
26+
:type service_definitions: list of { key: str; value: str }
27+
"""
28+
29+
_attribute_map = {
30+
'account_name': {'key': 'accountName', 'type': 'str'},
31+
'creator': {'key': 'creator', 'type': 'str'},
32+
'organization': {'key': 'organization', 'type': 'str'},
33+
'preferences': {'key': 'preferences', 'type': 'AccountPreferencesInternal'},
34+
'properties': {'key': 'properties', 'type': 'object'},
35+
'service_definitions': {'key': 'serviceDefinitions', 'type': '[{ key: str; value: str }]'}
36+
}
37+
38+
def __init__(self, account_name=None, creator=None, organization=None, preferences=None, properties=None, service_definitions=None):
39+
super(AccountCreateInfoInternal, self).__init__()
40+
self.account_name = account_name
41+
self.creator = creator
42+
self.organization = organization
43+
self.preferences = preferences
44+
self.properties = properties
45+
self.service_definitions = service_definitions
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
# --------------------------------------------------------------------------------------------
5+
# Generated file, DO NOT EDIT
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------------------------
8+
9+
from msrest.serialization import Model
10+
11+
12+
class AccountPreferencesInternal(Model):
13+
"""AccountPreferencesInternal.
14+
15+
:param culture:
16+
:type culture: object
17+
:param language:
18+
:type language: object
19+
:param time_zone:
20+
:type time_zone: object
21+
"""
22+
23+
_attribute_map = {
24+
'culture': {'key': 'culture', 'type': 'object'},
25+
'language': {'key': 'language', 'type': 'object'},
26+
'time_zone': {'key': 'timeZone', 'type': 'object'}
27+
}
28+
29+
def __init__(self, culture=None, language=None, time_zone=None):
30+
super(AccountPreferencesInternal, self).__init__()
31+
self.culture = culture
32+
self.language = language
33+
self.time_zone = time_zone

vsts/vsts/accounts/v4_1/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
# --------------------------------------------------------------------------------------------
5+
# Generated file, DO NOT EDIT
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)