Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [x.x.x] - Unreleased

### Fixed

- Update correct method types, which may return either list or a singleton object

## [3.7.0] - 2025-12-11

### Added
Expand Down
7 changes: 4 additions & 3 deletions smartsheet/favorites.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from __future__ import absolute_import

from typing import Union
from typing import Union, List

import logging

Expand All @@ -34,7 +34,7 @@ def __init__(self, smartsheet_obj):
self._base = smartsheet_obj
self._log = logging.getLogger(__name__)

def add_favorites(self, favorite_obj) -> Union[Result[Favorite], Error]:
def add_favorites(self, favorite_obj) -> Union[Result[Union[Favorite, List[Favorite]]], Error]:
"""Add one or more items to the user's list of Favorite items.

Adds one or more items to the user's list of Favorite
Expand All @@ -50,7 +50,8 @@ def add_favorites(self, favorite_obj) -> Union[Result[Favorite], Error]:
more Favorite objects

Returns:
Union[Result[Favorite], Error]: The result of the operation, or an Error object if the request fails.
Union[Result[Union[Favorite, List[Favorite]]], Error]: The result of the operation - either a list or a
single object, or an Error object if the request fails.
"""
_op = fresh_operation("add_favorites")
_op["method"] = "POST"
Expand Down
7 changes: 4 additions & 3 deletions smartsheet/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from __future__ import absolute_import

from typing import Union
from typing import Union, List

import logging

Expand All @@ -34,7 +34,7 @@ def __init__(self, smartsheet_obj):
self._base = smartsheet_obj
self._log = logging.getLogger(__name__)

def add_members(self, group_id, group_member_obj) -> Union[Result[GroupMember], Error]:
def add_members(self, group_id, group_member_obj) -> Union[Result[Union[GroupMember, List[GroupMember]]], Error]:
"""Add one or more members to a Group.

Args:
Expand All @@ -43,7 +43,8 @@ def add_members(self, group_id, group_member_obj) -> Union[Result[GroupMember],
object(s).

Returns:
Union[Result[GroupMember], Error]: The result of the operation, or an Error object if the request fails.
Union[Result[Union[GroupMember, List[GroupMember]]], Error]: The result of the operation - either a list or
a single object, or an Error object if the request fails.
"""
_op = fresh_operation("add_members")
_op["method"] = "POST"
Expand Down
14 changes: 7 additions & 7 deletions smartsheet/sheets.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import logging
import os.path
from datetime import datetime
from typing import Union
from typing import Union, List

import six

Expand All @@ -40,7 +40,7 @@ def __init__(self, smartsheet_obj):
self._base = smartsheet_obj
self._log = logging.getLogger(__name__)

def add_columns(self, sheet_id, list_of_columns) -> Union[Result[Column], Error]:
def add_columns(self, sheet_id, list_of_columns) -> Union[Result[Union[Column, List[Column]]], Error]:
"""Insert one or more Columns into the specified Sheet

Args:
Expand All @@ -49,7 +49,7 @@ def add_columns(self, sheet_id, list_of_columns) -> Union[Result[Column], Error]
Column objects

Returns:
Union[Result[Column], Error]: The result of the operation, or an Error object if the request fails.
Union[Result[Union[Column, List[Column]]], Error]: The result of the operation - either a list or a single object, or an Error object if the request fails.
"""

if isinstance(list_of_columns, (dict, Column)):
Expand All @@ -69,7 +69,7 @@ def add_columns(self, sheet_id, list_of_columns) -> Union[Result[Column], Error]

return response

def add_rows(self, sheet_id, list_of_rows) -> Union[Result[Row], Error]:
def add_rows(self, sheet_id, list_of_rows) -> Union[Result[Union[Row, List[Row]]], Error]:
"""Insert one or more Rows into the specified Sheet.

If multiple rows are specified in the request, all rows
Expand Down Expand Up @@ -109,7 +109,7 @@ def add_rows(self, sheet_id, list_of_rows) -> Union[Result[Row], Error]:
hyperlink (optional)

Returns:
Union[Result[Row], Error]: The result of the operation, or an Error object if the request fails.
Union[Result[Union[Row, List[Row]]], Error]: The result of the operation - either a list or a single object, or an Error object if the request fails.
"""
if isinstance(list_of_rows, (dict, Row)):
arg_value = list_of_rows
Expand Down Expand Up @@ -281,7 +281,7 @@ def delete_column(self, sheet_id, column_id) -> Union[Result[None], Error]:

return response

def delete_rows(self, sheet_id, ids, ignore_rows_not_found=False) -> Union[Result[NumberObjectValue], Error]:
def delete_rows(self, sheet_id, ids, ignore_rows_not_found=False) -> Union[Result[List[NumberObjectValue]], Error]:
"""Deletes one or more Row(s) from the specified Sheeet.

Args:
Expand All @@ -296,7 +296,7 @@ def delete_rows(self, sheet_id, ids, ignore_rows_not_found=False) -> Union[Resul
will be altered).

Returns:
Union[Result[NumberObjectValue], Error]: The result of the operation, or an Error object if the request fails.
Union[Result[List[NumberObjectValue]], Error]: The result of the operation - a list of deleted object IDs, or an Error object if the request fails.
"""
_op = fresh_operation("delete_rows")
_op["method"] = "DELETE"
Expand Down
6 changes: 3 additions & 3 deletions smartsheet/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from __future__ import absolute_import

from typing import Union
from typing import Union, List

import logging
from datetime import datetime
Expand All @@ -36,7 +36,7 @@ def __init__(self, smartsheet_obj):
self._base = smartsheet_obj
self._log = logging.getLogger(__name__)

def add_alternate_email(self, user_id, list_of_alternate_emails) -> Union[Result[AlternateEmail], Error]:
def add_alternate_email(self, user_id, list_of_alternate_emails) -> Union[Result[Union[AlternateEmail, List[AlternateEmail]]], Error]:
"""Add one or more alternate email addresses for the specified User

Args:
Expand All @@ -45,7 +45,7 @@ def add_alternate_email(self, user_id, list_of_alternate_emails) -> Union[Result
An array of one or more AlternateEmail objects.

Returns:
Union[Result[AlternateEmail], Error]: The result of the operation, or an Error object if the request fails.
Union[Result[List[AlternateEmail]], Error]: The result of the operation - either a list or a single object, or an Error object if the request fails.
"""
_op = fresh_operation("add_alternate_email")
_op["method"] = "POST"
Expand Down
Loading