asana 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +174 -0
- package/dist/ApiClient.js +693 -0
- package/dist/api/AttachmentApi.js +86 -0
- package/dist/index.js +55 -0
- package/dist/model/AttachmentResponse.js +66 -0
- package/dist/model/AttachmentResponseData.js +157 -0
- package/dist/model/AttachmentResponseDataParent.js +94 -0
- package/dist/model/ErrorResponse.js +67 -0
- package/dist/model/ErrorResponseErrorsInner.js +84 -0
- package/package.json +46 -0
package/README.md
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# asana
|
|
2
|
+
|
|
3
|
+
Asana - JavaScript client for asana
|
|
4
|
+
This is the interface for interacting with the [Asana Platform](https://developers.asana.com)
|
|
5
|
+
|
|
6
|
+
This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
|
|
7
|
+
|
|
8
|
+
- API version: 1.0.0
|
|
9
|
+
- Package version: 0.0.1
|
|
10
|
+
- Build package: org.openapitools.codegen.languages.JavascriptClientCodegen
|
|
11
|
+
For more information, please visit [https://asana.com/support](https://asana.com/support)
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
### For [Node.js](https://nodejs.org/)
|
|
16
|
+
|
|
17
|
+
#### npm
|
|
18
|
+
|
|
19
|
+
To publish the library as a [npm](https://www.npmjs.com/), please follow the procedure in ["Publishing npm packages"](https://docs.npmjs.com/getting-started/publishing-npm-packages).
|
|
20
|
+
|
|
21
|
+
Then install it via:
|
|
22
|
+
|
|
23
|
+
```shell
|
|
24
|
+
npm install asana --save
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Finally, you need to build the module:
|
|
28
|
+
|
|
29
|
+
```shell
|
|
30
|
+
npm run build
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
##### Local development
|
|
34
|
+
|
|
35
|
+
To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing `package.json` (and this README). Let's call this `JAVASCRIPT_CLIENT_DIR`. Then run:
|
|
36
|
+
|
|
37
|
+
```shell
|
|
38
|
+
npm install
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Next, [link](https://docs.npmjs.com/cli/link) it globally in npm with the following, also from `JAVASCRIPT_CLIENT_DIR`:
|
|
42
|
+
|
|
43
|
+
```shell
|
|
44
|
+
npm link
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
To use the link you just defined in your project, switch to the directory you want to use your asana from, and run:
|
|
48
|
+
|
|
49
|
+
```shell
|
|
50
|
+
npm link /path/to/<JAVASCRIPT_CLIENT_DIR>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Finally, you need to build the module:
|
|
54
|
+
|
|
55
|
+
```shell
|
|
56
|
+
npm run build
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
#### git
|
|
60
|
+
|
|
61
|
+
If the library is hosted at a git repository, e.g.https://github.com/GIT_USER_ID/GIT_REPO_ID
|
|
62
|
+
then install it via:
|
|
63
|
+
|
|
64
|
+
```shell
|
|
65
|
+
npm install GIT_USER_ID/GIT_REPO_ID --save
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### For browser
|
|
69
|
+
|
|
70
|
+
The library also works in the browser environment via npm and [browserify](http://browserify.org/). After following
|
|
71
|
+
the above steps with Node.js and installing browserify with `npm install -g browserify`,
|
|
72
|
+
perform the following (assuming *main.js* is your entry file):
|
|
73
|
+
|
|
74
|
+
```shell
|
|
75
|
+
browserify main.js > bundle.js
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Then include *bundle.js* in the HTML pages.
|
|
79
|
+
|
|
80
|
+
### Webpack Configuration
|
|
81
|
+
|
|
82
|
+
Using Webpack you may encounter the following error: "Module not found: Error:
|
|
83
|
+
Cannot resolve module", most certainly you should disable AMD loader. Add/merge
|
|
84
|
+
the following section to your webpack config:
|
|
85
|
+
|
|
86
|
+
```javascript
|
|
87
|
+
module: {
|
|
88
|
+
rules: [
|
|
89
|
+
{
|
|
90
|
+
parser: {
|
|
91
|
+
amd: false
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Getting Started
|
|
99
|
+
|
|
100
|
+
Please follow the [installation](#installation) instruction and execute the following JS code:
|
|
101
|
+
|
|
102
|
+
```javascript
|
|
103
|
+
var Asana = require('asana');
|
|
104
|
+
|
|
105
|
+
var defaultClient = Asana.ApiClient.instance;
|
|
106
|
+
// Configure OAuth2 access token for authorization: oauth2
|
|
107
|
+
var oauth2 = defaultClient.authentications['oauth2'];
|
|
108
|
+
oauth2.accessToken = "YOUR ACCESS TOKEN"
|
|
109
|
+
// Configure Bearer access token for authorization: personal_access_token
|
|
110
|
+
var personal_access_token = defaultClient.authentications['personal_access_token'];
|
|
111
|
+
personal_access_token.accessToken = "YOUR ACCESS TOKEN"
|
|
112
|
+
|
|
113
|
+
var api = new Asana.AttachmentApi()
|
|
114
|
+
var opts = {
|
|
115
|
+
'optFields': ["name","parent"], // {[String]} 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.
|
|
116
|
+
'optPretty': true, // {Boolean} 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.
|
|
117
|
+
'resourceSubtype': "resourceSubtype_example", // {String} The type of the attachment. Must be one of the given values. If not specified, a file attachment of type `asana` will be assumed. Note that if the value of `resource_subtype` is `external`, a `parent`, `name`, and `url` must also be provided.
|
|
118
|
+
'file': "/path/to/file", // {File} Required for `asana` attachments.
|
|
119
|
+
'parent': "parent_example", // {String} Required identifier of the parent task, project, or project_brief, as a string.
|
|
120
|
+
'url': "url_example", // {String} The URL of the external resource being attached. Required for attachments of type `external`.
|
|
121
|
+
'name': "name_example", // {String} The name of the external resource being attached. Required for attachments of type `external`.
|
|
122
|
+
'connectToApp': true // {Boolean} *Optional*. Only relevant for external attachments with a parent task. A boolean indicating whether the current app should be connected with the attachment for the purposes of showing an app components widget. Requires the app to have been added to a project the parent task is in.
|
|
123
|
+
};
|
|
124
|
+
var callback = function(error, data, response) {
|
|
125
|
+
if (error) {
|
|
126
|
+
console.error(error);
|
|
127
|
+
} else {
|
|
128
|
+
console.log('API called successfully. Returned data: ' + data);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
api.uploadAttachment(opts, callback);
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Documentation for API Endpoints
|
|
136
|
+
|
|
137
|
+
All URIs are relative to *https://app.asana.com/api/1.0*
|
|
138
|
+
|
|
139
|
+
Class | Method | HTTP request | Description
|
|
140
|
+
------------ | ------------- | ------------- | -------------
|
|
141
|
+
*Asana.AttachmentApi* | [**uploadAttachment**](docs/AttachmentApi.md#uploadAttachment) | **POST** /attachments | Upload an attachment
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
## Documentation for Models
|
|
145
|
+
|
|
146
|
+
- [Asana.AttachmentResponse](docs/AttachmentResponse.md)
|
|
147
|
+
- [Asana.AttachmentResponseData](docs/AttachmentResponseData.md)
|
|
148
|
+
- [Asana.AttachmentResponseDataParent](docs/AttachmentResponseDataParent.md)
|
|
149
|
+
- [Asana.ErrorResponse](docs/ErrorResponse.md)
|
|
150
|
+
- [Asana.ErrorResponseErrorsInner](docs/ErrorResponseErrorsInner.md)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
## Documentation for Authorization
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
### oauth2
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
- **Type**: OAuth
|
|
161
|
+
- **Flow**: accessCode
|
|
162
|
+
- **Authorization URL**: https://app.asana.com/-/oauth_authorize
|
|
163
|
+
- **Scopes**:
|
|
164
|
+
- default: Provides access to all endpoints documented in our API reference. If no scopes are requested, this scope is assumed by default.
|
|
165
|
+
- openid: Provides access to OpenID Connect ID tokens and the OpenID Connect user info endpoint.
|
|
166
|
+
- email: Provides access to the user’s email through the OpenID Connect user info endpoint.
|
|
167
|
+
- profile: Provides access to the user’s name and profile photo through the OpenID Connect user info endpoint.
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
### personal_access_token
|
|
172
|
+
|
|
173
|
+
- **Type**: Bearer authentication
|
|
174
|
+
|