Skip to content

Commit f366ca9

Browse files
jv-asanaactions-user
authored andcommitted
Updated JavaScript SDK: v3.0.0
1 parent 0db01f6 commit f366ca9

File tree

151 files changed

+37338
-720
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

151 files changed

+37338
-720
lines changed

Diff for: .babelrc

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"presets": [
3+
"@babel/preset-env"
4+
],
5+
"plugins": [
6+
"@babel/plugin-syntax-dynamic-import",
7+
"@babel/plugin-syntax-import-meta",
8+
"@babel/plugin-proposal-class-properties",
9+
"@babel/plugin-proposal-json-strings",
10+
[
11+
"@babel/plugin-proposal-decorators",
12+
{
13+
"legacy": true
14+
}
15+
],
16+
"@babel/plugin-proposal-function-sent",
17+
"@babel/plugin-proposal-export-namespace-from",
18+
"@babel/plugin-proposal-numeric-separator",
19+
"@babel/plugin-proposal-throw-expressions",
20+
"@babel/plugin-proposal-export-default-from",
21+
"@babel/plugin-proposal-logical-assignment-operators",
22+
"@babel/plugin-proposal-optional-chaining",
23+
[
24+
"@babel/plugin-proposal-pipeline-operator",
25+
{
26+
"proposal": "minimal"
27+
}
28+
],
29+
"@babel/plugin-proposal-nullish-coalescing-operator",
30+
"@babel/plugin-proposal-do-expressions",
31+
"@babel/plugin-proposal-function-bind"
32+
]
33+
}

Diff for: .swagger-codegen-ignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Swagger Codegen Ignore
2+
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
# As an example, the C# client generator defines ApiClient.cs.
8+
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
9+
#ApiClient.cs
10+
11+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
12+
#foo/*/qux
13+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14+
15+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16+
#foo/**/qux
17+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18+
19+
# You can also negate patterns with an exclamation (!).
20+
# For example, you can ignore all files in a docs folder with the file extension .md:
21+
#docs/*.md
22+
# Then explicitly reverse the ignore rule for a single file:
23+
#!docs/README.md

Diff for: .travis.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
language: node_js
2+
node_js:
3+
- "6"
4+
- "6.1"
5+
- "5"
6+
- "5.11"
7+

Diff for: README.md

+624-720
Large diffs are not rendered by default.

Diff for: docs/AttachmentsApi.md

+207
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
# Asana.AttachmentsApi
2+
3+
All URIs are relative to *https://app.asana.com/api/1.0*
4+
5+
Method | HTTP request | Description
6+
------------- | ------------- | -------------
7+
[**createAttachmentForObject**](AttachmentsApi.md#createAttachmentForObject) | **POST** /attachments | Upload an attachment
8+
[**deleteAttachment**](AttachmentsApi.md#deleteAttachment) | **DELETE** /attachments/{attachment_gid} | Delete an attachment
9+
[**getAttachment**](AttachmentsApi.md#getAttachment) | **GET** /attachments/{attachment_gid} | Get an attachment
10+
[**getAttachmentsForObject**](AttachmentsApi.md#getAttachmentsForObject) | **GET** /attachments | Get attachments from an object
11+
12+
<a name="createAttachmentForObject"></a>
13+
# **createAttachmentForObject**
14+
15+
Upload an attachment
16+
17+
Upload an attachment. This method uploads an attachment on an object and returns the compact record for the created attachment object. This is possible by either: - Providing the URL of the external resource being attached, or - Downloading the file content first and then uploading it as any other attachment. Note that it is not possible to attach files from third party services such as Dropbox, Box, Vimeo & Google Drive via the API The 100MB size limit on attachments in Asana is enforced on this endpoint. This endpoint expects a multipart/form-data encoded request containing the full contents of the file to be uploaded. Requests made should follow the HTTP/1.1 specification that line terminators are of the form `CRLF` or `\\r\\n` outlined [here](http://www.w3.org/Protocols/HTTP/1.1/draft-ietf-http-v11-spec-01#Basic-Rules) in order for the server to reliably and properly handle the request.
18+
19+
([more information](https://developers.asana.com/reference/createattachmentforobject))
20+
21+
### Example
22+
```javascript
23+
const Asana = require('asana');
24+
const fs = require("fs");
25+
26+
let client = Asana.ApiClient.instance;
27+
let token = client.authentications['token'];
28+
token.accessToken = '<YOUR_ACCESS_TOKEN>';
29+
30+
let attachmentsApiInstance = new Asana.AttachmentsApi();
31+
let opts = {
32+
'resource_subtype': "external",
33+
'file': fs.createReadStream("file_example"),
34+
'parent': "parent_example",
35+
'url': "url_example",
36+
'name': "name_example",
37+
'connect_to_app': true,
38+
'opt_fields': "connected_to_app,created_at,download_url,host,name,parent,parent.created_by,parent.name,parent.resource_subtype,permanent_url,resource_subtype,size,view_url"
39+
};
40+
attachmentsApiInstance.createAttachmentForObject(opts).then((result) => {
41+
console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2));
42+
}, (error) => {
43+
console.error(error.response.body);
44+
});
45+
46+
```
47+
48+
### Parameters
49+
50+
Name | Type | Description | Notes
51+
------------- | ------------- | ------------- | -------------
52+
**resource_subtype** | **String**| | [optional]
53+
**file** | **Blob**| | [optional]
54+
**parent** | **String**| | [optional]
55+
**url** | **String**| | [optional]
56+
**name** | **String**| | [optional]
57+
**connect_to_app** | **Boolean**| | [optional]
58+
**opt_fields** | **Object**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional]
59+
60+
### Return type
61+
62+
object
63+
64+
### HTTP request headers
65+
66+
- **Content-Type**: multipart/form-data
67+
- **Accept**: application/json; charset=UTF-8
68+
69+
<a name="deleteAttachment"></a>
70+
# **deleteAttachment**
71+
72+
Delete an attachment
73+
74+
Deletes a specific, existing attachment. Returns an empty data record.
75+
76+
([more information](https://developers.asana.com/reference/deleteattachment))
77+
78+
### Example
79+
```javascript
80+
const Asana = require('asana');
81+
82+
let client = Asana.ApiClient.instance;
83+
let token = client.authentications['token'];
84+
token.accessToken = '<YOUR_ACCESS_TOKEN>';
85+
86+
let attachmentsApiInstance = new Asana.AttachmentsApi();
87+
let attachment_gid = "12345"; // String | Globally unique identifier for the attachment.
88+
89+
attachmentsApiInstance.deleteAttachment(attachment_gid).then((result) => {
90+
console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2));
91+
}, (error) => {
92+
console.error(error.response.body);
93+
});
94+
95+
```
96+
97+
### Parameters
98+
99+
Name | Type | Description | Notes
100+
------------- | ------------- | ------------- | -------------
101+
**attachment_gid** | **String**| Globally unique identifier for the attachment. |
102+
103+
### Return type
104+
105+
object
106+
107+
### HTTP request headers
108+
109+
- **Content-Type**: Not defined
110+
- **Accept**: application/json; charset=UTF-8
111+
112+
<a name="getAttachment"></a>
113+
# **getAttachment**
114+
115+
Get an attachment
116+
117+
Get the full record for a single attachment.
118+
119+
([more information](https://developers.asana.com/reference/getattachment))
120+
121+
### Example
122+
```javascript
123+
const Asana = require('asana');
124+
125+
let client = Asana.ApiClient.instance;
126+
let token = client.authentications['token'];
127+
token.accessToken = '<YOUR_ACCESS_TOKEN>';
128+
129+
let attachmentsApiInstance = new Asana.AttachmentsApi();
130+
let attachment_gid = "12345"; // String | Globally unique identifier for the attachment.
131+
let opts = {
132+
'opt_fields': "connected_to_app,created_at,download_url,host,name,parent,parent.created_by,parent.name,parent.resource_subtype,permanent_url,resource_subtype,size,view_url"
133+
};
134+
attachmentsApiInstance.getAttachment(attachment_gid, opts).then((result) => {
135+
console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2));
136+
}, (error) => {
137+
console.error(error.response.body);
138+
});
139+
140+
```
141+
142+
### Parameters
143+
144+
Name | Type | Description | Notes
145+
------------- | ------------- | ------------- | -------------
146+
**attachment_gid** | **String**| Globally unique identifier for the attachment. |
147+
**opt_fields** | **Object**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional]
148+
149+
### Return type
150+
151+
object
152+
153+
### HTTP request headers
154+
155+
- **Content-Type**: Not defined
156+
- **Accept**: application/json; charset=UTF-8
157+
158+
<a name="getAttachmentsForObject"></a>
159+
# **getAttachmentsForObject**
160+
161+
Get attachments from an object
162+
163+
Returns the compact records for all attachments on the object. There are three possible `parent` values for this request: `project`, `project_brief`, and `task`. For a project, an attachment refers to a file uploaded to the \"Key resources\" section in the project Overview. For a project brief, an attachment refers to inline files in the project brief itself. For a task, an attachment refers to a file directly associated to that task. Note that within the Asana app, inline images in the task description do not appear in the index of image thumbnails nor as stories in the task. However, requests made to `GET /attachments` for a task will return all of the images in the task, including inline images.
164+
165+
([more information](https://developers.asana.com/reference/getattachmentsforobject))
166+
167+
### Example
168+
```javascript
169+
const Asana = require('asana');
170+
171+
let client = Asana.ApiClient.instance;
172+
let token = client.authentications['token'];
173+
token.accessToken = '<YOUR_ACCESS_TOKEN>';
174+
175+
let attachmentsApiInstance = new Asana.AttachmentsApi();
176+
let parent = "159874"; // String | Globally unique identifier for object to fetch statuses from. Must be a GID for a `project`, `project_brief`, or `task`.
177+
let opts = {
178+
'limit': 50,
179+
'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9",
180+
'opt_fields': "connected_to_app,created_at,download_url,host,name,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permanent_url,resource_subtype,size,uri,view_url"
181+
};
182+
attachmentsApiInstance.getAttachmentsForObject(parent, opts).then((result) => {
183+
console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2));
184+
}, (error) => {
185+
console.error(error.response.body);
186+
});
187+
188+
```
189+
190+
### Parameters
191+
192+
Name | Type | Description | Notes
193+
------------- | ------------- | ------------- | -------------
194+
**parent** | **String**| Globally unique identifier for object to fetch statuses from. Must be a GID for a &#x60;project&#x60;, &#x60;project_brief&#x60;, or &#x60;task&#x60;. |
195+
**limit** | **Number**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional]
196+
**offset** | **String**| 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]
197+
**opt_fields** | **Object**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional]
198+
199+
### Return type
200+
201+
object
202+
203+
### HTTP request headers
204+
205+
- **Content-Type**: Not defined
206+
- **Accept**: application/json; charset=UTF-8
207+

Diff for: docs/AttachmentsApi.yaml

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
AttachmentsApi:
2+
createAttachmentForObject: |-
3+
const Asana = require('asana');
4+
const fs = require("fs");
5+
6+
let client = Asana.ApiClient.instance;
7+
let token = client.authentications['token'];
8+
token.accessToken = '<YOUR_ACCESS_TOKEN>';
9+
10+
let attachmentsApiInstance = new Asana.AttachmentsApi();
11+
let opts = {
12+
'resource_subtype': "external",
13+
'file': fs.createReadStream("file_example"),
14+
'parent': "parent_example",
15+
'url': "url_example",
16+
'name': "name_example",
17+
'connect_to_app': true,
18+
'opt_fields': "connected_to_app,created_at,download_url,host,name,parent,parent.created_by,parent.name,parent.resource_subtype,permanent_url,resource_subtype,size,view_url"
19+
};
20+
attachmentsApiInstance.createAttachmentForObject(opts).then((result) => {
21+
console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2));
22+
}, (error) => {
23+
console.error(error.response.body);
24+
});
25+
26+
deleteAttachment: |-
27+
const Asana = require('asana');
28+
29+
let client = Asana.ApiClient.instance;
30+
let token = client.authentications['token'];
31+
token.accessToken = '<YOUR_ACCESS_TOKEN>';
32+
33+
let attachmentsApiInstance = new Asana.AttachmentsApi();
34+
let attachment_gid = "12345"; // String | Globally unique identifier for the attachment.
35+
36+
attachmentsApiInstance.deleteAttachment(attachment_gid).then((result) => {
37+
console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2));
38+
}, (error) => {
39+
console.error(error.response.body);
40+
});
41+
42+
getAttachment: |-
43+
const Asana = require('asana');
44+
45+
let client = Asana.ApiClient.instance;
46+
let token = client.authentications['token'];
47+
token.accessToken = '<YOUR_ACCESS_TOKEN>';
48+
49+
let attachmentsApiInstance = new Asana.AttachmentsApi();
50+
let attachment_gid = "12345"; // String | Globally unique identifier for the attachment.
51+
let opts = {
52+
'opt_fields': "connected_to_app,created_at,download_url,host,name,parent,parent.created_by,parent.name,parent.resource_subtype,permanent_url,resource_subtype,size,view_url"
53+
};
54+
attachmentsApiInstance.getAttachment(attachment_gid, opts).then((result) => {
55+
console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2));
56+
}, (error) => {
57+
console.error(error.response.body);
58+
});
59+
60+
getAttachmentsForObject: |-
61+
const Asana = require('asana');
62+
63+
let client = Asana.ApiClient.instance;
64+
let token = client.authentications['token'];
65+
token.accessToken = '<YOUR_ACCESS_TOKEN>';
66+
67+
let attachmentsApiInstance = new Asana.AttachmentsApi();
68+
let parent = "159874"; // String | Globally unique identifier for object to fetch statuses from. Must be a GID for a `project`, `project_brief`, or `task`.
69+
let opts = {
70+
'limit': 50,
71+
'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9",
72+
'opt_fields': "connected_to_app,created_at,download_url,host,name,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permanent_url,resource_subtype,size,uri,view_url"
73+
};
74+
attachmentsApiInstance.getAttachmentsForObject(parent, opts).then((result) => {
75+
console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2));
76+
}, (error) => {
77+
console.error(error.response.body);
78+
});
79+

0 commit comments

Comments
 (0)