Skip to content

Commit 83df1d5

Browse files
Merge pull request #64 from Asana/theaeolianmachine-20180201-121820
Deploy from asana-api-meta v0.11.2 (9de472d/master) by theaeolianmachine
2 parents e51b129 + e5f6bbd commit 83df1d5

12 files changed

Lines changed: 347 additions & 23 deletions

asana/resources/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
# This file is automatically generated by generate.py using api.json
22

3-
from . import attachments, custom_fields, custom_field_settings, events, projects, stories, tags, tasks, teams, users, webhooks, workspaces
3+
from . import (
4+
attachments, custom_fields, custom_field_settings, events,
5+
organization_exports, projects, sections, stories, tags, tasks, teams,
6+
users, webhooks, workspaces)

asana/resources/gen/custom_field_settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ def find_by_project(self, project, params={}, **options):
1818
[params] : {Object} Parameters for the request
1919
"""
2020
path = "/projects/%s/custom_field_settings" % (project)
21-
return self.client.get(path, params, **options)
21+
return self.client.get_collection(path, params, **options)

asana/resources/gen/custom_fields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ def find_by_workspace(self, workspace, params={}, **options):
2929
[params] : {Object} Parameters for the request
3030
"""
3131
path = "/workspaces/%s/custom_fields" % (workspace)
32-
return self.client.get(path, params, **options)
32+
return self.client.get_collection(path, params, **options)
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
class _OrganizationExports:
2+
"""An _organization_export_ object represents a request to export the complete data of an Organization
3+
in JSON format.
4+
5+
To export an Organization using this API:
6+
7+
* Create an `organization_export` [request](#create) and store the id that is returned.\
8+
* Request the `organization_export` every few minutes, until the `state` field contains 'finished'.\
9+
* Download the file located at the URL in the `download_url` field.
10+
11+
Exports can take a long time, from several minutes to a few hours for large Organizations.
12+
13+
**Note:** These endpoints are only available to [Service Accounts](/guide/help/premium/service-accounts)
14+
of an [Enterprise](/enterprise) Organization.
15+
"""
16+
17+
def __init__(self, client=None):
18+
self.client = client
19+
20+
def find_by_id(self, organization_export, params={}, **options):
21+
"""Returns details of a previously-requested Organization export.
22+
23+
Parameters
24+
----------
25+
organization_export : {Id} Globally unique identifier for the Organization export.
26+
[params] : {Object} Parameters for the request
27+
"""
28+
path = "/organization_exports/%s" % (organization_export)
29+
return self.client.get(path, params, **options)
30+
31+
def create(self, params={}, **options):
32+
"""This method creates a request to export an Organization. Asana will complete the export at some
33+
point after you create the request.
34+
35+
Parameters
36+
----------
37+
[data] : {Object} Data for the request
38+
- organization : {Id} Globally unique identifier for the workspace or organization.
39+
"""
40+
return self.client.post("/organization_exports", params, **options)

asana/resources/gen/projects.py

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
class _Projects:
2-
"""A _project_ represents a prioritized list of tasks in Asana. It exists in a
3-
single workspace or organization and is accessible to a subset of users in
4-
that workspace or organization, depending on its permissions.
2+
"""A _project_ represents a prioritized list of tasks in Asana or a board with
3+
columns of tasks represented as cards. It exists in a single workspace or
4+
organization and is accessible to a subset of users in that workspace or
5+
organization, depending on its permissions.
56
67
Projects in organizations are shared with a single team. You cannot currently
78
change the team of a project via the API. Non-organization workspaces do not
8-
have teams and so you should not specify the team of project in a
9-
regular workspace.
9+
have teams and so you should not specify the team of project in a regular
10+
workspace.
1011
"""
1112

1213
def __init__(self, client=None):
@@ -144,17 +145,6 @@ def find_by_team(self, team, params={}, **options):
144145
path = "/teams/%s/projects" % (team)
145146
return self.client.get_collection(path, params, **options)
146147

147-
def sections(self, project, params={}, **options):
148-
"""Returns compact records for all sections in the specified project.
149-
150-
Parameters
151-
----------
152-
project : {Id} The project to get sections from.
153-
[params] : {Object} Parameters for the request
154-
"""
155-
path = "/projects/%s/sections" % (project)
156-
return self.client.get_collection(path, params, **options)
157-
158148
def tasks(self, project, params={}, **options):
159149
"""Returns the compact task records for all tasks within the given project,
160150
ordered by their priority within the project. Tasks can exist in more than one project at a time.

asana/resources/gen/sections.py

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
class _Sections:
2+
"""A _section_ is a subdivision of a project that groups tasks together. It can
3+
either be a header above a list of tasks in a list view or a column in a
4+
board view of a project.
5+
"""
6+
7+
def __init__(self, client=None):
8+
self.client = client
9+
10+
def create_in_project(self, project, params={}, **options):
11+
"""Creates a new section in a project.
12+
13+
Returns the full record of the newly created section.
14+
15+
Parameters
16+
----------
17+
project : {Id} The project to create the section in
18+
[data] : {Object} Data for the request
19+
- name : {String} The text to be displayed as the section name. This cannot be an empty string.
20+
"""
21+
path = "/projects/%s/sections" % (project)
22+
return self.client.post(path, params, **options)
23+
24+
def find_by_project(self, project, params={}, **options):
25+
"""Returns the compact records for all sections in the specified project.
26+
27+
Parameters
28+
----------
29+
project : {Id} The project to get sections from.
30+
[params] : {Object} Parameters for the request
31+
"""
32+
path = "/projects/%s/sections" % (project)
33+
return self.client.get(path, params, **options)
34+
35+
def find_by_id(self, section, params={}, **options):
36+
"""Returns the complete record for a single section.
37+
38+
Parameters
39+
----------
40+
section : {Id} The section to get.
41+
[params] : {Object} Parameters for the request
42+
"""
43+
path = "/sections/%s" % (section)
44+
return self.client.get(path, params, **options)
45+
46+
def update(self, section, params={}, **options):
47+
"""A specific, existing section can be updated by making a PUT request on
48+
the URL for that project. Only the fields provided in the `data` block
49+
will be updated; any unspecified fields will remain unchanged. (note that
50+
at this time, the only field that can be updated is the `name` field.)
51+
52+
When using this method, it is best to specify only those fields you wish
53+
to change, or else you may overwrite changes made by another user since
54+
you last retrieved the task.
55+
56+
Returns the complete updated section record.
57+
58+
Parameters
59+
----------
60+
section : {Id} The section to update.
61+
[data] : {Object} Data for the request
62+
"""
63+
path = "/sections/%s" % (section)
64+
return self.client.put(path, params, **options)
65+
66+
def delete(self, section, params={}, **options):
67+
"""A specific, existing section can be deleted by making a DELETE request
68+
on the URL for that section.
69+
70+
Note that sections must be empty to be deleted.
71+
72+
The last remaining section in a board view cannot be deleted.
73+
74+
Returns an empty data block.
75+
76+
Parameters
77+
----------
78+
section : {Id} The section to delete.
79+
"""
80+
path = "/sections/%s" % (section)
81+
return self.client.delete(path, params, **options)
82+
83+
def insert_in_project(self, project, params={}, **options):
84+
"""Move sections relative to each other in a board view. One of
85+
`before_section` or `after_section` is required.
86+
87+
Sections cannot be moved between projects.
88+
89+
At this point in time, moving sections is not supported in list views, only board views.
90+
91+
Returns an empty data block.
92+
93+
Parameters
94+
----------
95+
project : {Id} The project in which to reorder the given section
96+
[data] : {Object} Data for the request
97+
- section : {Id} The section to reorder
98+
- [before_section] : {Id} Insert the given section immediately before the section specified by this parameter.
99+
- [after_section] : {Id} Insert the given section immediately after the section specified by this parameter.
100+
"""
101+
path = "/projects/%s/sections/insert" % (project)
102+
return self.client.post(path, params, **options)

asana/resources/gen/tasks.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,17 @@ def find_by_tag(self, tag, params={}, **options):
112112
path = "/tags/%s/tasks" % (tag)
113113
return self.client.get_collection(path, params, **options)
114114

115+
def find_by_section(self, section, params={}, **options):
116+
"""<b>Board view only:</b> Returns the compact section records for all tasks within the given section.
117+
118+
Parameters
119+
----------
120+
section : {Id} The section in which to search for tasks.
121+
[params] : {Object} Parameters for the request
122+
"""
123+
path = "/sections/%s/tasks" % (section)
124+
return self.client.get_collection(path, params, **options)
125+
115126
def find_all(self, params={}, **options):
116127
"""Returns the compact task records for some filtered set of tasks. Use one
117128
or more of the parameters provided to filter the tasks returned. You must
@@ -122,6 +133,7 @@ def find_all(self, params={}, **options):
122133
[params] : {Object} Parameters for the request
123134
- [assignee] : {String} The assignee to filter tasks on.
124135
- [project] : {Id} The project to filter tasks on.
136+
- [section] : {Id} The section to filter tasks on.
125137
- [workspace] : {Id} The workspace or organization to filter tasks on.
126138
- [completed_since] : {String} Only return tasks that are either incomplete or that have been
127139
completed since this time.
@@ -169,11 +181,17 @@ def projects(self, task, params={}, **options):
169181
def add_project(self, task, params={}, **options):
170182
"""Adds the task to the specified project, in the optional location
171183
specified. If no location arguments are given, the task will be added to
172-
the beginning of the project.
184+
the end of the project.
173185
174-
`addProject` can also be used to reorder a task within a project that
186+
`addProject` can also be used to reorder a task within a project or section that
175187
already contains it.
176188
189+
At most one of `insert_before`, `insert_after`, or `section` should be
190+
specified. Inserting into a section in an non-order-dependent way can be
191+
done by specifying `section`, otherwise, to insert within a section in a
192+
particular place, specify `insert_before` or `insert_after` and a task
193+
within the section to anchor the position of this task.
194+
177195
Returns an empty data block.
178196
179197
Parameters
@@ -186,7 +204,7 @@ def add_project(self, task, params={}, **options):
186204
- [insert_before] : {Id} A task in the project to insert the task before, or `null` to
187205
insert at the end of the list.
188206
- [section] : {Id} A section in the project to insert the task into. The task will be
189-
inserted at the top of the section.
207+
inserted at the bottom of the section.
190208
"""
191209
path = "/tasks/%s/addProject" % (task)
192210
return self.client.post(path, params, **options)

asana/resources/gen/workspaces.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ def typeahead(self, workspace, params={}, **options):
6666
----------
6767
workspace : {Id} The workspace to fetch objects from.
6868
[params] : {Object} Parameters for the request
69-
- type : {Enum} The type of values the typeahead should return.
69+
- type : {Enum} The type of values the typeahead should return. You can choose from
70+
one of the following: custom_field, project, tag, task, and user.
7071
Note that unlike in the names of endpoints, the types listed here are
7172
in singular form (e.g. `task`). Using multiple types is not yet supported.
7273
- [query] : {String} The string that will be used to search for relevant objects. If an
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from .gen.organization_exports import _OrganizationExports
2+
3+
4+
class OrganizationExports(_OrganizationExports):
5+
"""The :class:`OrganizationExports` object, which represents the resource
6+
of the same name in Asana's API.
7+
8+
"""

asana/resources/sections.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from .gen.sections import _Sections
2+
3+
4+
class Sections(_Sections):
5+
"""The :class:`Sections` object, which represents the resource of the same
6+
name in Asana's API.
7+
8+
"""

0 commit comments

Comments
 (0)