Skip to content

Commit 63397d6

Browse files
authored
Merge pull request #135 from Asana/openapi-sync
Generated from OpenAPI
2 parents 52fef9b + 1a4f626 commit 63397d6

File tree

5 files changed

+200
-3
lines changed

5 files changed

+200
-3
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
projecttemplatesbase:
2+
getProjectTemplate: >-
3+
import com.asana.Client;
4+
5+
6+
Client client = Client.accessToken("PERSONAL_ACCESS_TOKEN");
7+
8+
9+
JsonElement result = client.projecttemplates.getProjectTemplate(projectTemplateGid)
10+
.option("pretty", true)
11+
.execute();
12+
getProjectTemplates: >-
13+
import com.asana.Client;
14+
15+
16+
Client client = Client.accessToken("PERSONAL_ACCESS_TOKEN");
17+
18+
19+
List<JsonElement> result = client.projecttemplates.getProjectTemplates(team, workspace)
20+
.option("pretty", true)
21+
.execute();
22+
getProjectTemplatesForTeam: >-
23+
import com.asana.Client;
24+
25+
26+
Client client = Client.accessToken("PERSONAL_ACCESS_TOKEN");
27+
28+
29+
List<JsonElement> result = client.projecttemplates.getProjectTemplatesForTeam(teamGid)
30+
.option("pretty", true)
31+
.execute();
32+
instantiateProject: >-
33+
import com.asana.Client;
34+
35+
36+
Client client = Client.accessToken("PERSONAL_ACCESS_TOKEN");
37+
38+
39+
Job result = client.projecttemplates.instantiateProject(projectTemplateGid)
40+
.data("field", "value")
41+
.data("field", "value")
42+
.option("pretty", true)
43+
.execute();

samples/ProjectsBaseSample.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,18 @@ projectsbase:
153153
JsonElement result = client.projects.getTaskCountsForProject(projectGid)
154154
.option("pretty", true)
155155
.execute();
156+
projectSaveAsTemplate: >-
157+
import com.asana.Client;
158+
159+
160+
Client client = Client.accessToken("PERSONAL_ACCESS_TOKEN");
161+
162+
163+
Job result = client.projects.projectSaveAsTemplate(projectGid)
164+
.data("field", "value")
165+
.data("field", "value")
166+
.option("pretty", true)
167+
.execute();
156168
removeCustomFieldSettingForProject: >-
157169
import com.asana.Client;
158170
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
package com.asana.resources.gen;
2+
3+
import com.asana.Client;
4+
import com.asana.resources.Resource;
5+
import com.asana.requests.ItemRequest;
6+
import com.asana.requests.CollectionRequest;
7+
import com.asana.models.*;
8+
import com.google.gson.JsonElement;
9+
10+
import java.io.IOException;
11+
import java.time.LocalDate;
12+
import java.time.OffsetDateTime;
13+
import java.util.List;
14+
15+
public class ProjectTemplatesBase extends Resource {
16+
/**
17+
* @param client Parent client instance
18+
*/
19+
public ProjectTemplatesBase(Client client) { super(client); }
20+
21+
/**
22+
* Get a project template
23+
* Returns the complete project template record for a single project template.
24+
* @param projectTemplateGid Globally unique identifier for the project template. (required)
25+
* @param optFields Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. (optional)
26+
* @param optPretty Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. (optional)
27+
* @return ItemRequest(JsonElement)
28+
* @throws IOException If we fail to call the API, e.g. server error or cannot deserialize the response body
29+
*/
30+
public ItemRequest<JsonElement> getProjectTemplate(String projectTemplateGid, List<String> optFields, Boolean optPretty) throws IOException {
31+
String path = "/project_templates/{project_template_gid}".replace("{project_template_gid}", projectTemplateGid);
32+
33+
ItemRequest<JsonElement> req = new ItemRequest<JsonElement>(this, JsonElement.class, path, "GET")
34+
.query("opt_pretty", optPretty)
35+
.query("opt_fields", optFields);
36+
37+
return req;
38+
}
39+
40+
public ItemRequest<JsonElement> getProjectTemplate(String projectTemplateGid) throws IOException {
41+
return getProjectTemplate(projectTemplateGid, null, false);
42+
}
43+
/**
44+
* Get multiple project templates
45+
* Returns the compact project template records for all project templates in the given team or workspace.
46+
* @param team The team to filter projects on. (optional)
47+
* @param workspace The workspace to filter results on. (optional)
48+
* @param offset Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. &#x27;Note: You can only pass in an offset that was returned to you via a previously paginated request.&#x27; (optional)
49+
* @param limit Results per page. The number of objects to return per page. The value must be between 1 and 100. (optional)
50+
* @param optFields Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. (optional)
51+
* @param optPretty Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. (optional)
52+
* @return CollectionRequest(JsonElement)
53+
* @throws IOException If we fail to call the API, e.g. server error or cannot deserialize the response body
54+
*/
55+
public CollectionRequest<JsonElement> getProjectTemplates(String team, String workspace, String offset, Integer limit, List<String> optFields, Boolean optPretty) throws IOException {
56+
String path = "/project_templates";
57+
58+
CollectionRequest<JsonElement> req = new CollectionRequest<JsonElement>(this, JsonElement.class, path, "GET")
59+
.query("opt_pretty", optPretty)
60+
.query("opt_fields", optFields)
61+
.query("workspace", workspace)
62+
.query("team", team)
63+
.query("limit", limit)
64+
.query("offset", offset);
65+
66+
return req;
67+
}
68+
69+
public CollectionRequest<JsonElement> getProjectTemplates(String team, String workspace) throws IOException {
70+
return getProjectTemplates(team, workspace, null, (int)Client.DEFAULTS.get("page_size"), null, false);
71+
}
72+
/**
73+
* Get a team&#x27;s project templates
74+
* Returns the compact project template records for all project templates in the team.
75+
* @param teamGid Globally unique identifier for the team. (required)
76+
* @param offset Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. &#x27;Note: You can only pass in an offset that was returned to you via a previously paginated request.&#x27; (optional)
77+
* @param limit Results per page. The number of objects to return per page. The value must be between 1 and 100. (optional)
78+
* @param optFields Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. (optional)
79+
* @param optPretty Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. (optional)
80+
* @return CollectionRequest(JsonElement)
81+
* @throws IOException If we fail to call the API, e.g. server error or cannot deserialize the response body
82+
*/
83+
public CollectionRequest<JsonElement> getProjectTemplatesForTeam(String teamGid, String offset, Integer limit, List<String> optFields, Boolean optPretty) throws IOException {
84+
String path = "/teams/{team_gid}/project_templates".replace("{team_gid}", teamGid);
85+
86+
CollectionRequest<JsonElement> req = new CollectionRequest<JsonElement>(this, JsonElement.class, path, "GET")
87+
.query("opt_pretty", optPretty)
88+
.query("opt_fields", optFields)
89+
.query("limit", limit)
90+
.query("offset", offset);
91+
92+
return req;
93+
}
94+
95+
public CollectionRequest<JsonElement> getProjectTemplatesForTeam(String teamGid) throws IOException {
96+
return getProjectTemplatesForTeam(teamGid, null, (int)Client.DEFAULTS.get("page_size"), null, false);
97+
}
98+
/**
99+
* Instantiate a project from a project template
100+
* Creates and returns a job that will asynchronously handle the project instantiation.
101+
* @param projectTemplateGid Globally unique identifier for the project template. (required)
102+
* @param optFields Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. (optional)
103+
* @param optPretty Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. (optional)
104+
* @return ItemRequest(Job)
105+
* @throws IOException If we fail to call the API, e.g. server error or cannot deserialize the response body
106+
*/
107+
public ItemRequest<Job> instantiateProject(String projectTemplateGid, List<String> optFields, Boolean optPretty) throws IOException {
108+
String path = "/project_templates/{project_template_gid}/instantiateProject".replace("{project_template_gid}", projectTemplateGid);
109+
110+
ItemRequest<Job> req = new ItemRequest<Job>(this, Job.class, path, "POST")
111+
.query("opt_pretty", optPretty)
112+
.query("opt_fields", optFields);
113+
114+
return req;
115+
}
116+
117+
public ItemRequest<Job> instantiateProject(String projectTemplateGid) throws IOException {
118+
return instantiateProject(projectTemplateGid, null, false);
119+
}
120+
}

src/main/java/com/asana/resources/gen/ProjectsBase.java

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public ItemRequest<CustomFieldSetting> addCustomFieldSettingForProject(String pr
4040
}
4141
/**
4242
* Add followers to a project
43-
* Adds the specified list of users as followers to the project. Followers are a subset of members who have opted in to receive \&quot;tasks added\&quot; notifications for a project. Therefore, if the users are not already members of the project, they will also become members as a result of this operation. Returns the updated project record.
43+
* Adds the specified list of users as followers to the project. Followers are a subset of members who have opted in to receive \&quot;tasks added\&quot; notifications for a project. Therefore, if the users are not already members of the project, they will also become members as a result of this operation. Returns the updated project record.
4444
* @param projectGid Globally unique identifier for the project. (required)
4545
* @param optFields Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. (optional)
4646
* @param optPretty Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. (optional)
@@ -353,6 +353,28 @@ public ItemRequest<JsonElement> getTaskCountsForProject(String projectGid) throw
353353
return getTaskCountsForProject(projectGid, null, (int)Client.DEFAULTS.get("page_size"), null, false);
354354
}
355355
/**
356+
* Create a project template from a project
357+
* Creates and returns a job that will asynchronously handle the project template creation. Note that while the resulting project template can be accessed with the API, it won&#x27;t be visible in the Asana UI until Project Templates 2.0 is launched in the app.
358+
* @param projectGid Globally unique identifier for the project. (required)
359+
* @param optFields Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. (optional)
360+
* @param optPretty Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. (optional)
361+
* @return ItemRequest(Job)
362+
* @throws IOException If we fail to call the API, e.g. server error or cannot deserialize the response body
363+
*/
364+
public ItemRequest<Job> projectSaveAsTemplate(String projectGid, List<String> optFields, Boolean optPretty) throws IOException {
365+
String path = "/projects/{project_gid}/saveAsTemplate".replace("{project_gid}", projectGid);
366+
367+
ItemRequest<Job> req = new ItemRequest<Job>(this, Job.class, path, "POST")
368+
.query("opt_pretty", optPretty)
369+
.query("opt_fields", optFields);
370+
371+
return req;
372+
}
373+
374+
public ItemRequest<Job> projectSaveAsTemplate(String projectGid) throws IOException {
375+
return projectSaveAsTemplate(projectGid, null, false);
376+
}
377+
/**
356378
* Remove a custom field from a project
357379
* Removes a custom field setting from a project.
358380
* @param projectGid Globally unique identifier for the project. (required)

0 commit comments

Comments
 (0)