From aa6839afa2e4fd82ea70aeb8f244b7f9e832bd61 Mon Sep 17 00:00:00 2001 From: Ross Grambo Date: Wed, 14 Apr 2021 16:56:08 -0700 Subject: [PATCH] Generated from OpenAPI --- README.md | 2 +- pom.xml | 2 +- samples/TasksBaseSample.yaml | 2 +- samples/TeamsBaseSample.yaml | 12 +++++++++ samples/UsersBaseSample.yaml | 2 +- .../java/com/asana/errors/AsanaError.java | 4 +-- .../com/asana/resources/gen/ProjectsBase.java | 4 +-- .../com/asana/resources/gen/TasksBase.java | 10 +++---- .../com/asana/resources/gen/TeamsBase.java | 25 ++++++++++++++++++ .../asana/resources/gen/TypeaheadBase.java | 2 +- .../com/asana/resources/gen/UsersBase.java | 26 +++++++++---------- 11 files changed, 62 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 258c75b..a0693ed 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ If you use [Maven](http://maven.apache.org/) to manage dependencies you can incl com.asana asana - 0.10.3 + 0.10.4 Or, you can build the artifact and install it to your local Maven repository: diff --git a/pom.xml b/pom.xml index db078be..33e5dff 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.asana asana jar - 0.10.3 + 0.10.4 http://maven.apache.org java-asana A Java client for the Asana API. diff --git a/samples/TasksBaseSample.yaml b/samples/TasksBaseSample.yaml index 76190ef..e232422 100644 --- a/samples/TasksBaseSample.yaml +++ b/samples/TasksBaseSample.yaml @@ -262,7 +262,7 @@ tasksbase: Client client = Client.accessToken("PERSONAL_ACCESS_TOKEN"); - List 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) + List 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) .option("pretty", true) .execute(); setParentForTask: >- diff --git a/samples/TeamsBaseSample.yaml b/samples/TeamsBaseSample.yaml index b68bbb9..f751284 100644 --- a/samples/TeamsBaseSample.yaml +++ b/samples/TeamsBaseSample.yaml @@ -11,6 +11,18 @@ teamsbase: .data("field", "value") .option("pretty", true) .execute(); + createTeam: >- + import com.asana.Client; + + + Client client = Client.accessToken("PERSONAL_ACCESS_TOKEN"); + + + Team result = client.teams.createTeam() + .data("field", "value") + .data("field", "value") + .option("pretty", true) + .execute(); getTeam: >- import com.asana.Client; diff --git a/samples/UsersBaseSample.yaml b/samples/UsersBaseSample.yaml index 8fa0c8c..d96e430 100644 --- a/samples/UsersBaseSample.yaml +++ b/samples/UsersBaseSample.yaml @@ -26,7 +26,7 @@ usersbase: Client client = Client.accessToken("PERSONAL_ACCESS_TOKEN"); - List result = client.users.getUsers(workspace) + List result = client.users.getUsers(team, workspace) .option("pretty", true) .execute(); getUsersForTeam: >- diff --git a/src/main/java/com/asana/errors/AsanaError.java b/src/main/java/com/asana/errors/AsanaError.java index c35b45f..a5e3ba9 100644 --- a/src/main/java/com/asana/errors/AsanaError.java +++ b/src/main/java/com/asana/errors/AsanaError.java @@ -3,7 +3,7 @@ import com.asana.Json; import com.asana.models.ErrorBody; import com.google.api.client.http.HttpResponseException; -import com.google.api.client.repackaged.com.google.common.base.Joiner; +import com.google.api.client.util.Joiner; import java.io.IOException; @@ -45,7 +45,7 @@ private static String constructMessage(String message, HttpResponseException exc try { ErrorBody body = Json.getInstance().fromJson(exception.getContent(), ErrorBody.class); if (body.errors.size() > 0) { - return message + " (" + Joiner.on("; ").join(body.errors) + ")"; + return message + " (" + Joiner.on(';').join(body.errors) + ")"; } } catch (Exception e) { } diff --git a/src/main/java/com/asana/resources/gen/ProjectsBase.java b/src/main/java/com/asana/resources/gen/ProjectsBase.java index c899951..03f3f7b 100644 --- a/src/main/java/com/asana/resources/gen/ProjectsBase.java +++ b/src/main/java/com/asana/resources/gen/ProjectsBase.java @@ -215,7 +215,7 @@ public ItemRequest getProject(String projectGid) throws IOException { } /** * Get multiple projects - * Returns the compact project records for some filtered set of projects. Use one or more of the parameters provided to filter the projects returned. + * 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!* * @param archived Only return projects whose `archived` field takes on the value of this parameter. (optional) * @param team The team to filter projects on. (optional) * @param workspace The workspace or organization to filter projects on. (optional) @@ -300,7 +300,7 @@ public CollectionRequest getProjectsForTeam(String teamGid, Boolean arc } /** * Get all projects in a workspace - * Returns the compact project records for all projects in the workspace. + * Returns the compact project records for all projects in the workspace. *Note: This endpoint may timeout for large domains. Prefer the `/teams/{team_gid}/projects` endpoint.* * @param workspaceGid Globally unique identifier for the workspace or organization. (required) * @param archived Only return projects whose `archived` field takes on the value of this parameter. (optional) * @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. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' (optional) diff --git a/src/main/java/com/asana/resources/gen/TasksBase.java b/src/main/java/com/asana/resources/gen/TasksBase.java index 9ccccc1..b3dc908 100644 --- a/src/main/java/com/asana/resources/gen/TasksBase.java +++ b/src/main/java/com/asana/resources/gen/TasksBase.java @@ -432,7 +432,7 @@ public CollectionRequest getTasksForTag(String tagGid) throws IOException } /** * Get tasks from a user task list - * 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 `Inbox`, `Today`, and `Upcoming`. *Note: tasks in `Later` 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 `Later` (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 `completed_since=now` will return only incomplete tasks, which is the default view for “My Tasks” in Asana.)* + * 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 `completed_since=now` will return only incomplete tasks, which is the default view for “My Tasks” in Asana.)* * @param userTaskListGid Globally unique identifier for the user task list. (required) * @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) * @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. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' (optional) @@ -623,7 +623,6 @@ public ItemRequest removeTagForTask(String taskGid) throws IOExcept * @param projectsNot Comma-separated list of project IDs (optional) * @param projectsAny Comma-separated list of project IDs (optional) * @param portfoliosAny Comma-separated list of portfolio IDs (optional) - * @param assigneeStatus One of `inbox`, `today`, `upcoming`, or `later` (optional) * @param assigneeNot Comma-separated list of user identifiers (optional) * @param assigneeAny Comma-separated list of user identifiers (optional) * @param resourceSubtype Filters results by the task's resource_subtype (optional) @@ -633,7 +632,7 @@ public ItemRequest removeTagForTask(String taskGid) throws IOExcept * @return CollectionRequest(Task) * @throws IOException If we fail to call the API, e.g. server error or cannot deserialize the response body */ - public CollectionRequest 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 optFields, Boolean optPretty) throws IOException { + public CollectionRequest 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 optFields, Boolean optPretty) throws IOException { String path = "/workspaces/{workspace_gid}/tasks/search".replace("{workspace_gid}", workspaceGid); CollectionRequest req = new CollectionRequest(this, Task.class, path, "GET") @@ -643,7 +642,6 @@ public CollectionRequest searchTasksForWorkspace(String workspaceGid, Bool .query("resource_subtype", resourceSubtype) .query("assignee.any", assigneeAny) .query("assignee.not", assigneeNot) - .query("assignee_status", assigneeStatus) .query("portfolios.any", portfoliosAny) .query("projects.any", projectsAny) .query("projects.not", projectsNot) @@ -699,8 +697,8 @@ public CollectionRequest searchTasksForWorkspace(String workspaceGid, Bool return req; } - public CollectionRequest 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 { - 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); + public CollectionRequest 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 { + 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); } /** * Set the parent of a task diff --git a/src/main/java/com/asana/resources/gen/TeamsBase.java b/src/main/java/com/asana/resources/gen/TeamsBase.java index 8c66b85..6930f54 100644 --- a/src/main/java/com/asana/resources/gen/TeamsBase.java +++ b/src/main/java/com/asana/resources/gen/TeamsBase.java @@ -41,6 +41,31 @@ public ItemRequest addUserForTeam(String teamGid) throws IOException { return addUserForTeam(teamGid, null, false); } /** + * Create a team + * Creates a team within the current workspace. + * @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. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' (optional) + * @param limit Results per page. The number of objects to return per page. The value must be between 1 and 100. (optional) + * @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) + * @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) + * @return ItemRequest(Team) + * @throws IOException If we fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ItemRequest createTeam(String offset, Integer limit, List optFields, Boolean optPretty) throws IOException { + String path = "/teams"; + + ItemRequest req = new ItemRequest(this, Team.class, path, "POST") + .query("opt_pretty", optPretty) + .query("opt_fields", optFields) + .query("limit", limit) + .query("offset", offset); + + return req; + } + + public ItemRequest createTeam() throws IOException { + return createTeam(null, (int)Client.DEFAULTS.get("page_size"), null, false); + } + /** * Get a team * Returns the full record for a single team. * @param teamGid Globally unique identifier for the team. (required) diff --git a/src/main/java/com/asana/resources/gen/TypeaheadBase.java b/src/main/java/com/asana/resources/gen/TypeaheadBase.java index d9cdec5..85ea65c 100644 --- a/src/main/java/com/asana/resources/gen/TypeaheadBase.java +++ b/src/main/java/com/asana/resources/gen/TypeaheadBase.java @@ -20,7 +20,7 @@ public class TypeaheadBase extends Resource { /** * Get objects via typeahead - * Retrieves objects in the workspace based via an auto-completion/typeahead search algorithm. This feature is meant to provide results quickly, so do not rely on this API to provide extremely accurate search results. The result set is limited to a single page of results with a maximum size, so you won’t be able to fetch large numbers of results. The typeahead search API provides search for objects from a single workspace. This endpoint should be used to query for objects when creating an auto-completion/typeahead search feature. This API is meant to provide results quickly and should not be relied upon for accurate or exhaustive search results. The results sets are limited in size and cannot be paginated. Queries return a compact representation of each object which is typically the gid and name fields. Interested in a specific set of fields or all of the fields?! Of course you are. Use field selectors to manipulate what data is included in a response. Resources with type `user` are returned in order of most contacted to least contacted. This is determined by task assignments, adding the user to projects, and adding the user as a follower to tasks, conversations, etc. Resources with type `project` are returned in order of recency. This is determined when the user visits the project, is added to the project, and completes tasks in the project. Resources with type `task` are returned with priority placed on tasks the user is following, but no guarantee on the order of those tasks. Leaving the `query` string empty or omitted will give you results, still following the resource ordering above. This could be used to list users or projects that are relevant for the requesting user's api token. + * Retrieves objects in the workspace based via an auto-completion/typeahead search algorithm. This feature is meant to provide results quickly, so do not rely on this API to provide extremely accurate search results. The result set is limited to a single page of results with a maximum size, so you won’t be able to fetch large numbers of results. The typeahead search API provides search for objects from a single workspace. This endpoint should be used to query for objects when creating an auto-completion/typeahead search feature. This API is meant to provide results quickly and should not be relied upon for accurate or exhaustive search results. The results sets are limited in size and cannot be paginated. Queries return a compact representation of each object which is typically the gid and name fields. Interested in a specific set of fields or all of the fields?! Of course you are. Use field selectors to manipulate what data is included in a response. Resources with type `user` are returned in order of most contacted to least contacted. This is determined by task assignments, adding the user to projects, and adding the user as a follower to tasks, messages, etc. Resources with type `project` are returned in order of recency. This is determined when the user visits the project, is added to the project, and completes tasks in the project. Resources with type `task` are returned with priority placed on tasks the user is following, but no guarantee on the order of those tasks. Leaving the `query` string empty or omitted will give you results, still following the resource ordering above. This could be used to list users or projects that are relevant for the requesting user's api token. * @param workspaceGid Globally unique identifier for the workspace or organization. (required) * @param count The number of results to return. The default is 20 if this parameter is omitted, with a minimum of 1 and a maximum of 100. If there are fewer results found than requested, all will be returned. (optional) * @param query The string that will be used to search for relevant objects. If an empty string is passed in, the API will currently return an empty result set. (optional) diff --git a/src/main/java/com/asana/resources/gen/UsersBase.java b/src/main/java/com/asana/resources/gen/UsersBase.java index 3440cd0..ee53554 100644 --- a/src/main/java/com/asana/resources/gen/UsersBase.java +++ b/src/main/java/com/asana/resources/gen/UsersBase.java @@ -46,7 +46,7 @@ public CollectionRequest getFavoritesForUser(String userGid, String } /** * Get a user - * Returns the full user record for the single user with the provided ID. Results are sorted by user ID. + * Returns the full user record for the single user with the provided ID. * @param userGid A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required) * @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) * @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) @@ -69,6 +69,7 @@ public ItemRequest getUser(String userGid) throws IOException { /** * Get multiple users * Returns the user records for all users in all workspaces and organizations accessible to the authenticated user. Accepts an optional workspace ID parameter. Results are sorted by user ID. + * @param team The team ID to filter users on. (optional) * @param workspace The workspace or organization ID to filter users on. (optional) * @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. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' (optional) * @param limit Results per page. The number of objects to return per page. The value must be between 1 and 100. (optional) @@ -77,11 +78,12 @@ public ItemRequest getUser(String userGid) throws IOException { * @return CollectionRequest(User) * @throws IOException If we fail to call the API, e.g. server error or cannot deserialize the response body */ - public CollectionRequest getUsers(String workspace, String offset, Integer limit, List optFields, Boolean optPretty) throws IOException { + public CollectionRequest getUsers(String team, String workspace, String offset, Integer limit, List optFields, Boolean optPretty) throws IOException { String path = "/users"; CollectionRequest req = new CollectionRequest(this, User.class, path, "GET") .query("workspace", workspace) + .query("team", team) .query("opt_pretty", optPretty) .query("opt_fields", optFields) .query("limit", limit) @@ -90,59 +92,55 @@ public CollectionRequest getUsers(String workspace, String offset, Integer return req; } - public CollectionRequest getUsers(String workspace) throws IOException { - return getUsers(workspace, null, (int)Client.DEFAULTS.get("page_size"), null, false); + public CollectionRequest getUsers(String team, String workspace) throws IOException { + return getUsers(team, workspace, null, (int)Client.DEFAULTS.get("page_size"), null, false); } /** * Get users in a team - * Returns the compact records for all users that are members of the team. + * Returns the compact records for all users that are members of the team. Results are sorted alphabetically and limited to 2000. For more results use the `/users` endpoint. * @param teamGid Globally unique identifier for the team. (required) * @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. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' (optional) - * @param limit Results per page. The number of objects to return per page. The value must be between 1 and 100. (optional) * @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) * @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) * @return CollectionRequest(User) * @throws IOException If we fail to call the API, e.g. server error or cannot deserialize the response body */ - public CollectionRequest getUsersForTeam(String teamGid, String offset, Integer limit, List optFields, Boolean optPretty) throws IOException { + public CollectionRequest getUsersForTeam(String teamGid, String offset, List optFields, Boolean optPretty) throws IOException { String path = "/teams/{team_gid}/users".replace("{team_gid}", teamGid); CollectionRequest req = new CollectionRequest(this, User.class, path, "GET") .query("opt_pretty", optPretty) .query("opt_fields", optFields) - .query("limit", limit) .query("offset", offset); return req; } public CollectionRequest getUsersForTeam(String teamGid) throws IOException { - return getUsersForTeam(teamGid, null, (int)Client.DEFAULTS.get("page_size"), null, false); + return getUsersForTeam(teamGid, null, null, false); } /** * Get users in a workspace or organization - * Returns the user records for all users in the specified workspace or organization. Results are sorted alphabetically by user names. + * Returns the compact records for all users in the specified workspace or organization. Results are sorted alphabetically and limited to 2000. For more results use the `/users` endpoint. * @param workspaceGid Globally unique identifier for the workspace or organization. (required) * @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. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' (optional) - * @param limit Results per page. The number of objects to return per page. The value must be between 1 and 100. (optional) * @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) * @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) * @return CollectionRequest(User) * @throws IOException If we fail to call the API, e.g. server error or cannot deserialize the response body */ - public CollectionRequest getUsersForWorkspace(String workspaceGid, String offset, Integer limit, List optFields, Boolean optPretty) throws IOException { + public CollectionRequest getUsersForWorkspace(String workspaceGid, String offset, List optFields, Boolean optPretty) throws IOException { String path = "/workspaces/{workspace_gid}/users".replace("{workspace_gid}", workspaceGid); CollectionRequest req = new CollectionRequest(this, User.class, path, "GET") .query("opt_pretty", optPretty) .query("opt_fields", optFields) - .query("limit", limit) .query("offset", offset); return req; } public CollectionRequest getUsersForWorkspace(String workspaceGid) throws IOException { - return getUsersForWorkspace(workspaceGid, null, (int)Client.DEFAULTS.get("page_size"), null, false); + return getUsersForWorkspace(workspaceGid, null, null, false); } }