Skip to content

Commit

Permalink
Merge pull request #98 from Asana/rossgrambo-openapi-conversion-conse…
Browse files Browse the repository at this point in the history
…rvative

Rossgrambo openapi conversion conservative
  • Loading branch information
rossgrambo-zz authored Feb 12, 2020
2 parents ba1ba4d + 389dc1d commit 9763d54
Show file tree
Hide file tree
Showing 53 changed files with 5,430 additions and 2,108 deletions.
4 changes: 4 additions & 0 deletions .swagger-codegen-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Swagger Codegen Ignore

docs/*
src/test/java/com/asana/resources/gen/*
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ language: java
dist: trusty
jdk:
- oraclejdk8
- openjdk7
- openjdk8
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ If you use [Maven](http://maven.apache.org/) to manage dependencies you can incl
<dependency>
<groupId>com.asana</groupId>
<artifactId>asana</artifactId>
<version>0.9.1</version>
<version>0.10.0</version>
</dependency>

Or, you can build the artifact and install it to your local Maven repository:
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>com.asana</groupId>
<artifactId>asana</artifactId>
<packaging>jar</packaging>
<version>0.9.1</version>
<version>0.10.0</version>
<url>http://maven.apache.org</url>
<name>java-asana</name>
<description>A Java client for the Asana API.</description>
Expand Down Expand Up @@ -104,8 +104,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>8</source>
<target>8</target>
</configuration>
</plugin>

Expand Down
25 changes: 25 additions & 0 deletions src/main/java/com/asana/resources/Attachments.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.asana.Client;
import com.asana.models.Attachment;
import com.asana.requests.CollectionRequest;
import com.asana.requests.ItemRequest;
import com.asana.resources.gen.AttachmentsBase;
import com.google.api.client.http.HttpHeaders;
Expand Down Expand Up @@ -41,4 +42,28 @@ public ItemRequest<Attachment> createOnTask(String task, InputStream fileContent
return new ItemRequest<Attachment>(this, Attachment.class, path, "POST")
.data(content);
}

/**
* Returns the full record for a single attachment.
*
* @param attachment Globally unique identifier for the attachment.
* @return Request object
*/
public ItemRequest<Attachment> findById(String attachment) {

String path = String.format("/attachments/%s", attachment);
return new ItemRequest<Attachment>(this, Attachment.class, path, "GET");
}

/**
* Returns the compact records for all attachments on the task.
*
* @param task Globally unique identifier for the task.
* @return Request object
*/
public CollectionRequest<Attachment> findByTask(String task) {

String path = String.format("/tasks/%s/attachments", task);
return new CollectionRequest<Attachment>(this, Attachment.class, path, "GET");
}
}
10 changes: 10 additions & 0 deletions src/main/java/com/asana/resources/BatchApis.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.asana.resources;

import com.asana.Client;
import com.asana.resources.gen.BatchApiBase;

public class BatchApis extends BatchApiBase {
public BatchApis(Client client) {
super(client);
}
}
26 changes: 26 additions & 0 deletions src/main/java/com/asana/resources/CustomFieldSettings.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,36 @@
package com.asana.resources;

import com.asana.Client;
import com.asana.models.CustomFieldSetting;
import com.asana.requests.CollectionRequest;
import com.asana.resources.gen.CustomFieldSettingsBase;

public class CustomFieldSettings extends CustomFieldSettingsBase {
public CustomFieldSettings(Client client) {
super(client);
}

/**
* Returns a list of all of the custom fields settings on a project.
*
* @param project The ID of the project for which to list custom field settings
* @return Request object
*/
public CollectionRequest<CustomFieldSetting> findByProject(String project) {

String path = String.format("/projects/%s/custom_field_settings", project);
return new CollectionRequest<CustomFieldSetting>(this, CustomFieldSetting.class, path, "GET");
}

/**
* Returns a list of all of the custom fields settings on a portfolio.
*
* @param portfolio The ID of the portfolio for which to list custom field settings
* @return Request object
*/
public CollectionRequest<CustomFieldSetting> findByPortfolio(String portfolio) {

String path = String.format("/portfolios/%s/custom_field_settings", portfolio);
return new CollectionRequest<CustomFieldSetting>(this, CustomFieldSetting.class, path, "GET");
}
}
108 changes: 108 additions & 0 deletions src/main/java/com/asana/resources/CustomFields.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,118 @@
package com.asana.resources;

import com.asana.Client;
import com.asana.models.CustomField;
import com.asana.requests.CollectionRequest;
import com.asana.requests.ItemRequest;
import com.asana.resources.gen.CustomFieldsBase;

public class CustomFields extends CustomFieldsBase {
public CustomFields(Client client) {
super(client);
}

/**
* Creates a new custom field in a workspace. Every custom field is required to be created in a specific workspace, and this workspace cannot be changed once set.
*
* A custom field's `name` must be unique within a workspace and not conflict with names of existing task properties such as 'Due Date' or 'Assignee'. A custom field's `type` must be one of 'text', 'enum', or 'number'.
*
* Returns the full record of the newly created custom field.
*
* @return Request object
*/
public ItemRequest<CustomField> create() {

return new ItemRequest<CustomField>(this, CustomField.class, "/custom_fields", "POST");
}

/**
* Returns the complete definition of a custom field's metadata.
*
* @param customField Globally unique identifier for the custom field.
* @return Request object
*/
public ItemRequest<CustomField> findById(String customField) {

String path = String.format("/custom_fields/%s", customField);
return new ItemRequest<CustomField>(this, CustomField.class, path, "GET");
}

/**
* Returns a list of the compact representation of all of the custom fields in a workspace.
*
* @param workspace The workspace or organization to find custom field definitions in.
* @return Request object
*/
public CollectionRequest<CustomField> findByWorkspace(String workspace) {

String path = String.format("/workspaces/%s/custom_fields", workspace);
return new CollectionRequest<CustomField>(this, CustomField.class, path, "GET");
}

/**
* A specific, existing custom field can be updated by making a PUT request on the URL for that custom field. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged
*
* When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the custom field.
*
* An enum custom field's `enum_options` cannot be updated with this endpoint. Instead see "Work With Enum Options" for information on how to update `enum_options`.
*
* Locked custom fields can only be updated by the user who locked the field.
*
* Returns the complete updated custom field record.
*
* @param customField Globally unique identifier for the custom field.
* @return Request object
*/
public ItemRequest<CustomField> update(String customField) {

String path = String.format("/custom_fields/%s", customField);
return new ItemRequest<CustomField>(this, CustomField.class, path, "PUT");
}

/**
* A specific, existing custom field can be deleted by making a DELETE request on the URL for that custom field.
*
* Locked custom fields can only be deleted by the user who locked the field.
*
* Returns an empty data record.
*
* @param customField Globally unique identifier for the custom field.
* @return Request object
*/
public ItemRequest<CustomField> delete(String customField) {

String path = String.format("/custom_fields/%s", customField);
return new ItemRequest<CustomField>(this, CustomField.class, path, "DELETE");
}

/**
* Creates an enum option and adds it to this custom field's list of enum options. A custom field can have at most 50 enum options (including disabled options). By default new enum options are inserted at the end of a custom field's list.
*
* Locked custom fields can only have enum options added by the user who locked the field.
*
* Returns the full record of the newly created enum option.
*
* @param customField Globally unique identifier for the custom field.
* @return Request object
*/
public ItemRequest<CustomField> createEnumOption(String customField) {

String path = String.format("/custom_fields/%s/enum_options", customField);
return new ItemRequest<CustomField>(this, CustomField.class, path, "POST");
}

/**
* Moves a particular enum option to be either before or after another specified enum option in the custom field.
*
* Locked custom fields can only be reordered by the user who locked the field.
*
* @param customField Globally unique identifier for the custom field.
* @return Request object
*/
public ItemRequest<CustomField> insertEnumOption(String customField) {

String path = String.format("/custom_fields/%s/enum_options/insert", customField);
return new ItemRequest<CustomField>(this, CustomField.class, path, "POST");
}

}
14 changes: 14 additions & 0 deletions src/main/java/com/asana/resources/Jobs.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
package com.asana.resources;

import com.asana.Client;
import com.asana.models.Job;
import com.asana.requests.ItemRequest;
import com.asana.resources.gen.JobsBase;

public class Jobs extends JobsBase {
public Jobs(Client client) {
super(client);
}

/**
* Returns the complete job record for a single job.
*
* @param job The job to get.
* @return Request object
*/
public ItemRequest<Job> findById(String job) {

String path = String.format("/jobs/%s", job);
return new ItemRequest<Job>(this, Job.class, path, "GET");
}
}
25 changes: 25 additions & 0 deletions src/main/java/com/asana/resources/OrganizationExports.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,35 @@
package com.asana.resources;

import com.asana.Client;
import com.asana.models.OrganizationExport;
import com.asana.requests.ItemRequest;
import com.asana.resources.gen.OrganizationExportsBase;

public class OrganizationExports extends OrganizationExportsBase {
public OrganizationExports(Client client) {
super(client);
}

/**
* Returns details of a previously-requested Organization export.
*
* @param organizationExport Globally unique identifier for the Organization export.
* @return Request object
*/
public ItemRequest<OrganizationExport> findById(String organizationExport) {

String path = String.format("/organization_exports/%s", organizationExport);
return new ItemRequest<OrganizationExport>(this, OrganizationExport.class, path, "GET");
}

/**
* This method creates a request to export an Organization. Asana will complete the export at some
* point after you create the request.
*
* @return Request object
*/
public ItemRequest<OrganizationExport> create() {

return new ItemRequest<OrganizationExport>(this, OrganizationExport.class, "/organization_exports", "POST");
}
}
38 changes: 38 additions & 0 deletions src/main/java/com/asana/resources/PortfolioMemberships.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,48 @@
package com.asana.resources;

import com.asana.Client;
import com.asana.models.PortfolioMembership;
import com.asana.requests.CollectionRequest;
import com.asana.requests.ItemRequest;
import com.asana.resources.gen.PortfolioMembershipsBase;

public class PortfolioMemberships extends PortfolioMembershipsBase {
public PortfolioMemberships(Client client) {
super(client);
}

/**
* Returns the compact portfolio membership records for the portfolio. You must
* specify `portfolio`, `portfolio` and `user`, or `workspace` and `user`.
*
* @return Request object
*/
public CollectionRequest<PortfolioMembership> findAll() {

return new CollectionRequest<PortfolioMembership>(this, PortfolioMembership.class, "/portfolio_memberships", "GET");
}

/**
* Returns the compact portfolio membership records for the portfolio.
*
* @param portfolio The portfolio for which to fetch memberships.
* @return Request object
*/
public CollectionRequest<PortfolioMembership> findByPortfolio(String portfolio) {

String path = String.format("/portfolios/%s/portfolio_memberships", portfolio);
return new CollectionRequest<PortfolioMembership>(this, PortfolioMembership.class, path, "GET");
}

/**
* Returns the portfolio membership record.
*
* @param portfolioMembership Globally unique identifier for the portfolio membership.
* @return Request object
*/
public ItemRequest<PortfolioMembership> findById(String portfolioMembership) {

String path = String.format("/portfolio_memberships/%s", portfolioMembership);
return new ItemRequest<PortfolioMembership>(this, PortfolioMembership.class, path, "GET");
}
}
Loading

0 comments on commit 9763d54

Please sign in to comment.