# -*- coding: utf-8 -*-
from distutils.core import setup

packages = \
['simple_smartsheet', 'simple_smartsheet.models']

package_data = \
{'': ['*']}

install_requires = \
['attrs>=18.2,<19.0',
 'cattrs>=0.9.0,<0.10.0',
 'marshmallow>=3.0.0b19,<4.0.0',
 'pendulum>=2.0,<3.0',
 'python-decouple>=3.1,<4.0',
 'requests>=2.20,<3.0']

setup_kwargs = {
    'name': 'simple-smartsheet',
    'version': '0.1.1',
    'description': 'Python library to interact with Smartsheet objects',
    'long_description': '## Simple Smartsheet\nPython library to interact with Smartsheet API easily\n\n### Installation\nRequires Python 3.6+  \n`pip install simple-smartsheet`\n\n### Why not smartsheet-python-sdk\n`smartsheet-python-sdk` has very wide object coverage and maps to Smartsheet API very nicely, but it does not have any additional features (for example, easy access to cells by column titles).  \n`simple-smartsheet` library is focused on user experience first in expense of feature coverage. \nAs of now, you can only interact with Sheets and nested objects (rows, columns, cells).\n\n### Code Example\n```python\nfrom simple_smartsheet import Smartsheet\nfrom simple_smartsheet.models import Sheet, Column, Row, Cell\nfrom pprint import pprint\n\nTOKEN = \'my-smartsheet-token\'\nsmartsheet = Smartsheet(TOKEN)\n\n# creating new Sheet\nnew_sheet = Sheet(\n    name="My New Sheet",\n    columns=[\n        Column(primary=True, title="Full Name", type="TEXT_NUMBER"),\n        Column(title="Number of read books", type="TEXT_NUMBER"),\n    ]\n)\n\n# print the sheet object as a dictionary which will be used in REST API\npprint(new_sheet.dump())\n\n# adding the sheet via API\nsmartsheet.sheets.create(new_sheet)\n\n# getting a simplified view of sheets\nsheets = smartsheet.sheets.list()\npprint(sheets)\n\n# getting the sheet by name\nsheet = smartsheet.sheets.get(\'My New Sheet\')\n\n# printing the sheet object attributes\npprint(sheet.__dict__)\n# or printing the sheet object as a dictionary which will be used in REST API\npprint(sheet.dump())\n\n# getting columns details by column title (case-sensitive)\nfull_name_column = sheet.get_column(\'Full Name\')\npprint(full_name_column.__dict__)\nnum_books_column = sheet.get_column(\'Number of read books\')\npprint(num_books_column.__dict__)\n\n# adding rows:\nsheet.add_rows([\n    Row(\n        to_top=True,\n        cells=[\n            Cell(column_id=full_name_column.id, value="Alice Smith"),\n            Cell(column_id=num_books_column.id, value=5),\n        ],\n    ),\n    Row(\n        to_top=True,\n        cells=[\n            Cell(column_id=full_name_column.id, value="Bob Lee"),\n            Cell(column_id=num_books_column.id, value=2),\n        ],\n    ),\n    Row(\n        to_top=True,\n        cells=[\n            Cell(column_id=full_name_column.id, value="Charlie Brown"),\n            Cell(column_id=num_books_column.id, value=1),\n        ],\n    ),\n])\n\n# getting an updated sheet\nsheet = smartsheet.sheets.get(\'My New Sheet\')\nprint("Sheet after adding rows:")\npprint(sheet.__dict__)\n\n# getting a specific cell and updating it:\nrow_id_to_delete = None\nrows_to_update = []\nfor row in sheet.rows:\n    full_name = row.get_cell(\'Full Name\').value\n    num_books = row.get_cell(\'Number of read books\').value\n    print(f\'{full_name} has read {num_books} books\')\n    if full_name.startswith(\'Charlie\'):\n        num_books_cell = row.get_cell(\'Number of read books\')\n        num_books_cell.value += 1\n        rows_to_update.append(row)\n    elif full_name.startswith(\'Bob\'):\n        row_id_to_delete = row.id  # used later\n\n# update rows\nsheet.update_rows(rows_to_update)\n# or a single row\n# sheet.update_rows(rows_to_update[0])\n\n# getting an updated sheet\nsheet = smartsheet.sheets.get(\'My New Sheet\')\nprint("Sheet after updating rows:")\npprint(sheet.__dict__)\n\n# deleting row by id\nsheet.delete_row(row_id_to_delete)\n\n# getting an updated sheet\nsheet = smartsheet.sheets.get(\'My New Sheet\')\nprint("Sheet after deleting rows:")\npprint(sheet.__dict__)\n\n# deleting Sheet\nsheet = smartsheet.sheets.delete(\'My New Sheet\')\nsheets = smartsheet.sheets.list()\npprint(sheets)\n```\n\n### Docs\nWhile a separate docs page is work in progress, available public API is described here\n#### Class `simple_smartsheet.Smartsheet`\nThis class a main entry point for the library  \nMethods:\n  * `def __init__(token: str)`: constructor for the class\n  \nAttributes:\n  * `token`: Smartsheet API token, obtained in Personal Settings -> API access\n  * `session`: requests.Session object which stores headers based on the token\n  * `sheets`: `simple_smartsheet.models.sheet.SheetsCRUD` object which provides methods to interact with Sheets\n  \n#### Class `simple_smartsheet.models.sheet.SheetsCRUD`\nMethods:\n  * `def get(name: Optional[str], id: Optional[int])`: fetches Sheet by name or ID\n  * `def list()`: fetches a list of all sheets (summary only)\n  * `def create(obj: Sheet)`: adds a new sheet\n  * `def update(obj: Sheet)`: updates a sheet\n  * `def delete(name: Optional[str], id: Optional[int])`: deletes a sheet by name or ID\n\n#### Class `simple_smartsheet.models.Sheet`\nAttributes (converted from camelCase to snake_case):\n  * [http://smartsheet-platform.github.io/api-docs/#sheets](http://smartsheet-platform.github.io/api-docs/#sheets)\n  \nMethods:\n  * `def update_index()`: rebuilds mapping tables for rows and columns for quick lookup\n  * `def get_row(row_num: Optional[int], row_id: Optional[int])`: returns a Row object by row number or ID\n  * `def get_column(column_title: Optional[str], column_id: Optional[int])`: returns a Column object by column title or id\n  * `def add_rows(rows: Sequence[Row])`: adds rows to the sheet\n  * `def add_row(row: Row)`: add a single row to the sheet\n  * `def update_rows(rows: Sequence[Row])`: updates several rows in the sheet\n  * `def update_row(row: Row)`: updates a single row\n  * `def delete_rows(row_ids: Sequence[int])`: delete several rows with provided ids\n  * `def delete_row(row_id: int)`: delete a single row with a provided id\n  \n#### Class `simple_smartsheet.models.Row`\nAttributes (converted from camelCase to snake_case):\n  * [http://smartsheet-platform.github.io/api-docs/#rows](http://smartsheet-platform.github.io/api-docs/#rows)\n  * `rowNumber` is mapped to `num`\n  \nMethods:\n  * `def get_cell(column_title: Optional[str], column_id: Optional[int])` - returns a Cell object by column title (case-sensitive) or column id\n\n#### Class `simple_smartsheet.models.Column`\nAttributes (converted from camelCase to snake_case):\n  * [http://smartsheet-platform.github.io/api-docs/#columns](http://smartsheet-platform.github.io/api-docs/#columns)\n\n#### Class `simple_smartsheet.models.Cell`\nAttributes (converted from camelCase to snake_case):\n  * [http://smartsheet-platform.github.io/api-docs/#cells](http://smartsheet-platform.github.io/api-docs/#cells)',
    'author': 'Dmitry Figol',
    'author_email': 'git@dmfigol.me',
    'url': 'https://github.com/dmfigol/simple-smartsheet',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'python_requires': '>=3.6',
}


setup(**setup_kwargs)
