diff --git a/vsts/vsts/user/__init__.py b/vsts/vsts/user/__init__.py new file mode 100644 index 00000000..b19525a6 --- /dev/null +++ b/vsts/vsts/user/__init__.py @@ -0,0 +1,7 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# Generated file, DO NOT EDIT +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------------------------- diff --git a/vsts/vsts/user/v4_1/__init__.py b/vsts/vsts/user/v4_1/__init__.py new file mode 100644 index 00000000..b19525a6 --- /dev/null +++ b/vsts/vsts/user/v4_1/__init__.py @@ -0,0 +1,7 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# Generated file, DO NOT EDIT +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------------------------- diff --git a/vsts/vsts/user/v4_1/models/__init__.py b/vsts/vsts/user/v4_1/models/__init__.py new file mode 100644 index 00000000..deed4a68 --- /dev/null +++ b/vsts/vsts/user/v4_1/models/__init__.py @@ -0,0 +1,35 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# Generated file, DO NOT EDIT +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------------------------- + +from .avatar import Avatar +from .create_user_parameters import CreateUserParameters +from .mail_confirmation_parameters import MailConfirmationParameters +from .reference_links import ReferenceLinks +from .send_user_notification_parameters import SendUserNotificationParameters +from .set_user_attribute_parameters import SetUserAttributeParameters +from .update_user_parameters import UpdateUserParameters +from .user import User +from .user_attribute import UserAttribute +from .user_attributes import UserAttributes +from .user_notification import UserNotification +from .user_notifications import UserNotifications + +__all__ = [ + 'Avatar', + 'CreateUserParameters', + 'MailConfirmationParameters', + 'ReferenceLinks', + 'SendUserNotificationParameters', + 'SetUserAttributeParameters', + 'UpdateUserParameters', + 'User', + 'UserAttribute', + 'UserAttributes', + 'UserNotification', + 'UserNotifications', +] diff --git a/vsts/vsts/user/v4_1/models/avatar.py b/vsts/vsts/user/v4_1/models/avatar.py new file mode 100644 index 00000000..cd4f5f01 --- /dev/null +++ b/vsts/vsts/user/v4_1/models/avatar.py @@ -0,0 +1,37 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# Generated file, DO NOT EDIT +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class Avatar(Model): + """Avatar. + + :param image: The raw avatar image data, in either jpg or png format. + :type image: str + :param is_auto_generated: True if the avatar is dynamically generated, false if user-provided. + :type is_auto_generated: bool + :param last_modified: The date/time at which the avatar was last modified. + :type last_modified: datetime + :param size: The size of the avatar, e.g. small, medium, or large. + :type size: object + """ + + _attribute_map = { + 'image': {'key': 'image', 'type': 'str'}, + 'is_auto_generated': {'key': 'isAutoGenerated', 'type': 'bool'}, + 'last_modified': {'key': 'lastModified', 'type': 'iso-8601'}, + 'size': {'key': 'size', 'type': 'object'} + } + + def __init__(self, image=None, is_auto_generated=None, last_modified=None, size=None): + super(Avatar, self).__init__() + self.image = image + self.is_auto_generated = is_auto_generated + self.last_modified = last_modified + self.size = size diff --git a/vsts/vsts/user/v4_1/models/create_user_parameters.py b/vsts/vsts/user/v4_1/models/create_user_parameters.py new file mode 100644 index 00000000..03801e6c --- /dev/null +++ b/vsts/vsts/user/v4_1/models/create_user_parameters.py @@ -0,0 +1,45 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# Generated file, DO NOT EDIT +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class CreateUserParameters(Model): + """CreateUserParameters. + + :param country: The user's country of residence or association. + :type country: str + :param data: + :type data: dict + :param descriptor: The user's unique identifier, and the primary means by which the user is referenced. + :type descriptor: :class:`str ` + :param display_name: The user's name, as displayed throughout the product. + :type display_name: str + :param mail: The user's preferred email address. + :type mail: str + :param region: The region in which the user resides or is associated. + :type region: str + """ + + _attribute_map = { + 'country': {'key': 'country', 'type': 'str'}, + 'data': {'key': 'data', 'type': '{object}'}, + 'descriptor': {'key': 'descriptor', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'mail': {'key': 'mail', 'type': 'str'}, + 'region': {'key': 'region', 'type': 'str'} + } + + def __init__(self, country=None, data=None, descriptor=None, display_name=None, mail=None, region=None): + super(CreateUserParameters, self).__init__() + self.country = country + self.data = data + self.descriptor = descriptor + self.display_name = display_name + self.mail = mail + self.region = region diff --git a/vsts/vsts/user/v4_1/models/mail_confirmation_parameters.py b/vsts/vsts/user/v4_1/models/mail_confirmation_parameters.py new file mode 100644 index 00000000..a8c07359 --- /dev/null +++ b/vsts/vsts/user/v4_1/models/mail_confirmation_parameters.py @@ -0,0 +1,29 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# Generated file, DO NOT EDIT +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class MailConfirmationParameters(Model): + """MailConfirmationParameters. + + :param challenge_code: The unique code that proves ownership of the email address. + :type challenge_code: str + :param mail_address: The email address to be confirmed. + :type mail_address: str + """ + + _attribute_map = { + 'challenge_code': {'key': 'challengeCode', 'type': 'str'}, + 'mail_address': {'key': 'mailAddress', 'type': 'str'} + } + + def __init__(self, challenge_code=None, mail_address=None): + super(MailConfirmationParameters, self).__init__() + self.challenge_code = challenge_code + self.mail_address = mail_address diff --git a/vsts/vsts/user/v4_1/models/reference_links.py b/vsts/vsts/user/v4_1/models/reference_links.py new file mode 100644 index 00000000..54f03acd --- /dev/null +++ b/vsts/vsts/user/v4_1/models/reference_links.py @@ -0,0 +1,25 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# Generated file, DO NOT EDIT +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ReferenceLinks(Model): + """ReferenceLinks. + + :param links: The readonly view of the links. Because Reference links are readonly, we only want to expose them as read only. + :type links: dict + """ + + _attribute_map = { + 'links': {'key': 'links', 'type': '{object}'} + } + + def __init__(self, links=None): + super(ReferenceLinks, self).__init__() + self.links = links diff --git a/vsts/vsts/user/v4_1/models/send_user_notification_parameters.py b/vsts/vsts/user/v4_1/models/send_user_notification_parameters.py new file mode 100644 index 00000000..c5936eba --- /dev/null +++ b/vsts/vsts/user/v4_1/models/send_user_notification_parameters.py @@ -0,0 +1,29 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# Generated file, DO NOT EDIT +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class SendUserNotificationParameters(Model): + """SendUserNotificationParameters. + + :param notification: Notification to be delivered + :type notification: :class:`UserNotification ` + :param recipients: Users whom this notification is addressed to + :type recipients: list of :class:`str ` + """ + + _attribute_map = { + 'notification': {'key': 'notification', 'type': 'UserNotification'}, + 'recipients': {'key': 'recipients', 'type': '[str]'} + } + + def __init__(self, notification=None, recipients=None): + super(SendUserNotificationParameters, self).__init__() + self.notification = notification + self.recipients = recipients diff --git a/vsts/vsts/user/v4_1/models/set_user_attribute_parameters.py b/vsts/vsts/user/v4_1/models/set_user_attribute_parameters.py new file mode 100644 index 00000000..bdfd9cfb --- /dev/null +++ b/vsts/vsts/user/v4_1/models/set_user_attribute_parameters.py @@ -0,0 +1,37 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# Generated file, DO NOT EDIT +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class SetUserAttributeParameters(Model): + """SetUserAttributeParameters. + + :param last_modified: The date/time at which the attribute was last modified. + :type last_modified: datetime + :param name: The unique group-prefixed name of the attribute, e.g. "TFS.TimeZone". + :type name: str + :param revision: The attribute's revision, for change tracking. + :type revision: int + :param value: The value of the attribute. + :type value: str + """ + + _attribute_map = { + 'last_modified': {'key': 'lastModified', 'type': 'iso-8601'}, + 'name': {'key': 'name', 'type': 'str'}, + 'revision': {'key': 'revision', 'type': 'int'}, + 'value': {'key': 'value', 'type': 'str'} + } + + def __init__(self, last_modified=None, name=None, revision=None, value=None): + super(SetUserAttributeParameters, self).__init__() + self.last_modified = last_modified + self.name = name + self.revision = revision + self.value = value diff --git a/vsts/vsts/user/v4_1/models/update_user_parameters.py b/vsts/vsts/user/v4_1/models/update_user_parameters.py new file mode 100644 index 00000000..5726e001 --- /dev/null +++ b/vsts/vsts/user/v4_1/models/update_user_parameters.py @@ -0,0 +1,25 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# Generated file, DO NOT EDIT +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class UpdateUserParameters(Model): + """UpdateUserParameters. + + :param properties: The collection of properties to set. See "User" for valid fields. + :type properties: :class:`object ` + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'object'} + } + + def __init__(self, properties=None): + super(UpdateUserParameters, self).__init__() + self.properties = properties diff --git a/vsts/vsts/user/v4_1/models/user.py b/vsts/vsts/user/v4_1/models/user.py new file mode 100644 index 00000000..98b3c9c4 --- /dev/null +++ b/vsts/vsts/user/v4_1/models/user.py @@ -0,0 +1,73 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# Generated file, DO NOT EDIT +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class User(Model): + """User. + + :param bio: A short blurb of "about me"-style text. + :type bio: str + :param blog: A link to an external blog. + :type blog: str + :param company: The company at which the user is employed. + :type company: str + :param country: The user's country of residence or association. + :type country: str + :param date_created: The date the user was created in the system + :type date_created: datetime + :param descriptor: The user's unique identifier, and the primary means by which the user is referenced. + :type descriptor: :class:`str ` + :param display_name: The user's name, as displayed throughout the product. + :type display_name: str + :param last_modified: The date/time at which the user data was last modified. + :type last_modified: datetime + :param links: A set of readonly links for obtaining more info about the user. + :type links: :class:`ReferenceLinks ` + :param mail: The user's preferred email address. + :type mail: str + :param revision: The attribute's revision, for change tracking. + :type revision: int + :param unconfirmed_mail: The user's preferred email address which has not yet been confirmed. + :type unconfirmed_mail: str + :param user_name: The unique name of the user. + :type user_name: str + """ + + _attribute_map = { + 'bio': {'key': 'bio', 'type': 'str'}, + 'blog': {'key': 'blog', 'type': 'str'}, + 'company': {'key': 'company', 'type': 'str'}, + 'country': {'key': 'country', 'type': 'str'}, + 'date_created': {'key': 'dateCreated', 'type': 'iso-8601'}, + 'descriptor': {'key': 'descriptor', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'last_modified': {'key': 'lastModified', 'type': 'iso-8601'}, + 'links': {'key': 'links', 'type': 'ReferenceLinks'}, + 'mail': {'key': 'mail', 'type': 'str'}, + 'revision': {'key': 'revision', 'type': 'int'}, + 'unconfirmed_mail': {'key': 'unconfirmedMail', 'type': 'str'}, + 'user_name': {'key': 'userName', 'type': 'str'} + } + + def __init__(self, bio=None, blog=None, company=None, country=None, date_created=None, descriptor=None, display_name=None, last_modified=None, links=None, mail=None, revision=None, unconfirmed_mail=None, user_name=None): + super(User, self).__init__() + self.bio = bio + self.blog = blog + self.company = company + self.country = country + self.date_created = date_created + self.descriptor = descriptor + self.display_name = display_name + self.last_modified = last_modified + self.links = links + self.mail = mail + self.revision = revision + self.unconfirmed_mail = unconfirmed_mail + self.user_name = user_name diff --git a/vsts/vsts/user/v4_1/models/user_attribute.py b/vsts/vsts/user/v4_1/models/user_attribute.py new file mode 100644 index 00000000..6e0da83c --- /dev/null +++ b/vsts/vsts/user/v4_1/models/user_attribute.py @@ -0,0 +1,37 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# Generated file, DO NOT EDIT +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class UserAttribute(Model): + """UserAttribute. + + :param last_modified: The date/time at which the attribute was last modified. + :type last_modified: datetime + :param name: The unique group-prefixed name of the attribute, e.g. "TFS.TimeZone". + :type name: str + :param revision: The attribute's revision, for change tracking. + :type revision: int + :param value: The value of the attribute. + :type value: str + """ + + _attribute_map = { + 'last_modified': {'key': 'lastModified', 'type': 'iso-8601'}, + 'name': {'key': 'name', 'type': 'str'}, + 'revision': {'key': 'revision', 'type': 'int'}, + 'value': {'key': 'value', 'type': 'str'} + } + + def __init__(self, last_modified=None, name=None, revision=None, value=None): + super(UserAttribute, self).__init__() + self.last_modified = last_modified + self.name = name + self.revision = revision + self.value = value diff --git a/vsts/vsts/user/v4_1/models/user_attributes.py b/vsts/vsts/user/v4_1/models/user_attributes.py new file mode 100644 index 00000000..d06fb34f --- /dev/null +++ b/vsts/vsts/user/v4_1/models/user_attributes.py @@ -0,0 +1,29 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# Generated file, DO NOT EDIT +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class UserAttributes(Model): + """UserAttributes. + + :param attributes: Collection of attributes + :type attributes: list of :class:`UserAttribute ` + :param continuation_token: Opaque string to get the next chunk of results Server would return non-null string here if there is more data Client will need then to pass it to the server to get more results + :type continuation_token: str + """ + + _attribute_map = { + 'attributes': {'key': 'attributes', 'type': '[UserAttribute]'}, + 'continuation_token': {'key': 'continuationToken', 'type': 'str'} + } + + def __init__(self, attributes=None, continuation_token=None): + super(UserAttributes, self).__init__() + self.attributes = attributes + self.continuation_token = continuation_token diff --git a/vsts/vsts/user/v4_1/models/user_notification.py b/vsts/vsts/user/v4_1/models/user_notification.py new file mode 100644 index 00000000..aeddef33 --- /dev/null +++ b/vsts/vsts/user/v4_1/models/user_notification.py @@ -0,0 +1,29 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# Generated file, DO NOT EDIT +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class UserNotification(Model): + """UserNotification. + + :param event_id: Unique notification id (must be idempotent) + :type event_id: str + :param time_stamp: Time at which notification was posted (must be idempotent) + :type time_stamp: datetime + """ + + _attribute_map = { + 'event_id': {'key': 'eventId', 'type': 'str'}, + 'time_stamp': {'key': 'timeStamp', 'type': 'iso-8601'} + } + + def __init__(self, event_id=None, time_stamp=None): + super(UserNotification, self).__init__() + self.event_id = event_id + self.time_stamp = time_stamp diff --git a/vsts/vsts/user/v4_1/models/user_notifications.py b/vsts/vsts/user/v4_1/models/user_notifications.py new file mode 100644 index 00000000..b3528bcc --- /dev/null +++ b/vsts/vsts/user/v4_1/models/user_notifications.py @@ -0,0 +1,29 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# Generated file, DO NOT EDIT +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class UserNotifications(Model): + """UserNotifications. + + :param continuation_token: Continuation token to query the next segment + :type continuation_token: str + :param notifications: Collection of notifications + :type notifications: list of :class:`UserNotification ` + """ + + _attribute_map = { + 'continuation_token': {'key': 'continuationToken', 'type': 'str'}, + 'notifications': {'key': 'notifications', 'type': '[UserNotification]'} + } + + def __init__(self, continuation_token=None, notifications=None): + super(UserNotifications, self).__init__() + self.continuation_token = continuation_token + self.notifications = notifications diff --git a/vsts/vsts/user/v4_1/user_client.py b/vsts/vsts/user/v4_1/user_client.py new file mode 100644 index 00000000..ed83a567 --- /dev/null +++ b/vsts/vsts/user/v4_1/user_client.py @@ -0,0 +1,326 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# Generated file, DO NOT EDIT +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------------------------- + +from msrest import Serializer, Deserializer +from ...vss_client import VssClient +from . import models + + +class UserClient(VssClient): + """User + :param str base_url: Service URL + :param Authentication creds: Authenticated credentials. + """ + + def __init__(self, base_url=None, creds=None): + super(UserClient, self).__init__(base_url, creds) + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + resource_area_identifier = None + + def delete_attribute(self, descriptor, attribute_name): + """DeleteAttribute. + [Preview API] Deletes an attribute for the given user. + :param str descriptor: The identity of the user for the operation. + :param str attribute_name: The name of the attribute to delete. + """ + route_values = {} + if descriptor is not None: + route_values['descriptor'] = self._serialize.url('descriptor', descriptor, 'str') + if attribute_name is not None: + route_values['attributeName'] = self._serialize.url('attribute_name', attribute_name, 'str') + self._send(http_method='DELETE', + location_id='ac77b682-1ef8-4277-afde-30af9b546004', + version='4.1-preview.2', + route_values=route_values) + + def get_attribute(self, descriptor, attribute_name): + """GetAttribute. + [Preview API] Retrieves an attribute for a given user. + :param str descriptor: The identity of the user for the operation. + :param str attribute_name: The name of the attribute to retrieve. + :rtype: :class:` ` + """ + route_values = {} + if descriptor is not None: + route_values['descriptor'] = self._serialize.url('descriptor', descriptor, 'str') + if attribute_name is not None: + route_values['attributeName'] = self._serialize.url('attribute_name', attribute_name, 'str') + response = self._send(http_method='GET', + location_id='ac77b682-1ef8-4277-afde-30af9b546004', + version='4.1-preview.2', + route_values=route_values) + return self._deserialize('UserAttribute', response) + + def query_attributes(self, descriptor, continuation_token=None, query_pattern=None, modified_after=None): + """QueryAttributes. + [Preview API] Retrieves attributes for a given user. May return subset of attributes providing continuation token to retrieve the next batch + :param str descriptor: The identity of the user for the operation. + :param str continuation_token: The token telling server to return the next chunk of attributes from where it stopped last time. This must either be null or be a value returned from the previous call to this API + :param str query_pattern: The wildcardable pattern for the attribute names to be retrieved, e.g. queryPattern=visualstudio.14.* + :param str modified_after: The optional date/time of the minimum modification date for attributes to be retrieved, e.g. modifiedafter=2017-04-12T15:00:00.000Z + :rtype: :class:` ` + """ + route_values = {} + if descriptor is not None: + route_values['descriptor'] = self._serialize.url('descriptor', descriptor, 'str') + query_parameters = {} + if continuation_token is not None: + query_parameters['continuationToken'] = self._serialize.query('continuation_token', continuation_token, 'str') + if query_pattern is not None: + query_parameters['queryPattern'] = self._serialize.query('query_pattern', query_pattern, 'str') + if modified_after is not None: + query_parameters['modifiedAfter'] = self._serialize.query('modified_after', modified_after, 'str') + response = self._send(http_method='GET', + location_id='ac77b682-1ef8-4277-afde-30af9b546004', + version='4.1-preview.2', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('UserAttributes', response) + + def set_attributes(self, attribute_parameters_list, descriptor): + """SetAttributes. + [Preview API] Updates multiple attributes for a given user. + :param [SetUserAttributeParameters] attribute_parameters_list: The list of attribute data to update. Existing values will be overwritten. + :param str descriptor: The identity of the user for the operation. + :rtype: [UserAttribute] + """ + route_values = {} + if descriptor is not None: + route_values['descriptor'] = self._serialize.url('descriptor', descriptor, 'str') + content = self._serialize.body(attribute_parameters_list, '[SetUserAttributeParameters]') + response = self._send(http_method='PATCH', + location_id='ac77b682-1ef8-4277-afde-30af9b546004', + version='4.1-preview.2', + route_values=route_values, + content=content, + returns_collection=True) + return self._deserialize('[UserAttribute]', response) + + def delete_avatar(self, descriptor): + """DeleteAvatar. + [Preview API] Deletes a user's avatar. + :param str descriptor: The identity of the user for the operation. + """ + route_values = {} + if descriptor is not None: + route_values['descriptor'] = self._serialize.url('descriptor', descriptor, 'str') + self._send(http_method='DELETE', + location_id='1c34cdf0-dd20-4370-a316-56ba776d75ce', + version='4.1-preview.1', + route_values=route_values) + + def get_avatar(self, descriptor, size=None, format=None): + """GetAvatar. + [Preview API] Retrieves the user's avatar. + :param str descriptor: The identity of the user for the operation. + :param str size: The size to retrieve, e.g. small, medium (default), or large. + :param str format: The format for the response. Can be null. Accepted values: "png", "json" + :rtype: :class:` ` + """ + route_values = {} + if descriptor is not None: + route_values['descriptor'] = self._serialize.url('descriptor', descriptor, 'str') + query_parameters = {} + if size is not None: + query_parameters['size'] = self._serialize.query('size', size, 'str') + if format is not None: + query_parameters['format'] = self._serialize.query('format', format, 'str') + response = self._send(http_method='GET', + location_id='1c34cdf0-dd20-4370-a316-56ba776d75ce', + version='4.1-preview.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('Avatar', response) + + def set_avatar(self, avatar, descriptor): + """SetAvatar. + [Preview API] Creates or updates an avatar to be associated with a given user. + :param :class:` ` avatar: The avatar to set. The Image property must contain the binary representation of the image, in either jpg or png format. + :param str descriptor: The identity of the user for the operation. + """ + route_values = {} + if descriptor is not None: + route_values['descriptor'] = self._serialize.url('descriptor', descriptor, 'str') + content = self._serialize.body(avatar, 'Avatar') + self._send(http_method='PUT', + location_id='1c34cdf0-dd20-4370-a316-56ba776d75ce', + version='4.1-preview.1', + route_values=route_values, + content=content) + + def create_avatar_preview(self, avatar, descriptor, size=None, display_name=None): + """CreateAvatarPreview. + [Preview API] + :param :class:` ` avatar: + :param str descriptor: + :param str size: + :param str display_name: + :rtype: :class:` ` + """ + route_values = {} + if descriptor is not None: + route_values['descriptor'] = self._serialize.url('descriptor', descriptor, 'str') + query_parameters = {} + if size is not None: + query_parameters['size'] = self._serialize.query('size', size, 'str') + if display_name is not None: + query_parameters['displayName'] = self._serialize.query('display_name', display_name, 'str') + content = self._serialize.body(avatar, 'Avatar') + response = self._send(http_method='POST', + location_id='aad154d3-750f-47e6-9898-dc3a2e7a1708', + version='4.1-preview.1', + route_values=route_values, + query_parameters=query_parameters, + content=content) + return self._deserialize('Avatar', response) + + def get_descriptor(self, descriptor): + """GetDescriptor. + [Preview API] + :param str descriptor: + :rtype: :class:` ` + """ + route_values = {} + if descriptor is not None: + route_values['descriptor'] = self._serialize.url('descriptor', descriptor, 'str') + response = self._send(http_method='GET', + location_id='e338ed36-f702-44d3-8d18-9cba811d013a', + version='4.1-preview.1', + route_values=route_values) + return self._deserialize('str', response) + + def confirm_mail(self, confirmation_parameters, descriptor): + """ConfirmMail. + [Preview API] Confirms preferred email for a given user. + :param :class:` ` confirmation_parameters: + :param str descriptor: The descriptor identifying the user for the operation. + """ + route_values = {} + if descriptor is not None: + route_values['descriptor'] = self._serialize.url('descriptor', descriptor, 'str') + content = self._serialize.body(confirmation_parameters, 'MailConfirmationParameters') + self._send(http_method='POST', + location_id='fc213dcd-3a4e-4951-a2e2-7e3fed15706d', + version='4.1-preview.1', + route_values=route_values, + content=content) + + def write_notifications(self, notifications): + """WriteNotifications. + [Preview API] Stores/forwards provided notifications Accepts batch of notifications and each of those may be targeting multiple users + :param [SendUserNotificationParameters] notifications: Collection of notifications to be persisted. + """ + content = self._serialize.body(notifications, '[SendUserNotificationParameters]') + self._send(http_method='POST', + location_id='63e9e5c8-09a5-4de6-9aa1-01a96219073c', + version='4.1-preview.1', + content=content) + + def query_notifications(self, descriptor, top=None, continuation_token=None): + """QueryNotifications. + [Preview API] Queries notifications for a given user + :param str descriptor: The identity of the user for the operation. + :param int top: Maximum amount of items to retrieve. + :param str continuation_token: Token representing the position to restart reading notifications from. + :rtype: :class:` ` + """ + route_values = {} + if descriptor is not None: + route_values['descriptor'] = self._serialize.url('descriptor', descriptor, 'str') + query_parameters = {} + if top is not None: + query_parameters['top'] = self._serialize.query('top', top, 'int') + if continuation_token is not None: + query_parameters['continuationToken'] = self._serialize.query('continuation_token', continuation_token, 'str') + response = self._send(http_method='GET', + location_id='58ff9476-0a49-4a70-81d6-1ef63d4f92e8', + version='4.1-preview.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('UserNotifications', response) + + def get_storage_key(self, descriptor): + """GetStorageKey. + [Preview API] + :param str descriptor: + :rtype: str + """ + route_values = {} + if descriptor is not None: + route_values['descriptor'] = self._serialize.url('descriptor', descriptor, 'str') + response = self._send(http_method='GET', + location_id='c1d0bf9e-3220-44d9-b048-222ae15fc3e4', + version='4.1-preview.1', + route_values=route_values) + return self._deserialize('str', response) + + def get_user_defaults(self): + """GetUserDefaults. + [Preview API] Retrieves the default data for the authenticated user. + :rtype: :class:` ` + """ + response = self._send(http_method='GET', + location_id='a9e65880-7489-4453-aa72-0f7896f0b434', + version='4.1-preview.1') + return self._deserialize('User', response) + + def create_user(self, user_parameters, create_local=None): + """CreateUser. + [Preview API] Creates a new user. + :param :class:` ` user_parameters: The parameters to be used for user creation. + :param bool create_local: + :rtype: :class:` ` + """ + query_parameters = {} + if create_local is not None: + query_parameters['createLocal'] = self._serialize.query('create_local', create_local, 'bool') + content = self._serialize.body(user_parameters, 'CreateUserParameters') + response = self._send(http_method='POST', + location_id='61117502-a055-422c-9122-b56e6643ed02', + version='4.1-preview.2', + query_parameters=query_parameters, + content=content) + return self._deserialize('User', response) + + def get_user(self, descriptor, create_if_not_exists=None): + """GetUser. + [Preview API] Retrieves the data for a given user. + :param str descriptor: The identity of the user for the operation. + :param Boolean create_if_not_exists: Whether to auto-provision the authenticated user + :rtype: :class:` ` + """ + route_values = {} + if descriptor is not None: + route_values['descriptor'] = self._serialize.url('descriptor', descriptor, 'str') + response = self._send(http_method='GET', + location_id='61117502-a055-422c-9122-b56e6643ed02', + version='4.1-preview.2', + route_values=route_values) + return self._deserialize('User', response) + + def update_user(self, user_parameters, descriptor): + """UpdateUser. + [Preview API] Updates an existing user. + :param :class:` ` user_parameters: The parameters to be used for user update. + :param str descriptor: The identity of the user for the operation. + :rtype: :class:` ` + """ + route_values = {} + if descriptor is not None: + route_values['descriptor'] = self._serialize.url('descriptor', descriptor, 'str') + content = self._serialize.body(user_parameters, 'UpdateUserParameters') + response = self._send(http_method='PATCH', + location_id='61117502-a055-422c-9122-b56e6643ed02', + version='4.1-preview.2', + route_values=route_values, + content=content) + return self._deserialize('User', response) + diff --git a/vsts/vsts/work/v4_1/work_client.py b/vsts/vsts/work/v4_1/work_client.py index eb912647..68d5d9cc 100644 --- a/vsts/vsts/work/v4_1/work_client.py +++ b/vsts/vsts/work/v4_1/work_client.py @@ -930,7 +930,7 @@ def get_team_iterations(self, team_context, timeframe=None): """GetTeamIterations. Get a team's iterations using timeframe filter :param :class:` ` team_context: The team context for the operation - :param str timeframe: A filter for which iterations are returned based on relative time + :param str timeframe: A filter for which iterations are returned based on relative time. Only Current is supported currently. :rtype: [TeamSettingsIteration] """ project = None