You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is currently work in progress. Package will be published to NPM registry once everything will be ready. Use source code at your own risk.
10
+
11
+
6
12
## Usage
7
13
8
-
This is currently work in progress. Do not try to use this in development or production.
9
-
This section will be updated and package will be published to NPM registry once everything will be ready.
14
+
#### Server-side usage
15
+
16
+
Install as a dev dependency:
17
+
18
+
npm install attask-api --save-dev
19
+
20
+
Then `require('attask-api')` in your code. For example:
21
+
```javascript
22
+
var attask =require('attask-api'),
23
+
util =require('util');
24
+
25
+
/**
26
+
* The console.log statement below will output the following:
27
+
* {
28
+
* Api: [Function: Api],
29
+
* ApiFactory: [Object],
30
+
* ApiUtil: [Object],
31
+
* ApiConstants: [Object]
32
+
* }
33
+
*/
34
+
console.log(util.inspect(attask, {depth:0}));
35
+
```
36
+
37
+
#### In a browser
38
+
39
+
This package uses [Browserify](http://browserify.org) to generate [dist/attask.min.js](dist/attask.min.js). Loading that script will create `window.AtTask` object which will contain all the classes and methods just as in the server-side environment (see [Server-side usage](#server-side-usage) section).
40
+
This package makes use of [Promises](https://www.promisejs.org). Promises are not currently supported by all browsers (see [kangax compatibility tables](http://kangax.github.io/compat-table/es6/#Promise) but there are many polyfills available, including one listed in [www.promisejs.org](https://www.promisejs.org). Load polyfill before `attask.min.js` and everything will work just fine.
41
+
Although the lack of CORS support may prevent you from sending request to AtTask servers, there are some usage examples in [examples/browser](examples/browser) folder to give you an idea.
42
+
43
+
44
+
## Documentation
45
+
46
+
API documentation is available at [http://bhovhannes.github.io/attask-api/](http://bhovhannes.github.io/attask-api/).
47
+
48
+
49
+
## Examples
50
+
51
+
A number of examples can be found under [examples](examples) directory. It includes examples for both [node](examples/node) and [browser](examples/browser) environments.
52
+
In order to run these examples clone a copy of attask-api repository:
Copy file name to clipboardExpand all lines: src/Api.js
+5-7Lines changed: 5 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,9 @@
1
1
/**
2
-
* Creates new Api instance. Accepts configuration object with the following keys:
3
-
* hostname {String} - Required. A name of host to connect to
4
-
* port {String} - Optional. A port on host to connect to. Defaults to 80.
5
-
* version {String} - Optional. Which version of api to use.
6
-
* At the moment of writing can be 1.0, 2.0, 3.0, 4.0, 5.0.
7
-
* Pass 'internal' to use AtTask internal API (this is the latest version, maybe unstable)
8
-
* @param {Object} config
2
+
* Creates new Api instance.
3
+
* @param {Object} config An object with the following keys:<br/>
4
+
* <code>hostname</code> {String} - Required. A name of host to connect to<br/>
5
+
* <code>port</code> {String} - Optional. A port on host to connect to. Defaults to 80.<br/>
6
+
* <code>version</code> {String} - Optional. Which version of api to use. At the moment of writing can be 1.0, 2.0, 3.0, 4.0, 5.0. Pass 'internal' to use AtTask internal API (this is the latest version, maybe unstable)
0 commit comments