Skip to content

Commit 4f4a842

Browse files
Merge pull request #123 from Asana/openapi-sync
Generated from OpenAPI
2 parents 466c3cf + aa6839a commit 4f4a842

11 files changed

Lines changed: 62 additions & 29 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ If you use [Maven](http://maven.apache.org/) to manage dependencies you can incl
1010
<dependency>
1111
<groupId>com.asana</groupId>
1212
<artifactId>asana</artifactId>
13-
<version>0.10.3</version>
13+
<version>0.10.4</version>
1414
</dependency>
1515

1616
Or, you can build the artifact and install it to your local Maven repository:

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>com.asana</groupId>
55
<artifactId>asana</artifactId>
66
<packaging>jar</packaging>
7-
<version>0.10.3</version>
7+
<version>0.10.4</version>
88
<url>http://maven.apache.org</url>
99
<name>java-asana</name>
1010
<description>A Java client for the Asana API.</description>

samples/TasksBaseSample.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ tasksbase:
262262
Client client = Client.accessToken("PERSONAL_ACCESS_TOKEN");
263263
264264
265-
List<Task> result = client.tasks.searchTasksForWorkspace(workspaceGid, sortAscending, sortBy, isSubtask, completed, hasAttachment, isBlocked, isBlocking, modifiedAtAfter, modifiedAtBefore, dueOnBefore, modifiedOn, modifiedOnAfter, modifiedOnBefore, completedAtAfter, completedAtBefore, completedOn, completedOnAfter, completedOnBefore, createdAtAfter, commentedOnByNot, createdAtBefore, createdOn, createdOnAfter, createdOnBefore, startOn, startOnAfter, startOnBefore, dueAtAfter, dueAtBefore, dueOn, commentedOnByAny, dueOnAfter, likedByNot, likedByAny, assignedByNot, assignedByAny, createdByNot, createdByAny, followersNot, followersAny, teamsAny, tagsAll, tagsNot, tagsAny, sectionsAll, sectionsNot, sectionsAny, projectsAll, projectsNot, projectsAny, portfoliosAny, assigneeStatus, assigneeNot, assigneeAny, resourceSubtype, text)
265+
List<Task> result = client.tasks.searchTasksForWorkspace(workspaceGid, sortAscending, sortBy, isSubtask, completed, hasAttachment, isBlocked, isBlocking, modifiedAtAfter, modifiedAtBefore, dueOnBefore, modifiedOn, modifiedOnAfter, modifiedOnBefore, completedAtAfter, completedAtBefore, completedOn, completedOnAfter, completedOnBefore, createdAtAfter, commentedOnByNot, createdAtBefore, createdOn, createdOnAfter, createdOnBefore, startOn, startOnAfter, startOnBefore, dueAtAfter, dueAtBefore, dueOn, commentedOnByAny, dueOnAfter, likedByNot, likedByAny, assignedByNot, assignedByAny, createdByNot, createdByAny, followersNot, followersAny, teamsAny, tagsAll, tagsNot, tagsAny, sectionsAll, sectionsNot, sectionsAny, projectsAll, projectsNot, projectsAny, portfoliosAny, assigneeNot, assigneeAny, resourceSubtype, text)
266266
.option("pretty", true)
267267
.execute();
268268
setParentForTask: >-

samples/TeamsBaseSample.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@ teamsbase:
1111
.data("field", "value")
1212
.option("pretty", true)
1313
.execute();
14+
createTeam: >-
15+
import com.asana.Client;
16+
17+
18+
Client client = Client.accessToken("PERSONAL_ACCESS_TOKEN");
19+
20+
21+
Team result = client.teams.createTeam()
22+
.data("field", "value")
23+
.data("field", "value")
24+
.option("pretty", true)
25+
.execute();
1426
getTeam: >-
1527
import com.asana.Client;
1628

samples/UsersBaseSample.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ usersbase:
2626
Client client = Client.accessToken("PERSONAL_ACCESS_TOKEN");
2727
2828
29-
List<User> result = client.users.getUsers(workspace)
29+
List<User> result = client.users.getUsers(team, workspace)
3030
.option("pretty", true)
3131
.execute();
3232
getUsersForTeam: >-

src/main/java/com/asana/errors/AsanaError.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import com.asana.Json;
44
import com.asana.models.ErrorBody;
55
import com.google.api.client.http.HttpResponseException;
6-
import com.google.api.client.repackaged.com.google.common.base.Joiner;
6+
import com.google.api.client.util.Joiner;
77

88
import java.io.IOException;
99

@@ -45,7 +45,7 @@ private static String constructMessage(String message, HttpResponseException exc
4545
try {
4646
ErrorBody body = Json.getInstance().fromJson(exception.getContent(), ErrorBody.class);
4747
if (body.errors.size() > 0) {
48-
return message + " (" + Joiner.on("; ").join(body.errors) + ")";
48+
return message + " (" + Joiner.on(';').join(body.errors) + ")";
4949
}
5050
} catch (Exception e) {
5151
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ public ItemRequest<Project> getProject(String projectGid) throws IOException {
215215
}
216216
/**
217217
* Get multiple projects
218-
* Returns the compact project records for some filtered set of projects. Use one or more of the parameters provided to filter the projects returned.
218+
* Returns the compact project records for some filtered set of projects. Use one or more of the parameters provided to filter the projects returned. *Note: This endpoint may timeout for large domains. Try filtering by team!*
219219
* @param archived Only return projects whose &#x60;archived&#x60; field takes on the value of this parameter. (optional)
220220
* @param team The team to filter projects on. (optional)
221221
* @param workspace The workspace or organization to filter projects on. (optional)
@@ -300,7 +300,7 @@ public CollectionRequest<Project> getProjectsForTeam(String teamGid, Boolean arc
300300
}
301301
/**
302302
* Get all projects in a workspace
303-
* Returns the compact project records for all projects in the workspace.
303+
* Returns the compact project records for all projects in the workspace. *Note: This endpoint may timeout for large domains. Prefer the &#x60;/teams/{team_gid}/projects&#x60; endpoint.*
304304
* @param workspaceGid Globally unique identifier for the workspace or organization. (required)
305305
* @param archived Only return projects whose &#x60;archived&#x60; field takes on the value of this parameter. (optional)
306306
* @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)

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ public CollectionRequest<Task> getTasksForTag(String tagGid) throws IOException
432432
}
433433
/**
434434
* Get tasks from a user task list
435-
* Returns the compact list of tasks in a user’s My Tasks list. The returned tasks will be in order within each assignee status group of &#x60;Inbox&#x60;, &#x60;Today&#x60;, and &#x60;Upcoming&#x60;. *Note: tasks in &#x60;Later&#x60; have a different ordering in the Asana web app than the other assignee status groups; this endpoint will still return them in list order in &#x60;Later&#x60; (differently than they show up in Asana, but the same order as in Asana’s mobile apps).* *Note: Access control is enforced for this endpoint as with all Asana API endpoints, meaning a user’s private tasks will be filtered out if the API-authenticated user does not have access to them.* *Note: Both complete and incomplete tasks are returned by default unless they are filtered out (for example, setting &#x60;completed_since&#x3D;now&#x60; will return only incomplete tasks, which is the default view for “My Tasks” in Asana.)*
435+
* Returns the compact list of tasks in a user’s My Tasks list. *Note: Access control is enforced for this endpoint as with all Asana API endpoints, meaning a user’s private tasks will be filtered out if the API-authenticated user does not have access to them.* *Note: Both complete and incomplete tasks are returned by default unless they are filtered out (for example, setting &#x60;completed_since&#x3D;now&#x60; will return only incomplete tasks, which is the default view for “My Tasks” in Asana.)*
436436
* @param userTaskListGid Globally unique identifier for the user task list. (required)
437437
* @param completedSince Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*. (optional)
438438
* @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)
@@ -623,7 +623,6 @@ public ItemRequest<JsonElement> removeTagForTask(String taskGid) throws IOExcept
623623
* @param projectsNot Comma-separated list of project IDs (optional)
624624
* @param projectsAny Comma-separated list of project IDs (optional)
625625
* @param portfoliosAny Comma-separated list of portfolio IDs (optional)
626-
* @param assigneeStatus One of &#x60;inbox&#x60;, &#x60;today&#x60;, &#x60;upcoming&#x60;, or &#x60;later&#x60; (optional)
627626
* @param assigneeNot Comma-separated list of user identifiers (optional)
628627
* @param assigneeAny Comma-separated list of user identifiers (optional)
629628
* @param resourceSubtype Filters results by the task&#x27;s resource_subtype (optional)
@@ -633,7 +632,7 @@ public ItemRequest<JsonElement> removeTagForTask(String taskGid) throws IOExcept
633632
* @return CollectionRequest(Task)
634633
* @throws IOException If we fail to call the API, e.g. server error or cannot deserialize the response body
635634
*/
636-
public CollectionRequest<Task> searchTasksForWorkspace(String workspaceGid, Boolean sortAscending, String sortBy, Boolean isSubtask, Boolean completed, Boolean hasAttachment, Boolean isBlocked, Boolean isBlocking, OffsetDateTime modifiedAtAfter, OffsetDateTime modifiedAtBefore, LocalDate dueOnBefore, LocalDate modifiedOn, LocalDate modifiedOnAfter, LocalDate modifiedOnBefore, OffsetDateTime completedAtAfter, OffsetDateTime completedAtBefore, LocalDate completedOn, LocalDate completedOnAfter, LocalDate completedOnBefore, OffsetDateTime createdAtAfter, String commentedOnByNot, OffsetDateTime createdAtBefore, LocalDate createdOn, LocalDate createdOnAfter, LocalDate createdOnBefore, LocalDate startOn, LocalDate startOnAfter, LocalDate startOnBefore, OffsetDateTime dueAtAfter, OffsetDateTime dueAtBefore, LocalDate dueOn, String commentedOnByAny, LocalDate dueOnAfter, String likedByNot, String likedByAny, String assignedByNot, String assignedByAny, String createdByNot, String createdByAny, String followersNot, String followersAny, String teamsAny, String tagsAll, String tagsNot, String tagsAny, String sectionsAll, String sectionsNot, String sectionsAny, String projectsAll, String projectsNot, String projectsAny, String portfoliosAny, String assigneeStatus, String assigneeNot, String assigneeAny, String resourceSubtype, String text, List<String> optFields, Boolean optPretty) throws IOException {
635+
public CollectionRequest<Task> searchTasksForWorkspace(String workspaceGid, Boolean sortAscending, String sortBy, Boolean isSubtask, Boolean completed, Boolean hasAttachment, Boolean isBlocked, Boolean isBlocking, OffsetDateTime modifiedAtAfter, OffsetDateTime modifiedAtBefore, LocalDate dueOnBefore, LocalDate modifiedOn, LocalDate modifiedOnAfter, LocalDate modifiedOnBefore, OffsetDateTime completedAtAfter, OffsetDateTime completedAtBefore, LocalDate completedOn, LocalDate completedOnAfter, LocalDate completedOnBefore, OffsetDateTime createdAtAfter, String commentedOnByNot, OffsetDateTime createdAtBefore, LocalDate createdOn, LocalDate createdOnAfter, LocalDate createdOnBefore, LocalDate startOn, LocalDate startOnAfter, LocalDate startOnBefore, OffsetDateTime dueAtAfter, OffsetDateTime dueAtBefore, LocalDate dueOn, String commentedOnByAny, LocalDate dueOnAfter, String likedByNot, String likedByAny, String assignedByNot, String assignedByAny, String createdByNot, String createdByAny, String followersNot, String followersAny, String teamsAny, String tagsAll, String tagsNot, String tagsAny, String sectionsAll, String sectionsNot, String sectionsAny, String projectsAll, String projectsNot, String projectsAny, String portfoliosAny, String assigneeNot, String assigneeAny, String resourceSubtype, String text, List<String> optFields, Boolean optPretty) throws IOException {
637636
String path = "/workspaces/{workspace_gid}/tasks/search".replace("{workspace_gid}", workspaceGid);
638637

639638
CollectionRequest<Task> req = new CollectionRequest<Task>(this, Task.class, path, "GET")
@@ -643,7 +642,6 @@ public CollectionRequest<Task> searchTasksForWorkspace(String workspaceGid, Bool
643642
.query("resource_subtype", resourceSubtype)
644643
.query("assignee.any", assigneeAny)
645644
.query("assignee.not", assigneeNot)
646-
.query("assignee_status", assigneeStatus)
647645
.query("portfolios.any", portfoliosAny)
648646
.query("projects.any", projectsAny)
649647
.query("projects.not", projectsNot)
@@ -699,8 +697,8 @@ public CollectionRequest<Task> searchTasksForWorkspace(String workspaceGid, Bool
699697
return req;
700698
}
701699

702-
public CollectionRequest<Task> searchTasksForWorkspace(String workspaceGid, Boolean sortAscending, String sortBy, Boolean isSubtask, Boolean completed, Boolean hasAttachment, Boolean isBlocked, Boolean isBlocking, OffsetDateTime modifiedAtAfter, OffsetDateTime modifiedAtBefore, LocalDate dueOnBefore, LocalDate modifiedOn, LocalDate modifiedOnAfter, LocalDate modifiedOnBefore, OffsetDateTime completedAtAfter, OffsetDateTime completedAtBefore, LocalDate completedOn, LocalDate completedOnAfter, LocalDate completedOnBefore, OffsetDateTime createdAtAfter, String commentedOnByNot, OffsetDateTime createdAtBefore, LocalDate createdOn, LocalDate createdOnAfter, LocalDate createdOnBefore, LocalDate startOn, LocalDate startOnAfter, LocalDate startOnBefore, OffsetDateTime dueAtAfter, OffsetDateTime dueAtBefore, LocalDate dueOn, String commentedOnByAny, LocalDate dueOnAfter, String likedByNot, String likedByAny, String assignedByNot, String assignedByAny, String createdByNot, String createdByAny, String followersNot, String followersAny, String teamsAny, String tagsAll, String tagsNot, String tagsAny, String sectionsAll, String sectionsNot, String sectionsAny, String projectsAll, String projectsNot, String projectsAny, String portfoliosAny, String assigneeStatus, String assigneeNot, String assigneeAny, String resourceSubtype, String text) throws IOException {
703-
return searchTasksForWorkspace(workspaceGid, sortAscending, sortBy, isSubtask, completed, hasAttachment, isBlocked, isBlocking, modifiedAtAfter, modifiedAtBefore, dueOnBefore, modifiedOn, modifiedOnAfter, modifiedOnBefore, completedAtAfter, completedAtBefore, completedOn, completedOnAfter, completedOnBefore, createdAtAfter, commentedOnByNot, createdAtBefore, createdOn, createdOnAfter, createdOnBefore, startOn, startOnAfter, startOnBefore, dueAtAfter, dueAtBefore, dueOn, commentedOnByAny, dueOnAfter, likedByNot, likedByAny, assignedByNot, assignedByAny, createdByNot, createdByAny, followersNot, followersAny, teamsAny, tagsAll, tagsNot, tagsAny, sectionsAll, sectionsNot, sectionsAny, projectsAll, projectsNot, projectsAny, portfoliosAny, assigneeStatus, assigneeNot, assigneeAny, resourceSubtype, text, null, false);
700+
public CollectionRequest<Task> searchTasksForWorkspace(String workspaceGid, Boolean sortAscending, String sortBy, Boolean isSubtask, Boolean completed, Boolean hasAttachment, Boolean isBlocked, Boolean isBlocking, OffsetDateTime modifiedAtAfter, OffsetDateTime modifiedAtBefore, LocalDate dueOnBefore, LocalDate modifiedOn, LocalDate modifiedOnAfter, LocalDate modifiedOnBefore, OffsetDateTime completedAtAfter, OffsetDateTime completedAtBefore, LocalDate completedOn, LocalDate completedOnAfter, LocalDate completedOnBefore, OffsetDateTime createdAtAfter, String commentedOnByNot, OffsetDateTime createdAtBefore, LocalDate createdOn, LocalDate createdOnAfter, LocalDate createdOnBefore, LocalDate startOn, LocalDate startOnAfter, LocalDate startOnBefore, OffsetDateTime dueAtAfter, OffsetDateTime dueAtBefore, LocalDate dueOn, String commentedOnByAny, LocalDate dueOnAfter, String likedByNot, String likedByAny, String assignedByNot, String assignedByAny, String createdByNot, String createdByAny, String followersNot, String followersAny, String teamsAny, String tagsAll, String tagsNot, String tagsAny, String sectionsAll, String sectionsNot, String sectionsAny, String projectsAll, String projectsNot, String projectsAny, String portfoliosAny, String assigneeNot, String assigneeAny, String resourceSubtype, String text) throws IOException {
701+
return searchTasksForWorkspace(workspaceGid, sortAscending, sortBy, isSubtask, completed, hasAttachment, isBlocked, isBlocking, modifiedAtAfter, modifiedAtBefore, dueOnBefore, modifiedOn, modifiedOnAfter, modifiedOnBefore, completedAtAfter, completedAtBefore, completedOn, completedOnAfter, completedOnBefore, createdAtAfter, commentedOnByNot, createdAtBefore, createdOn, createdOnAfter, createdOnBefore, startOn, startOnAfter, startOnBefore, dueAtAfter, dueAtBefore, dueOn, commentedOnByAny, dueOnAfter, likedByNot, likedByAny, assignedByNot, assignedByAny, createdByNot, createdByAny, followersNot, followersAny, teamsAny, tagsAll, tagsNot, tagsAny, sectionsAll, sectionsNot, sectionsAny, projectsAll, projectsNot, projectsAny, portfoliosAny, assigneeNot, assigneeAny, resourceSubtype, text, null, false);
704702
}
705703
/**
706704
* Set the parent of a task

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,31 @@ public ItemRequest<User> addUserForTeam(String teamGid) throws IOException {
4141
return addUserForTeam(teamGid, null, false);
4242
}
4343
/**
44+
* Create a team
45+
* Creates a team within the current workspace.
46+
* @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)
47+
* @param limit Results per page. The number of objects to return per page. The value must be between 1 and 100. (optional)
48+
* @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)
49+
* @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)
50+
* @return ItemRequest(Team)
51+
* @throws IOException If we fail to call the API, e.g. server error or cannot deserialize the response body
52+
*/
53+
public ItemRequest<Team> createTeam(String offset, Integer limit, List<String> optFields, Boolean optPretty) throws IOException {
54+
String path = "/teams";
55+
56+
ItemRequest<Team> req = new ItemRequest<Team>(this, Team.class, path, "POST")
57+
.query("opt_pretty", optPretty)
58+
.query("opt_fields", optFields)
59+
.query("limit", limit)
60+
.query("offset", offset);
61+
62+
return req;
63+
}
64+
65+
public ItemRequest<Team> createTeam() throws IOException {
66+
return createTeam(null, (int)Client.DEFAULTS.get("page_size"), null, false);
67+
}
68+
/**
4469
* Get a team
4570
* Returns the full record for a single team.
4671
* @param teamGid Globally unique identifier for the team. (required)

0 commit comments

Comments
 (0)