Skip to content

Commit

Permalink
Merge pull request #135 from Asana/openapi-sync
Browse files Browse the repository at this point in the history
Generated from OpenAPI
  • Loading branch information
jv-asana authored Mar 4, 2022
2 parents 52fef9b + 1a4f626 commit 63397d6
Show file tree
Hide file tree
Showing 5 changed files with 200 additions and 3 deletions.
43 changes: 43 additions & 0 deletions samples/ProjectTemplatesBaseSample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
projecttemplatesbase:
getProjectTemplate: >-
import com.asana.Client;
Client client = Client.accessToken("PERSONAL_ACCESS_TOKEN");
JsonElement result = client.projecttemplates.getProjectTemplate(projectTemplateGid)
.option("pretty", true)
.execute();
getProjectTemplates: >-
import com.asana.Client;
Client client = Client.accessToken("PERSONAL_ACCESS_TOKEN");
List<JsonElement> result = client.projecttemplates.getProjectTemplates(team, workspace)
.option("pretty", true)
.execute();
getProjectTemplatesForTeam: >-
import com.asana.Client;
Client client = Client.accessToken("PERSONAL_ACCESS_TOKEN");
List<JsonElement> result = client.projecttemplates.getProjectTemplatesForTeam(teamGid)
.option("pretty", true)
.execute();
instantiateProject: >-
import com.asana.Client;
Client client = Client.accessToken("PERSONAL_ACCESS_TOKEN");
Job result = client.projecttemplates.instantiateProject(projectTemplateGid)
.data("field", "value")
.data("field", "value")
.option("pretty", true)
.execute();
12 changes: 12 additions & 0 deletions samples/ProjectsBaseSample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,18 @@ projectsbase:
JsonElement result = client.projects.getTaskCountsForProject(projectGid)
.option("pretty", true)
.execute();
projectSaveAsTemplate: >-
import com.asana.Client;
Client client = Client.accessToken("PERSONAL_ACCESS_TOKEN");
Job result = client.projects.projectSaveAsTemplate(projectGid)
.data("field", "value")
.data("field", "value")
.option("pretty", true)
.execute();
removeCustomFieldSettingForProject: >-
import com.asana.Client;
Expand Down
120 changes: 120 additions & 0 deletions src/main/java/com/asana/resources/gen/ProjectTemplatesBase.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
package com.asana.resources.gen;

import com.asana.Client;
import com.asana.resources.Resource;
import com.asana.requests.ItemRequest;
import com.asana.requests.CollectionRequest;
import com.asana.models.*;
import com.google.gson.JsonElement;

import java.io.IOException;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.List;

public class ProjectTemplatesBase extends Resource {
/**
* @param client Parent client instance
*/
public ProjectTemplatesBase(Client client) { super(client); }

/**
* Get a project template
* Returns the complete project template record for a single project template.
* @param projectTemplateGid Globally unique identifier for the project template. (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)
* @return ItemRequest(JsonElement)
* @throws IOException If we fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ItemRequest<JsonElement> getProjectTemplate(String projectTemplateGid, List<String> optFields, Boolean optPretty) throws IOException {
String path = "/project_templates/{project_template_gid}".replace("{project_template_gid}", projectTemplateGid);

ItemRequest<JsonElement> req = new ItemRequest<JsonElement>(this, JsonElement.class, path, "GET")
.query("opt_pretty", optPretty)
.query("opt_fields", optFields);

return req;
}

public ItemRequest<JsonElement> getProjectTemplate(String projectTemplateGid) throws IOException {
return getProjectTemplate(projectTemplateGid, null, false);
}
/**
* Get multiple project templates
* Returns the compact project template records for all project templates in the given team or workspace.
* @param team The team to filter projects on. (optional)
* @param workspace The workspace to filter results 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. &#x27;Note: You can only pass in an offset that was returned to you via a previously paginated request.&#x27; (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(JsonElement)
* @throws IOException If we fail to call the API, e.g. server error or cannot deserialize the response body
*/
public CollectionRequest<JsonElement> getProjectTemplates(String team, String workspace, String offset, Integer limit, List<String> optFields, Boolean optPretty) throws IOException {
String path = "/project_templates";

CollectionRequest<JsonElement> req = new CollectionRequest<JsonElement>(this, JsonElement.class, path, "GET")
.query("opt_pretty", optPretty)
.query("opt_fields", optFields)
.query("workspace", workspace)
.query("team", team)
.query("limit", limit)
.query("offset", offset);

return req;
}

public CollectionRequest<JsonElement> getProjectTemplates(String team, String workspace) throws IOException {
return getProjectTemplates(team, workspace, null, (int)Client.DEFAULTS.get("page_size"), null, false);
}
/**
* Get a team&#x27;s project templates
* Returns the compact project template records for all project templates in the team.
* @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. &#x27;Note: You can only pass in an offset that was returned to you via a previously paginated request.&#x27; (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(JsonElement)
* @throws IOException If we fail to call the API, e.g. server error or cannot deserialize the response body
*/
public CollectionRequest<JsonElement> getProjectTemplatesForTeam(String teamGid, String offset, Integer limit, List<String> optFields, Boolean optPretty) throws IOException {
String path = "/teams/{team_gid}/project_templates".replace("{team_gid}", teamGid);

CollectionRequest<JsonElement> req = new CollectionRequest<JsonElement>(this, JsonElement.class, path, "GET")
.query("opt_pretty", optPretty)
.query("opt_fields", optFields)
.query("limit", limit)
.query("offset", offset);

return req;
}

public CollectionRequest<JsonElement> getProjectTemplatesForTeam(String teamGid) throws IOException {
return getProjectTemplatesForTeam(teamGid, null, (int)Client.DEFAULTS.get("page_size"), null, false);
}
/**
* Instantiate a project from a project template
* Creates and returns a job that will asynchronously handle the project instantiation.
* @param projectTemplateGid Globally unique identifier for the project template. (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)
* @return ItemRequest(Job)
* @throws IOException If we fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ItemRequest<Job> instantiateProject(String projectTemplateGid, List<String> optFields, Boolean optPretty) throws IOException {
String path = "/project_templates/{project_template_gid}/instantiateProject".replace("{project_template_gid}", projectTemplateGid);

ItemRequest<Job> req = new ItemRequest<Job>(this, Job.class, path, "POST")
.query("opt_pretty", optPretty)
.query("opt_fields", optFields);

return req;
}

public ItemRequest<Job> instantiateProject(String projectTemplateGid) throws IOException {
return instantiateProject(projectTemplateGid, null, false);
}
}
24 changes: 23 additions & 1 deletion src/main/java/com/asana/resources/gen/ProjectsBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public ItemRequest<CustomFieldSetting> addCustomFieldSettingForProject(String pr
}
/**
* Add followers to a project
* 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.
* 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.
* @param projectGid Globally unique identifier for the project. (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)
Expand Down Expand Up @@ -353,6 +353,28 @@ public ItemRequest<JsonElement> getTaskCountsForProject(String projectGid) throw
return getTaskCountsForProject(projectGid, null, (int)Client.DEFAULTS.get("page_size"), null, false);
}
/**
* Create a project template from a project
* 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.
* @param projectGid Globally unique identifier for the project. (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)
* @return ItemRequest(Job)
* @throws IOException If we fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ItemRequest<Job> projectSaveAsTemplate(String projectGid, List<String> optFields, Boolean optPretty) throws IOException {
String path = "/projects/{project_gid}/saveAsTemplate".replace("{project_gid}", projectGid);

ItemRequest<Job> req = new ItemRequest<Job>(this, Job.class, path, "POST")
.query("opt_pretty", optPretty)
.query("opt_fields", optFields);

return req;
}

public ItemRequest<Job> projectSaveAsTemplate(String projectGid) throws IOException {
return projectSaveAsTemplate(projectGid, null, false);
}
/**
* Remove a custom field from a project
* Removes a custom field setting from a project.
* @param projectGid Globally unique identifier for the project. (required)
Expand Down
Loading

0 comments on commit 63397d6

Please sign in to comment.