Skip to content

Commit 8b4e1c8

Browse files
authored
Merge pull request #2 from sharathkumaranbu/Issue_1
Wrapper with postError function
2 parents b8c0793 + c1e1ae1 commit 8b4e1c8

Some content is hidden

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

80 files changed

+3138
-7288
lines changed

.swagger-codegen-ignore

Lines changed: 0 additions & 23 deletions
This file was deleted.

.swagger-codegen/VERSION

Lines changed: 0 additions & 1 deletion
This file was deleted.

.travis.yml

Lines changed: 0 additions & 7 deletions
This file was deleted.

README.md

Lines changed: 46 additions & 181 deletions
Original file line numberDiff line numberDiff line change
@@ -1,181 +1,46 @@
1-
# topcoder_meta_services_rest_api
2-
3-
TopcoderMetaServicesRestApi - JavaScript client for topcoder_meta_services_rest_api
4-
REST API for Topcoder Meta Services. This describes a service that can give information on other services existing on Topcoder. Available service links can be listed by sending GET request. Also, each service can return links to further services in their responses. ### Pagination Requests that return multiple items will be paginated to 20 items by default. You can specify further pages with the ```page``` parameter. You can also set a custom page size up to 100 with the ```perPage``` parameter. Pagination response data is included in http headers. By Default, the response header contains links with ```next```, ```last```, ```first```, ```prev``` resource links.
5-
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
6-
7-
- API version: 5.0.0
8-
- Package version: 5.0.0
9-
- Build package: io.swagger.codegen.languages.JavascriptClientCodegen
10-
For more information, please visit [http://www.topcoder.com/support](http://www.topcoder.com/support)
11-
12-
## Installation
13-
14-
### For [Node.js](https://nodejs.org/)
15-
16-
#### npm
17-
18-
To publish the library as a [npm](https://www.npmjs.com/),
19-
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 topcoder_meta_services_rest_api --save
25-
```
26-
27-
##### Local development
28-
29-
To use the library locally without publishing to a remote npm registry, first install the dependencies by changing
30-
into the directory containing `package.json` (and this README). Let's call this `JAVASCRIPT_CLIENT_DIR`. Then run:
31-
32-
```shell
33-
npm install
34-
```
35-
36-
Next, [link](https://docs.npmjs.com/cli/link) it globally in npm with the following, also from `JAVASCRIPT_CLIENT_DIR`:
37-
38-
```shell
39-
npm link
40-
```
41-
42-
Finally, switch to the directory you want to use your topcoder_meta_services_rest_api from, and run:
43-
44-
```shell
45-
npm link /path/to/<JAVASCRIPT_CLIENT_DIR>
46-
```
47-
48-
You should now be able to `require('topcoder_meta_services_rest_api')` in javascript files from the directory you ran the last
49-
command above from.
50-
51-
#### git
52-
#
53-
If the library is hosted at a git repository, e.g.
54-
https://github.com/GIT_USER_ID/GIT_REPO_ID
55-
then install it via:
56-
57-
```shell
58-
npm install GIT_USER_ID/GIT_REPO_ID --save
59-
```
60-
61-
### For browser
62-
63-
The library also works in the browser environment via npm and [browserify](http://browserify.org/). After following
64-
the above steps with Node.js and installing browserify with `npm install -g browserify`,
65-
perform the following (assuming *main.js* is your entry file, that's to say your javascript file where you actually
66-
use this library):
67-
68-
```shell
69-
browserify main.js > bundle.js
70-
```
71-
72-
Then include *bundle.js* in the HTML pages.
73-
74-
### Webpack Configuration
75-
76-
Using Webpack you may encounter the following error: "Module not found: Error:
77-
Cannot resolve module", most certainly you should disable AMD loader. Add/merge
78-
the following section to your webpack config:
79-
80-
```javascript
81-
module: {
82-
rules: [
83-
{
84-
parser: {
85-
amd: false
86-
}
87-
}
88-
]
89-
}
90-
```
91-
92-
## Getting Started
93-
94-
Please follow the [installation](#installation) instruction and execute the following JS code:
95-
96-
```javascript
97-
var TopcoderMetaServicesRestApi = require('topcoder_meta_services_rest_api');
98-
99-
var defaultClient = TopcoderMetaServicesRestApi.ApiClient.instance;
100-
101-
// Configure API key authorization: Bearer
102-
var Bearer = defaultClient.authentications['Bearer'];
103-
Bearer.apiKey = "YOUR API KEY"
104-
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
105-
//Bearer.apiKeyPrefix['Authorization'] = "Token"
106-
107-
var api = new TopcoderMetaServicesRestApi.EventsApi()
108-
109-
var body = new TopcoderMetaServicesRestApi.EventPayload(); // {EventPayload}
110-
111-
112-
var callback = function(error, data, response) {
113-
if (error) {
114-
console.error(error);
115-
} else {
116-
console.log('API called successfully.');
117-
}
118-
};
119-
api.postEvent(body, callback);
120-
121-
```
122-
123-
## Documentation for API Endpoints
124-
125-
All URIs are relative to *https://api.topcoder.com/v5*
126-
127-
Class | Method | HTTP request | Description
128-
------------ | ------------- | ------------- | -------------
129-
*TopcoderMetaServicesRestApi.EventsApi* | [**postEvent**](docs/EventsApi.md#postEvent) | **POST** /bus/events | Post event to the message bus.
130-
*TopcoderMetaServicesRestApi.HealthchecksApi* | [**getHealth**](docs/HealthchecksApi.md#getHealth) | **GET** /bus/health | Check API is healthy.
131-
*TopcoderMetaServicesRestApi.HealthchecksApi* | [**headHealth**](docs/HealthchecksApi.md#headHealth) | **HEAD** /bus/health | Get only response status and headers information but no response body for the endpoint.
132-
*TopcoderMetaServicesRestApi.PlaceholdersApi* | [**clearPlaceholdersCache**](docs/PlaceholdersApi.md#clearPlaceholdersCache) | **DELETE** /bus/placeholders | Clear placeholders cache.
133-
*TopcoderMetaServicesRestApi.ServiceApi* | [**createService**](docs/ServiceApi.md#createService) | **POST** /bus/services | Create a service.
134-
*TopcoderMetaServicesRestApi.ServiceApi* | [**createServicePayload**](docs/ServiceApi.md#createServicePayload) | **POST** /bus/services/{serviceName}/payloads | Create the service payload.
135-
*TopcoderMetaServicesRestApi.ServiceApi* | [**deleteService**](docs/ServiceApi.md#deleteService) | **DELETE** /bus/services/{serviceName} | Delete the service.
136-
*TopcoderMetaServicesRestApi.ServiceApi* | [**deleteServicePayload**](docs/ServiceApi.md#deleteServicePayload) | **DELETE** /bus/services/{serviceName}/payloads/{payloadName} | Delete the service payload.
137-
*TopcoderMetaServicesRestApi.ServiceApi* | [**getService**](docs/ServiceApi.md#getService) | **GET** /bus/services/{serviceName} | Get the service.
138-
*TopcoderMetaServicesRestApi.ServiceApi* | [**getServicePayload**](docs/ServiceApi.md#getServicePayload) | **GET** /bus/services/{serviceName}/payloads/{payloadName} | Get the service payload.
139-
*TopcoderMetaServicesRestApi.ServiceApi* | [**getServicePayloads**](docs/ServiceApi.md#getServicePayloads) | **GET** /bus/services/{serviceName}/payloads | Search the service payloads.
140-
*TopcoderMetaServicesRestApi.ServiceApi* | [**getServices**](docs/ServiceApi.md#getServices) | **GET** /bus/services | Get all services.
141-
*TopcoderMetaServicesRestApi.ServiceApi* | [**headService**](docs/ServiceApi.md#headService) | **HEAD** /bus/services/{serviceName} | Get only response status and headers information but no response body for the endpoint.
142-
*TopcoderMetaServicesRestApi.ServiceApi* | [**headServicePayload**](docs/ServiceApi.md#headServicePayload) | **HEAD** /bus/services/{serviceName}/payloads/{payloadName} | Get only response status and headers information but no response body for the endpoint.
143-
*TopcoderMetaServicesRestApi.ServiceApi* | [**headServicePayloads**](docs/ServiceApi.md#headServicePayloads) | **HEAD** /bus/services/{serviceName}/payloads | Get only response status and headers information but no response body for the endpoint.
144-
*TopcoderMetaServicesRestApi.ServiceApi* | [**headServices**](docs/ServiceApi.md#headServices) | **HEAD** /bus/services | Get only response status and headers information but no response body for the endpoint.
145-
*TopcoderMetaServicesRestApi.ServiceApi* | [**patchService**](docs/ServiceApi.md#patchService) | **PATCH** /bus/services/{serviceName} | Partially update the service.
146-
*TopcoderMetaServicesRestApi.ServiceApi* | [**patchServicePayload**](docs/ServiceApi.md#patchServicePayload) | **PATCH** /bus/services/{serviceName}/payloads/{payloadName} | Partially update the payload.
147-
*TopcoderMetaServicesRestApi.ServiceApi* | [**updateService**](docs/ServiceApi.md#updateService) | **PUT** /bus/services/{serviceName} | Update the service.
148-
*TopcoderMetaServicesRestApi.ServiceApi* | [**updateServicePayload**](docs/ServiceApi.md#updateServicePayload) | **PUT** /bus/services/{serviceName}/payloads/{payloadName} | Update the service payload.
149-
*TopcoderMetaServicesRestApi.TopicsApi* | [**getTopics**](docs/TopicsApi.md#getTopics) | **GET** /bus/topics | Get topics.
150-
*TopcoderMetaServicesRestApi.TopicsApi* | [**headTopics**](docs/TopicsApi.md#headTopics) | **HEAD** /bus/topics | Get only response status and headers information but no response body for the endpoint.
151-
152-
153-
## Documentation for Models
154-
155-
- [TopcoderMetaServicesRestApi.Accepted](docs/Accepted.md)
156-
- [TopcoderMetaServicesRestApi.BadRequest](docs/BadRequest.md)
157-
- [TopcoderMetaServicesRestApi.Body](docs/Body.md)
158-
- [TopcoderMetaServicesRestApi.Body1](docs/Body1.md)
159-
- [TopcoderMetaServicesRestApi.Conflict](docs/Conflict.md)
160-
- [TopcoderMetaServicesRestApi.EventPayload](docs/EventPayload.md)
161-
- [TopcoderMetaServicesRestApi.Forbidden](docs/Forbidden.md)
162-
- [TopcoderMetaServicesRestApi.HealthCheckStatus](docs/HealthCheckStatus.md)
163-
- [TopcoderMetaServicesRestApi.NoContent](docs/NoContent.md)
164-
- [TopcoderMetaServicesRestApi.NotFound](docs/NotFound.md)
165-
- [TopcoderMetaServicesRestApi.NotModified](docs/NotModified.md)
166-
- [TopcoderMetaServicesRestApi.Payload](docs/Payload.md)
167-
- [TopcoderMetaServicesRestApi.ServerError](docs/ServerError.md)
168-
- [TopcoderMetaServicesRestApi.Service](docs/Service.md)
169-
- [TopcoderMetaServicesRestApi.Unauthorized](docs/Unauthorized.md)
170-
- [TopcoderMetaServicesRestApi.ExtendedService](docs/ExtendedService.md)
171-
172-
173-
## Documentation for Authorization
174-
175-
176-
### Bearer
177-
178-
- **Type**: API key
179-
- **API key parameter name**: Authorization
180-
- **Location**: HTTP header
181-
1+
# tc-bus-api-wrapper
2+
3+
Wrapper library for Topcoder Bus API
4+
5+
## How to use this Wrapper
6+
7+
1. Include the wrapper in package.json as follows
8+
9+
```
10+
"tc-bus-api-wrapper": "topcoder-platform/tc-bus-api-wrapper.git"
11+
```
12+
13+
2. Create an instance of this wrapper with the configuration variables listed below
14+
15+
16+
```
17+
const busApi = require('tc-bus-api-wrapper')
18+
busApi(_.pick(config,
19+
['AUTH0_URL', 'AUTH0_AUDIENCE', 'TOKEN_CACHE_TIME',
20+
'AUTH0_CLIENT_ID', 'AUTH0_CLIENT_SECRET', 'BUSAPI_URL',
21+
'KAFKA_ERROR_TOPIC']))
22+
```
23+
24+
**Configuration / Environment variables:**
25+
26+
*Auth0 related variables:*
27+
- AUTH0_URL
28+
- AUTH0_AUDIENCE
29+
- TOKEN_CACHE_TIME (optional)
30+
- AUTH0_CLIENT_ID
31+
32+
- BUSAPI_URL - Bus API URL. E.g. `https://api.topcoder-dev.com/v5`
33+
34+
- KAFKA_ERROR_TOPIC - Error topic in Kafka to which error message need to be posted
35+
36+
3. Every function in this wrapper will return a promise, Handling promises is at the caller end. Call the functions with appropriate arguments
37+
38+
E.g.
39+
40+
```
41+
const result = yield busApiClient.getTopics()
42+
43+
yield busApiClient.postEvent(reqBody)
44+
```
45+
46+
Refer `index.js` for the list of available wrapper functions

docs/Accepted.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/BadRequest.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

docs/Body.md

Lines changed: 0 additions & 13 deletions
This file was deleted.

docs/Body1.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

docs/Conflict.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

docs/EventPayload.md

Lines changed: 0 additions & 12 deletions
This file was deleted.

docs/EventsApi.md

Lines changed: 0 additions & 62 deletions
This file was deleted.

0 commit comments

Comments
 (0)