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 )
0 commit comments