404
- -Page not found :(
-The requested page could not be found.
-diff --git a/.eslintrc.json b/.eslintrc.json index b6fe526..ebf36eb 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,37 +1,37 @@ -{ - "env": { - "es6": true, - "node": true - }, - "extends": "eslint:recommended", - "parser": "babel-eslint", - "parserOptions": { - "emcaVersion": 8, - "ecmaFeatures": { - "module": true - }, - "globalReturn": true, - "sourceType": "module" - }, - "rules": { - "indent": [ - "error", - 4 - ], - "linebreak-style": [ - "error", - "windows" - ], - "quotes": [ - "error", - "single" - ], - "semi": [ - "error", - "always" - ], - "no-console": [ - "error" - ] - } -} +{ + "env": { + "es6": true, + "node": true + }, + "extends": "eslint:recommended", + "parser": "babel-eslint", + "parserOptions": { + "emcaVersion": 8, + "ecmaFeatures": { + "module": true + }, + "globalReturn": true, + "sourceType": "module" + }, + "rules": { + "indent": [ + "error", + 4 + ], + "linebreak-style": [ + "error", + "windows" + ], + "quotes": [ + "error", + "single" + ], + "semi": [ + "error", + "always" + ], + "no-console": [ + "error" + ] + } +} diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..2d0fa50 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.js text eol=crlf \ No newline at end of file diff --git a/.gitignore b/.gitignore index 67cbcb1..ad67838 100644 --- a/.gitignore +++ b/.gitignore @@ -72,3 +72,12 @@ env.js # Ignore Cache Files for c9-WebIDE .c9/ + +# Local test folder +testing/ + +# Local Jester settings file +jest.config.js + +# Visual Studio Code folder +.vscode/ \ No newline at end of file diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..d853292 --- /dev/null +++ b/.jshintrc @@ -0,0 +1,3 @@ +{ + "esversion": 6 + } \ No newline at end of file diff --git a/README.md b/README.md index b4b8a8f..a49a549 100644 --- a/README.md +++ b/README.md @@ -4,5 +4,85 @@ Amino.JS is a Javascript library for access to the Narvii/Amino API. -# WARNING -This software is unofficial! It's against the Terms of Service to use this Software to interact with Amino APIs. We (the creator of Amino.JS) are not responsible for any kind of damage (ban / legal actions) done by Narvii, Inc. +## Getting Started + +To start using this library is easy. +First include it on your project +```js +var Amino = require("amino.js"); +``` +From here, you can choose 2 options. +Use the modules directly +```js +const sid = await Amino.login('email', 'password'); +// Remember, theses functions are async, so you need to use it on a async context +// Also, you have to catch the exceptions by yourself +``` +Or use the framework +```js +const AminoAPI = new Amino.AminoAPI(); +AminoAPI.proccessAction(Amino.login('email', 'password'), function(data){ + // Here is the success handler +}, function(error){ + // Here is the error handler +}); +// Differently than the direct call, you can use the framework in a normal context(outside of a async context) +``` + +### Prerequisites + +The only prerequisite for using the Amino.JS library is the Node.JS itself. +> Levi: i made a test, using a experimental build of the Node.JS for android, and i tested the Amino.JS library on it. It worked perfectly(despite a small lag due to my phone not being a pretty good one) + +### Installing + +Install this library is easy as +``` +$ npm install amino.js +``` + +Or simply by cloning this repo + +## Running the tests + +To run the tests, you need to install the Jest library +``` +$ npm install -g jest +``` + +Each test make sure that the modules and calls are working together to the Narvii Amino, making sure it isn't causing any type of problem(like calling a inexistent endpoint) + +## Deployment + +To deploy, it's recommended to make a handler for the SID(Session ID), to avoid any type of session leaking, or session hijack. + +## Built With + +* [Isomorphic Fetch](https://www.npmjs.com/package/isomorphic-fetch) - Fetch for node and Browserify. Built on top of [GitHub's WHATWG Fetch polyfill](https://github.com/github/fetch). +* A lot of coffee +* A brand-new used laptop + +## Contributing + +Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us. + +## Authors + +* **[Robin Möller (moelrobi)](https://github.com/moelrobi)** - Initial Work +* **[Felix Fong (felixfong227)](https://github.com/felixfong227)** +* **[Tau (Tau5)](https://github.com/Tau5)** +* **[Jason Idris (coffeeboo)](https://github.com/coffeeboo)** +* **[Akatsuki Levi (akatsukilevi)](https://github.com/akatsukilevi)** + +See also the list of [contributors](https://github.com/AminoJS/Amino.JS/contributors) who participated in this project. + +## License + +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details + +## Acknowledgments + +* This software is unofficial! It's against the Terms of Service to use this Software to interact with Amino APIs. We (the creator of Amino.JS) are not responsible for any kind of damage (ban / legal actions) done by Narvii, Inc. +* UPDATE: +> Levi: I'm currently trying to make this API official in the AminoApps. Even though time isn't helping me much, i'll be working to make it official. +* We are not responsible for any usage you have with the API due to improper usage \ No newline at end of file diff --git a/_config.yml b/_config.yml new file mode 100644 index 0000000..c741881 --- /dev/null +++ b/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-slate \ No newline at end of file diff --git a/docs/404.html b/docs/404.html deleted file mode 100644 index 87fcf8d..0000000 --- a/docs/404.html +++ /dev/null @@ -1,86 +0,0 @@ - -
- - - -Page not found :(
-The requested page could not be found.
-amino.js is a library for Narvii’s Amino app, an application for communities.
- -It is intuitive and easy to use. And because it is a simple JavaScript library, it can be used almost anywhere - from your Discord bot to your website.
- -View the repository on GitHub here.
- -subscribe via RSS
Page not found :(
-The requested page could not be found.
-Loads messages from a chat.
- -| Name | -Type | -Description | -
|---|---|---|
sid |
- SecurityString | -For authenticating with the Narvii-API. | -
com |
- CommunityUUID | -The Community ID that can be obtained by the function getJoinedComs | -
uid |
- ChatUUID | -The Chats ID that can be obtained by the function getJoinedChats | -
count |
- Number | -The amount of Messages to Load (defaults to 1); | -
Returns: -Array of message objects.
- -Example of message object:
- -msgList[0] = {
- 'threadId': uid,
- 'messageId': element.messageId,
- 'msg': element.content,
- 'type': element.type,
- 'author': {
- 'uid': element.author.uid,
- 'name': element.author.nickname,
- 'level': element.author.level,
- 'role': element.author.role
- }
-}Access using getChat().messages
Load information about chats the user is in.
- -| Name | -Type | -Description | -
|---|---|---|
sid |
- SecurityString | -For authenticating with the Narvii-API. | -
com |
- CommunityUUID | -A ID that can be obtained by the function getJoinedComs | -
Returns: An array of chat objects.
- -threads[0] = {
- 'threadId': '<A Random UUID>',
- 'memberCount': 59,
- 'title': 'Laberchat für alle',
- 'joined': true,
- 'public': false,
- 'group': true,
- 'muted': false,
- 'unread': true,
- 'lastMessage': {
- 'senderId': 'A UserID',
- 'message': 'The Last Message sent to the Channel'
- },
- 'members': 'still Raw JSON from the API!'
-}Get a JSON object of all the communities you are in, and their information.
- -| Name | -Type | -Description | -
|---|---|---|
sid |
- SecurityString | -For authenticating with the Narvii-API. | -
Returns: Array of community objects.
- -coms[0] = {
- "id": "x159192087",
- "name": "German Roleplay Community",
- "url": "https://aminoapps.com/c/german-roleplay-community/"
-}Get a simplefied JSON object of your profile in Amino.
- -| Name | -Type | -Description | -
|---|---|---|
sid |
- SecurityString | -For authenticating with the Narvii-API. | -
Returns: Your profile in a JSON response.
- -Note: mediaList is taken straight from the API.
- -{
- account: {
- uid: '516e2361-f357-4cac-a531-07e4c8924064',
- username: 'Lelouch',
- mediaList: [
- [100,
- 'http://pm1.narvii.com/6781/7d586df7ad9d181b7a2ef219f98a15c765c9e080v2_00.jpg',
- null
- ]
- ],
- icon: 'http://pm1.narvii.com/6759/0b6a0092b6d860fb664c199ad8f791ad3f764b95v2_00.jpg'
- },
- status: 'ok',
- error: null
-}Get a security string for access to the API.
- -| Name | -Type | -Description | -
|---|---|---|
email |
- String | -Email associated with Amino account. | -
password |
- String | -Password to Amino account. | -
deviceID |
- UUID | -An optional device ID, defaults to ours. Go here to find out how to use your own, or use ours. | -
Returns: Security ID (sid) to be used with other functions.
- -Send a message in a chat.
- -| Name | -Type | -Description | -
|---|---|---|
sid |
- SecurityString | -For authenticating with the Narvii-API. | -
com |
- CommunityUUID | -The Community ID that can be Obtained by getJoinedComs() |
-
uid |
- ChatUUID | -The chat ID returned by getJoinedChats |
-
msg |
- String | -The message to be sent. | -
Returns: Confirmation JSON that the message was sent.
- -Example of a successful send.
- -message = {
- message: {
- message: "Hello, squad!",
- threadID: "<chat room>",
- sent: true
- },
-
- status: "ok",
- error: null
-}