Skip to content

Commit e5ce063

Browse files
Merge pull request #3 from sendbird/feat/v2-platform-sdk
feat: v2 platform sdk
2 parents 0566ddc + 7874957 commit e5ce063

File tree

1,637 files changed

+49904
-126090
lines changed

Some content is hidden

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

1,637 files changed

+49904
-126090
lines changed

.DS_Store

6 KB
Binary file not shown.

.openapi-generator/FILES

Lines changed: 212 additions & 564 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# [Sendbird JavaScript Platform SDK](https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api)
44

55
[![link to docs](https://img.shields.io/badge/SDK-docs-green)](/docs)
6+
[![NPM](https://img.shields.io/npm/v/sendbird-platform-sdk.svg)](https://www.npmjs.com/package/sendbird-platform-sdk)
67

78
This is a Node.js package that makes talking to the [Sendbird Platform API](https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api) easier. With this library you can extend your Sendbird integration to include advanced features like channel automation and user management.
89
# Install
@@ -20,18 +21,22 @@ const apiToken = "YOUR_API_TOKEN";
2021
const appId = "YOUR_APP_ID";
2122

2223
const opts = {
23-
'createUserData': new SendbirdPlatformSdk.CreateUserData(userId, name, profileUrl),
24+
createAUserRequest: new SendbirdPlatformSdk.CreateAUserRequest(
25+
userId,
26+
name,
27+
profileUrl
28+
),
2429
};
2530

2631
async function createUser() {
27-
const userApiInstance = new SendbirdPlatformSdk.UserApi();
28-
userApiInstance.apiClient.basePath = `https://api-${appId}.sendbird.com`;
29-
try {
30-
const data = await userApiInstance.createUser(apiToken, opts);
31-
console.log(data);
32-
} catch (e) {
33-
console.log(e);
34-
}
32+
const userApiInstance = new SendbirdPlatformSdk.UserApi();
33+
userApiInstance.apiClient.basePath = `https://api-${appId}.sendbird.com`;
34+
try {
35+
const data = await userApiInstance.createAUser({apiToken, ...opts});
36+
console.log(data);
37+
} catch (e) {
38+
console.log(e);
39+
}
3540
}
3641

3742
createUser();
@@ -48,6 +53,19 @@ In order to make requests with this SDK you will need you master API token. This
4853

4954
You will need [Node.js](https://nodejs.org/en/download/) installed. This has been developed and tested with NodeJS 17+.
5055

56+
57+
# 📦 Installation
58+
59+
You can install the SDK directly from npm:
60+
```
61+
# Using npm
62+
npm install sendbird-platform-sdk
63+
64+
# Using yarn
65+
yarn add sendbird-platform-sdk
66+
```
67+
> ⚠️ This SDK is intended for use in server-side environments only. Do not use it in browsers or frontend applications.
68+
5169
# 🤓 Local Development
5270

5371
To run locally we need to make use of the [npm link](https://docs.npmjs.com/cli/v8/commands/npm-link) command. You will require two terminal tabs.
@@ -81,10 +99,8 @@ All the documentation for this project lives in the /docs directory of this repo
8199
| | Documentation |
82100
| ----------- | ----------- |
83101
| Announcement | [docs/AnnouncementApi.md](docs/AnnouncementApi.md)|
84-
| Application | [docs/ApplicationApi.md](docs/ApplicationApi.md) |
85102
| Bot | [docs/BotApi.md](docs/BotApi.md) |
86103
| GroupChannel | [docs/GroupChannelApi.md](docs/GroupChannelApi.md) |
87104
| Message | [docs/MessageApi.md](docs/MessageApi.md) |
88105
| OpenChannel | [docs/OpenChannelApi.md ](docs/OpenChannelApi.md) |
89106
| User | [docs/UserApi.md](docs/UserApi.md) |
90-
| Webhooks | [docs/WebhooksApi.md](docs/WebhooksApi.md) |

dist/ApiClient.js

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,27 @@ Object.defineProperty(exports, "__esModule", {
66
exports["default"] = void 0;
77
var _superagent = _interopRequireDefault(require("superagent"));
88
var _querystring = _interopRequireDefault(require("querystring"));
9-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
10-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
11-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
12-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
13-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
9+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
10+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
11+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
12+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
13+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
14+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
15+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
16+
* Sendbird Platform SDK
17+
* Sendbird Platform API SDK [https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api](https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api) Contact Support: Name: Sendbird Email: [[email protected]](https://mailto:[email protected])
18+
*
19+
* The version of the OpenAPI document: 1.0.0
20+
* Contact: [email protected]
21+
*
22+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
23+
* https://openapi-generator.tech
24+
* Do not edit the class manually.
25+
*
26+
*/
1427
/**
1528
* @module ApiClient
16-
* @version 0.0.16
29+
* @version 2.0.0
1730
*/
1831
/**
1932
* Manages low level client-server communications, parameter marshalling, etc. There should not be any need for an
@@ -50,7 +63,7 @@ var ApiClient = /*#__PURE__*/function () {
5063
* @default {}
5164
*/
5265
this.defaultHeaders = {
53-
'User-Agent': 'OpenAPI-Generator/0.0.16/Javascript'
66+
'User-Agent': 'OpenAPI-Generator/2.0.0/Javascript'
5467
};
5568

5669
/**
@@ -99,7 +112,7 @@ var ApiClient = /*#__PURE__*/function () {
99112
* @param param The actual parameter.
100113
* @returns {String} The string representation of <code>param</code>.
101114
*/
102-
_createClass(ApiClient, [{
115+
return _createClass(ApiClient, [{
103116
key: "paramToString",
104117
value: function paramToString(param) {
105118
if (param == undefined || param == null) {
@@ -648,7 +661,6 @@ var ApiClient = /*#__PURE__*/function () {
648661
}
649662
}
650663
}]);
651-
return ApiClient;
652664
}();
653665
/**
654666
* Enumeration of collection format separator strategies.
@@ -688,5 +700,4 @@ ApiClient.CollectionFormatEnum = {
688700
* @type {module:ApiClient}
689701
*/
690702
ApiClient.instance = new ApiClient();
691-
var _default = ApiClient;
692-
exports["default"] = _default;
703+
var _default = exports["default"] = ApiClient;

0 commit comments

Comments
 (0)