Skip to content

feat: v2 platform sdk #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Binary file added .DS_Store
Binary file not shown.
776 changes: 212 additions & 564 deletions .openapi-generator/FILES

Large diffs are not rendered by default.

38 changes: 27 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# [Sendbird JavaScript Platform SDK](https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api)

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

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.
# Install
Expand All @@ -20,18 +21,22 @@ const apiToken = "YOUR_API_TOKEN";
const appId = "YOUR_APP_ID";

const opts = {
'createUserData': new SendbirdPlatformSdk.CreateUserData(userId, name, profileUrl),
createAUserRequest: new SendbirdPlatformSdk.CreateAUserRequest(
userId,
name,
profileUrl
),
};

async function createUser() {
const userApiInstance = new SendbirdPlatformSdk.UserApi();
userApiInstance.apiClient.basePath = `https://api-${appId}.sendbird.com`;
try {
const data = await userApiInstance.createUser(apiToken, opts);
console.log(data);
} catch (e) {
console.log(e);
}
const userApiInstance = new SendbirdPlatformSdk.UserApi();
userApiInstance.apiClient.basePath = `https://api-${appId}.sendbird.com`;
try {
const data = await userApiInstance.createAUser({apiToken, ...opts});
console.log(data);
} catch (e) {
console.log(e);
}
}

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

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


# 📦 Installation

You can install the SDK directly from npm:
```
# Using npm
npm install sendbird-platform-sdk

# Using yarn
yarn add sendbird-platform-sdk
```
> ⚠️ This SDK is intended for use in server-side environments only. Do not use it in browsers or frontend applications.

# 🤓 Local Development

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.
Expand Down Expand Up @@ -81,10 +99,8 @@ All the documentation for this project lives in the /docs directory of this repo
| | Documentation |
| ----------- | ----------- |
| Announcement | [docs/AnnouncementApi.md](docs/AnnouncementApi.md)|
| Application | [docs/ApplicationApi.md](docs/ApplicationApi.md) |
| Bot | [docs/BotApi.md](docs/BotApi.md) |
| GroupChannel | [docs/GroupChannelApi.md](docs/GroupChannelApi.md) |
| Message | [docs/MessageApi.md](docs/MessageApi.md) |
| OpenChannel | [docs/OpenChannelApi.md ](docs/OpenChannelApi.md) |
| User | [docs/UserApi.md](docs/UserApi.md) |
| Webhooks | [docs/WebhooksApi.md](docs/WebhooksApi.md) |
33 changes: 22 additions & 11 deletions dist/ApiClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,27 @@ Object.defineProperty(exports, "__esModule", {
exports["default"] = void 0;
var _superagent = _interopRequireDefault(require("superagent"));
var _querystring = _interopRequireDefault(require("querystring"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
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); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
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); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
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); }
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
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); } }
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
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); } /**
* Sendbird Platform SDK
* 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: [support@sendbird.com](https://mailto:support@sendbird.com)
*
* The version of the OpenAPI document: 1.0.0
* Contact: support@sendbird.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*
*/
/**
* @module ApiClient
* @version 0.0.16
* @version 2.0.0
*/
/**
* Manages low level client-server communications, parameter marshalling, etc. There should not be any need for an
Expand Down Expand Up @@ -50,7 +63,7 @@ var ApiClient = /*#__PURE__*/function () {
* @default {}
*/
this.defaultHeaders = {
'User-Agent': 'OpenAPI-Generator/0.0.16/Javascript'
'User-Agent': 'OpenAPI-Generator/2.0.0/Javascript'
};

/**
Expand Down Expand Up @@ -99,7 +112,7 @@ var ApiClient = /*#__PURE__*/function () {
* @param param The actual parameter.
* @returns {String} The string representation of <code>param</code>.
*/
_createClass(ApiClient, [{
return _createClass(ApiClient, [{
key: "paramToString",
value: function paramToString(param) {
if (param == undefined || param == null) {
Expand Down Expand Up @@ -648,7 +661,6 @@ var ApiClient = /*#__PURE__*/function () {
}
}
}]);
return ApiClient;
}();
/**
* Enumeration of collection format separator strategies.
Expand Down Expand Up @@ -688,5 +700,4 @@ ApiClient.CollectionFormatEnum = {
* @type {module:ApiClient}
*/
ApiClient.instance = new ApiClient();
var _default = ApiClient;
exports["default"] = _default;
var _default = exports["default"] = ApiClient;
Loading