sopra-fs21-group-02-dogs-api v1.18.0
dogs_app
DogsApp - JavaScript client for dogs_app This is the API definition of the dogs owners app. This SDK is automatically generated by the OpenAPI Generator project:
- API version: 1.18.0
- Package version: 1.18.0
- Build package: org.openapitools.codegen.languages.JavascriptClientCodegen
Installation
For Node.js
npm
To publish the library as a npm, please follow the procedure in "Publishing npm packages".
Then install it via:
npm install dogs_app --save
Finally, you need to build the module:
npm run build
Local development
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:
npm install
Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR
:
npm link
To use the link you just defined in your project, switch to the directory you want to use your dogs_app from, and run:
npm link /path/to/<JAVASCRIPT_CLIENT_DIR>
Finally, you need to build the module:
npm run build
git
If the library is hosted at a git repository, e.g.https://github.com/GIT_USER_ID/GIT_REPO_ID then install it via:
npm install GIT_USER_ID/GIT_REPO_ID --save
For browser
The library also works in the browser environment via npm and browserify. After following
the above steps with Node.js and installing browserify with npm install -g browserify
,
perform the following (assuming main.js is your entry file):
browserify main.js > bundle.js
Then include bundle.js in the HTML pages.
Webpack Configuration
Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:
module: {
rules: [
{
parser: {
amd: false
}
}
]
}
Getting Started
Please follow the installation instruction and execute the following JS code:
var DogsApp = require('dogs_app');
var api = new DogsApp.ConversationsApi()
var userId = 789; // {Number} Numeric ID of the user
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.getAllConversations(userId, callback);
Documentation for API Endpoints
All URIs are relative to https://api.server.test/v1
Class | Method | HTTP request | Description |
---|---|---|---|
DogsApp.ConversationsApi | getAllConversations | GET /users/{userId}/conversations | Return all conversations of user by userId |
DogsApp.ConversationsApi | getAllMessages | GET /users/{userId1}/conversations/{userId2} | Return all messages between user1 and user2 |
DogsApp.ConversationsApi | sendMessage | POST /message | Add message to conversation |
DogsApp.DogsApi | addDog | POST /users/{userId}/dogs | Add dog to user profile |
DogsApp.DogsApi | deleteDog | DELETE /users/{userId}/dogs/{dogId} | Delete dog with dogId |
DogsApp.DogsApi | editDog | PUT /users/{userId}/dogs/{dogId} | Update an existing dog |
DogsApp.DogsApi | getDogsImage | GET /users/{userId}/dogs/{dogId}/image | |
DogsApp.DogsApi | usersUserIdDogsDogIdGet | GET /users/{userId}/dogs/{dogId} | Return dog of user by dogId |
DogsApp.DogsApi | usersUserIdDogsGet | GET /users/{userId}/dogs | Return all dogs of user with userId |
DogsApp.ParksApi | addPark | POST /parks | Create park |
DogsApp.ParksApi | deletePark | DELETE /parks/{parkId} | Delete park with parkId |
DogsApp.ParksApi | getParks | GET /parks | Return all parks |
DogsApp.ParksApi | parksParkIdReviewsGet | GET /parks/{parkId}/reviews | Return all review of park by parkId |
DogsApp.ParksApi | parksParkIdReviewsPost | POST /parks/{parkId}/reviews | Add review to park with parkId |
DogsApp.PathsApi | addPath | POST /paths | Create path |
DogsApp.PathsApi | deletePath | DELETE /paths/{pathId} | Delete path with pathId |
DogsApp.PathsApi | getPaths | GET /paths | Return all paths |
DogsApp.PathsApi | pathsPathIdReviewsGet | GET /paths/{pathId}/reviews | Return all review of walking path by pathId |
DogsApp.PathsApi | pathsPathIdReviewsPost | POST /paths/{pathId}/reviews | Add review to path with pathId |
DogsApp.TagsApi | addTag | POST /users/{userId}/tags | Add tag to user profile |
DogsApp.TagsApi | deleteTag | DELETE /users/{userId}/tags/{tagId} | Delete tag |
DogsApp.UsersApi | getAllUsers | GET /users | Return all users |
DogsApp.UsersApi | getUsers | GET /users/area | Return all users in an area |
DogsApp.UsersApi | updateLocation | PUT /users/{userId}/location | Update user's location |
DogsApp.UsersApi | usersLoginPost | POST /users/login | User is logged in/registered |
DogsApp.UsersApi | usersRefreshTokenPut | PUT /users/refreshToken | Silent refresh of tokens |
DogsApp.UsersApi | usersUserIdDelete | DELETE /users/{userId} | Delete user with userId |
DogsApp.UsersApi | usersUserIdGet | GET /users/{userId} | Return user by userId |
DogsApp.UsersApi | usersUserIdLogoutPut | PUT /users/{userId}/logout | Log out from account |
DogsApp.UsersApi | usersUserIdPut | PUT /users/{userId} | Update an existing user |
Documentation for Models
- DogsApp.AreaFilter
- DogsApp.ChatMessage
- DogsApp.ChatMessagePost
- DogsApp.Conversation
- DogsApp.Coordinate
- DogsApp.Dog
- DogsApp.ErrorResponse
- DogsApp.Gender
- DogsApp.OnlineStatus
- DogsApp.Park
- DogsApp.RadiusFilter
- DogsApp.Review
- DogsApp.Tag
- DogsApp.User
- DogsApp.UserEdit
- DogsApp.UserLogin
- DogsApp.UserLoginPost
- DogsApp.UserOverview
- DogsApp.WalkingRoute
Documentation for Authorization
All endpoints do not require authorization.