Skip to content

Commit 2fd0bdc

Browse files
committed
fixed up profiles
1 parent 7eb21b2 commit 2fd0bdc

File tree

7 files changed

+405
-20
lines changed

7 files changed

+405
-20
lines changed

azure-devops/azure/devops/v5_1/client_factory.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,13 @@ def get_profile_client(self):
210210
"""
211211
return self._connection.get_client('azure.devops.v5_1.profile.profile_client.ProfileClient')
212212

213+
def get_profile_regions_client(self):
214+
"""get_profile_regions_client.
215+
Gets the 5.1 version of the ProfileRegionsClient
216+
:rtype: :class:`<ProfileRegionsClient> <azure.devops.v5_1.profile_regions.profile_regions_client.ProfileRegionsClient>`
217+
"""
218+
return self._connection.get_client('azure.devops.v5_1.profile_regions.profile_regions_client.ProfileRegionsClient')
219+
213220
def get_project_analysis_client(self):
214221
"""get_project_analysis_client.
215222
Gets the 5.1 version of the ProjectAnalysisClient

azure-devops/azure/devops/v5_1/profile/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,15 @@
99
from .models import *
1010

1111
__all__ = [
12+
'AttributeDescriptor',
13+
'AttributesContainer',
14+
'Avatar',
15+
'CoreProfileAttribute',
16+
'CreateProfileContext',
1217
'GeoRegion',
18+
'Profile',
19+
'ProfileAttribute',
20+
'ProfileAttributeBase',
1321
'ProfileRegion',
1422
'ProfileRegions',
1523
]

azure-devops/azure/devops/v5_1/profile/models.py

Lines changed: 220 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,126 @@
99
from msrest.serialization import Model
1010

1111

12+
class AttributeDescriptor(Model):
13+
"""AttributeDescriptor.
14+
15+
:param attribute_name: The name of the attribute.
16+
:type attribute_name: str
17+
:param container_name: The container the attribute resides in.
18+
:type container_name: str
19+
"""
20+
21+
_attribute_map = {
22+
'attribute_name': {'key': 'attributeName', 'type': 'str'},
23+
'container_name': {'key': 'containerName', 'type': 'str'}
24+
}
25+
26+
def __init__(self, attribute_name=None, container_name=None):
27+
super(AttributeDescriptor, self).__init__()
28+
self.attribute_name = attribute_name
29+
self.container_name = container_name
30+
31+
32+
class AttributesContainer(Model):
33+
"""AttributesContainer.
34+
35+
:param attributes: The attributes stored by the container.
36+
:type attributes: dict
37+
:param container_name: The name of the container.
38+
:type container_name: str
39+
:param revision: The maximum revision number of any attribute within the container.
40+
:type revision: int
41+
"""
42+
43+
_attribute_map = {
44+
'attributes': {'key': 'attributes', 'type': '{ProfileAttribute}'},
45+
'container_name': {'key': 'containerName', 'type': 'str'},
46+
'revision': {'key': 'revision', 'type': 'int'}
47+
}
48+
49+
def __init__(self, attributes=None, container_name=None, revision=None):
50+
super(AttributesContainer, self).__init__()
51+
self.attributes = attributes
52+
self.container_name = container_name
53+
self.revision = revision
54+
55+
56+
class Avatar(Model):
57+
"""Avatar.
58+
59+
:param is_auto_generated:
60+
:type is_auto_generated: bool
61+
:param size:
62+
:type size: object
63+
:param time_stamp:
64+
:type time_stamp: datetime
65+
:param value:
66+
:type value: str
67+
"""
68+
69+
_attribute_map = {
70+
'is_auto_generated': {'key': 'isAutoGenerated', 'type': 'bool'},
71+
'size': {'key': 'size', 'type': 'object'},
72+
'time_stamp': {'key': 'timeStamp', 'type': 'iso-8601'},
73+
'value': {'key': 'value', 'type': 'str'}
74+
}
75+
76+
def __init__(self, is_auto_generated=None, size=None, time_stamp=None, value=None):
77+
super(Avatar, self).__init__()
78+
self.is_auto_generated = is_auto_generated
79+
self.size = size
80+
self.time_stamp = time_stamp
81+
self.value = value
82+
83+
84+
class CreateProfileContext(Model):
85+
"""CreateProfileContext.
86+
87+
:param cIData:
88+
:type cIData: dict
89+
:param contact_with_offers:
90+
:type contact_with_offers: bool
91+
:param country_name:
92+
:type country_name: str
93+
:param display_name:
94+
:type display_name: str
95+
:param email_address:
96+
:type email_address: str
97+
:param has_account:
98+
:type has_account: bool
99+
:param language:
100+
:type language: str
101+
:param phone_number:
102+
:type phone_number: str
103+
:param profile_state: The current state of the profile.
104+
:type profile_state: object
105+
"""
106+
107+
_attribute_map = {
108+
'cIData': {'key': 'cIData', 'type': '{object}'},
109+
'contact_with_offers': {'key': 'contactWithOffers', 'type': 'bool'},
110+
'country_name': {'key': 'countryName', 'type': 'str'},
111+
'display_name': {'key': 'displayName', 'type': 'str'},
112+
'email_address': {'key': 'emailAddress', 'type': 'str'},
113+
'has_account': {'key': 'hasAccount', 'type': 'bool'},
114+
'language': {'key': 'language', 'type': 'str'},
115+
'phone_number': {'key': 'phoneNumber', 'type': 'str'},
116+
'profile_state': {'key': 'profileState', 'type': 'object'}
117+
}
118+
119+
def __init__(self, cIData=None, contact_with_offers=None, country_name=None, display_name=None, email_address=None, has_account=None, language=None, phone_number=None, profile_state=None):
120+
super(CreateProfileContext, self).__init__()
121+
self.cIData = cIData
122+
self.contact_with_offers = contact_with_offers
123+
self.country_name = country_name
124+
self.display_name = display_name
125+
self.email_address = email_address
126+
self.has_account = has_account
127+
self.language = language
128+
self.phone_number = phone_number
129+
self.profile_state = profile_state
130+
131+
12132
class GeoRegion(Model):
13133
"""GeoRegion.
14134
@@ -25,6 +145,74 @@ def __init__(self, region_code=None):
25145
self.region_code = region_code
26146

27147

148+
class Profile(Model):
149+
"""Profile.
150+
151+
:param application_container: The attributes of this profile.
152+
:type application_container: :class:`AttributesContainer <azure.devops.v5_1.profile.models.AttributesContainer>`
153+
:param core_attributes: The core attributes of this profile.
154+
:type core_attributes: dict
155+
:param core_revision: The maximum revision number of any attribute.
156+
:type core_revision: int
157+
:param id: The unique identifier of the profile.
158+
:type id: str
159+
:param profile_state: The current state of the profile.
160+
:type profile_state: object
161+
:param revision: The maximum revision number of any attribute.
162+
:type revision: int
163+
:param time_stamp: The time at which this profile was last changed.
164+
:type time_stamp: datetime
165+
"""
166+
167+
_attribute_map = {
168+
'application_container': {'key': 'applicationContainer', 'type': 'AttributesContainer'},
169+
'core_attributes': {'key': 'coreAttributes', 'type': '{CoreProfileAttribute}'},
170+
'core_revision': {'key': 'coreRevision', 'type': 'int'},
171+
'id': {'key': 'id', 'type': 'str'},
172+
'profile_state': {'key': 'profileState', 'type': 'object'},
173+
'revision': {'key': 'revision', 'type': 'int'},
174+
'time_stamp': {'key': 'timeStamp', 'type': 'iso-8601'}
175+
}
176+
177+
def __init__(self, application_container=None, core_attributes=None, core_revision=None, id=None, profile_state=None, revision=None, time_stamp=None):
178+
super(Profile, self).__init__()
179+
self.application_container = application_container
180+
self.core_attributes = core_attributes
181+
self.core_revision = core_revision
182+
self.id = id
183+
self.profile_state = profile_state
184+
self.revision = revision
185+
self.time_stamp = time_stamp
186+
187+
188+
class ProfileAttributeBase(Model):
189+
"""ProfileAttributeBase.
190+
191+
:param descriptor: The descriptor of the attribute.
192+
:type descriptor: :class:`AttributeDescriptor <azure.devops.v5_1.profile.models.AttributeDescriptor>`
193+
:param revision: The revision number of the attribute.
194+
:type revision: int
195+
:param time_stamp: The time the attribute was last changed.
196+
:type time_stamp: datetime
197+
:param value: The value of the attribute.
198+
:type value: object
199+
"""
200+
201+
_attribute_map = {
202+
'descriptor': {'key': 'descriptor', 'type': 'AttributeDescriptor'},
203+
'revision': {'key': 'revision', 'type': 'int'},
204+
'time_stamp': {'key': 'timeStamp', 'type': 'iso-8601'},
205+
'value': {'key': 'value', 'type': 'object'}
206+
}
207+
208+
def __init__(self, descriptor=None, revision=None, time_stamp=None, value=None):
209+
super(ProfileAttributeBase, self).__init__()
210+
self.descriptor = descriptor
211+
self.revision = revision
212+
self.time_stamp = time_stamp
213+
self.value = value
214+
215+
28216
class ProfileRegion(Model):
29217
"""ProfileRegion.
30218
@@ -69,8 +257,40 @@ def __init__(self, notice_contact_consent_requirement_regions=None, opt_out_cont
69257
self.regions = regions
70258

71259

260+
class CoreProfileAttribute(ProfileAttributeBase):
261+
"""CoreProfileAttribute.
262+
263+
"""
264+
265+
_attribute_map = {
266+
}
267+
268+
def __init__(self):
269+
super(CoreProfileAttribute, self).__init__()
270+
271+
272+
class ProfileAttribute(ProfileAttributeBase):
273+
"""ProfileAttribute.
274+
275+
"""
276+
277+
_attribute_map = {
278+
}
279+
280+
def __init__(self):
281+
super(ProfileAttribute, self).__init__()
282+
283+
72284
__all__ = [
285+
'AttributeDescriptor',
286+
'AttributesContainer',
287+
'Avatar',
288+
'CreateProfileContext',
73289
'GeoRegion',
290+
'Profile',
291+
'ProfileAttributeBase',
74292
'ProfileRegion',
75293
'ProfileRegions',
294+
'CoreProfileAttribute',
295+
'ProfileAttribute',
76296
]

azure-devops/azure/devops/v5_1/profile/profile_client.py

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,35 @@ def __init__(self, base_url=None, creds=None):
2525

2626
resource_area_identifier = None
2727

28-
def get_geo_region(self, ip):
29-
"""GetGeoRegion.
30-
[Preview API] Lookup up country/region based on provided IPv4, null if using the remote IPv4 address.
31-
:param str ip:
32-
:rtype: :class:`<GeoRegion> <azure.devops.v5_1.profile.models.GeoRegion>`
28+
def get_profile(self, id, details=None, with_attributes=None, partition=None, core_attributes=None, force_refresh=None):
29+
"""GetProfile.
30+
[Preview API] Gets a user profile.
31+
:param str id: The ID of the target user profile within the same organization, or 'me' to get the profile of the current authenticated user.
32+
:param bool details: Return public profile information such as display name, email address, country, etc. If false, the withAttributes parameter is ignored.
33+
:param bool with_attributes: If true, gets the attributes (named key-value pairs of arbitrary data) associated with the profile. The partition parameter must also have a value.
34+
:param str partition: The partition (named group) of attributes to return.
35+
:param str core_attributes: A comma-delimited list of core profile attributes to return. Valid values are Email, Avatar, DisplayName, and ContactWithOffers.
36+
:param bool force_refresh: Not used in this version of the API.
37+
:rtype: :class:`<Profile> <azure.devops.v5_1.profile.models.Profile>`
3338
"""
39+
route_values = {}
40+
if id is not None:
41+
route_values['id'] = self._serialize.url('id', id, 'str')
3442
query_parameters = {}
35-
if ip is not None:
36-
query_parameters['ip'] = self._serialize.query('ip', ip, 'str')
43+
if details is not None:
44+
query_parameters['details'] = self._serialize.query('details', details, 'bool')
45+
if with_attributes is not None:
46+
query_parameters['withAttributes'] = self._serialize.query('with_attributes', with_attributes, 'bool')
47+
if partition is not None:
48+
query_parameters['partition'] = self._serialize.query('partition', partition, 'str')
49+
if core_attributes is not None:
50+
query_parameters['coreAttributes'] = self._serialize.query('core_attributes', core_attributes, 'str')
51+
if force_refresh is not None:
52+
query_parameters['forceRefresh'] = self._serialize.query('force_refresh', force_refresh, 'bool')
3753
response = self._send(http_method='GET',
38-
location_id='35b3ff1d-ab4c-4d1c-98bb-f6ea21d86bd9',
39-
version='5.1-preview.1',
54+
location_id='f83735dc-483f-4238-a291-d45f6080a9af',
55+
version='5.1-preview.3',
56+
route_values=route_values,
4057
query_parameters=query_parameters)
41-
return self._deserialize('GeoRegion', response)
42-
43-
def get_regions(self):
44-
"""GetRegions.
45-
[Preview API]
46-
:rtype: :class:`<ProfileRegions> <azure.devops.v5_1.profile.models.ProfileRegions>`
47-
"""
48-
response = self._send(http_method='GET',
49-
location_id='b129ca90-999d-47bb-ab37-0dcf784ee633',
50-
version='5.1-preview.1')
51-
return self._deserialize('ProfileRegions', response)
58+
return self._deserialize('Profile', response)
5259

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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 .models import *
10+
11+
__all__ = [
12+
'GeoRegion',
13+
'ProfileRegion',
14+
'ProfileRegions',
15+
]

0 commit comments

Comments
 (0)