New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@bandada/api-sdk

Package Overview
Dependencies
Maintainers
3
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bandada/api-sdk - npm Package Compare versions

Comparing version 2.2.2 to 2.2.3

51

dist/index.node.js
/**
* @module @bandada/api-sdk
* @version 2.2.2
* @version 2.2.3
* @file A Typescript SDK for the Bandada API.

@@ -426,2 +426,24 @@ * @copyright Ethereum Foundation 2023

}
/**
* Creates one new group invite.
* @param groupId The group identifier.
* @param apiKey API Key of the admin.
* @returns Invite.
*/
function createInvite(config, groupId, apiKey) {
return __awaiter(this, void 0, void 0, function () {
var newConfig, req;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
newConfig = __assign({ method: "post", data: groupId }, config);
newConfig.headers["x-api-key"] = apiKey;
return [4 /*yield*/, utils.request(url, newConfig)];
case 1:
req = _a.sent();
return [2 /*return*/, req];
}
});
});
}

@@ -752,2 +774,21 @@ var ApiSdk = /** @class */ (function () {

/**
* Creates a new group invite.
* @param groupId The group identifier.
* @param apiKey The api key.
* @returns Specific invite.
*/
ApiSdk.prototype.createInvite = function (groupId, apiKey) {
return __awaiter(this, void 0, void 0, function () {
var invite;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, createInvite(this._config, groupId, apiKey)];
case 1:
invite = _a.sent();
return [2 /*return*/, invite];
}
});
});
};
/**
* Returns a specific invite.

@@ -761,4 +802,8 @@ * @param inviteCode Invite code.

return __generator(this, function (_a) {
invite = getInvite(this._config, inviteCode);
return [2 /*return*/, invite];
switch (_a.label) {
case 0: return [4 /*yield*/, getInvite(this._config, inviteCode)];
case 1:
invite = _a.sent();
return [2 /*return*/, invite];
}
});

@@ -765,0 +810,0 @@ });

@@ -131,2 +131,9 @@ import { SupportedUrl, Group, Invite, GroupCreationDetails, GroupUpdateDetails } from "./types";

/**
* Creates a new group invite.
* @param groupId The group identifier.
* @param apiKey The api key.
* @returns Specific invite.
*/
createInvite(groupId: string, apiKey: string): Promise<Invite>;
/**
* Returns a specific invite.

@@ -133,0 +140,0 @@ * @param inviteCode Invite code.

@@ -8,1 +8,8 @@ import { Invite } from "./types";

export declare function getInvite(config: object, inviteCode: string): Promise<Invite>;
/**
* Creates one new group invite.
* @param groupId The group identifier.
* @param apiKey API Key of the admin.
* @returns Invite.
*/
export declare function createInvite(config: object, groupId: string, apiKey: string): Promise<Invite>;

4

dist/types/types/index.d.ts

@@ -44,6 +44,4 @@ export type Credential = {

isRedeemed: boolean;
group: GroupSummary;
createdAt: Date;
group: GroupSummary;
groupName: string;
groupId: string;
};

@@ -50,0 +48,0 @@ export declare enum SupportedUrl {

{
"name": "@bandada/api-sdk",
"version": "2.2.2",
"version": "2.2.3",
"description": "A Typescript SDK for the Bandada API.",

@@ -32,3 +32,3 @@ "license": "MIT",

"dependencies": {
"@bandada/utils": "2.2.2"
"@bandada/utils": "2.2.3"
},

@@ -35,0 +35,0 @@ "devDependencies": {

@@ -25,3 +25,3 @@ import {

} from "./groups"
import { getInvite } from "./invites"
import { createInvite, getInvite } from "./invites"

@@ -309,2 +309,14 @@ export default class ApiSdk {

/**
* Creates a new group invite.
* @param groupId The group identifier.
* @param apiKey The api key.
* @returns Specific invite.
*/
async createInvite(groupId: string, apiKey: string): Promise<Invite> {
const invite = await createInvite(this._config, groupId, apiKey)
return invite
}
/**
* Returns a specific invite.

@@ -315,3 +327,3 @@ * @param inviteCode Invite code.

async getInvite(inviteCode: string): Promise<Invite> {
const invite = getInvite(this._config, inviteCode)
const invite = await getInvite(this._config, inviteCode)

@@ -318,0 +330,0 @@ return invite

@@ -524,33 +524,78 @@ import { request } from "@bandada/utils"

describe("Invites", () => {
it("# createInvite", async () => {
const groupId = "95633257675970239314311768035433"
const groupName = "Group 1"
const group = {
id: groupId,
name: groupName,
description: "This is Group 1",
adminId:
"0x63229164c457584616006e31d1e171e6cdd4163695bc9c4bf0227095998ffa4c",
treeDepth: 16,
fingerprintDuration: 3600,
credentials: null,
apiEnabled: false,
apiKey: null,
createdAt: "2023-08-09T18:09:53.000Z",
updatedAt: "2023-08-09T18:09:53.000Z"
}
const apiKey = "70f07d0d-6aa2-4fe1-b4b9-06c271a641dc"
const inviteCode = "C5VAG4HD"
const inviteCreatedAt = "2023-08-09T18:10:02.000Z"
requestMocked.mockImplementationOnce(() =>
Promise.resolve({
code: inviteCode,
isRedeemed: false,
createdAt: inviteCreatedAt,
group
})
)
apiSdk = new ApiSdk(SupportedUrl.DEV)
const invite: Invite = await apiSdk.createInvite(groupId, apiKey)
expect(invite.code).toBe(inviteCode)
expect(invite.createdAt).toBe(inviteCreatedAt)
expect(invite.code).toBe(inviteCode)
expect(invite.group).toStrictEqual(group)
})
describe("# getInvite", () => {
it("Should return an invite", async () => {
const groupId = "95633257675970239314311768035433"
const groupName = "Group 1"
const group = {
id: groupId,
name: groupName,
description: "This is Group 1",
adminId:
"0x63229164c457584616006e31d1e171e6cdd4163695bc9c4bf0227095998ffa4c",
treeDepth: 16,
fingerprintDuration: 3600,
credentials: null,
apiEnabled: false,
apiKey: null,
createdAt: "2023-08-09T18:09:53.000Z",
updatedAt: "2023-08-09T18:09:53.000Z"
}
const inviteCode = "C5VAG4HD"
const inviteCreatedAt = "2023-08-09T18:10:02.000Z"
requestMocked.mockImplementationOnce(() =>
Promise.resolve({
code: "C5VAG4HD",
code: inviteCode,
isRedeemed: false,
createdAt: "2023-08-09T18:10:02.000Z",
group: {
id: "95633257675970239314311768035433",
name: "Group 1",
description: "This is Group 1",
adminId:
"0x63229164c457584616006e31d1e171e6cdd4163695bc9c4bf0227095998ffa4c",
treeDepth: 16,
fingerprintDuration: 3600,
credentials: null,
apiEnabled: false,
apiKey: null,
createdAt: "2023-08-09T18:09:53.000Z",
updatedAt: "2023-08-09T18:09:53.000Z"
},
groupName: "Group 1",
groupId: "95633257675970239314311768035433"
createdAt: inviteCreatedAt,
group
})
)
const inviteCode = "C5VAG4HD"
apiSdk = new ApiSdk(SupportedUrl.DEV)
const invite: Invite = await apiSdk.getInvite(inviteCode)
expect(invite.code).toBe(inviteCode)
expect(invite.createdAt).toBe(inviteCreatedAt)
expect(invite.code).toBe(inviteCode)
expect(invite.group).toStrictEqual(group)
})

@@ -557,0 +602,0 @@ })

@@ -23,1 +23,25 @@ import { request } from "@bandada/utils"

}
/**
* Creates one new group invite.
* @param groupId The group identifier.
* @param apiKey API Key of the admin.
* @returns Invite.
*/
export async function createInvite(
config: object,
groupId: string,
apiKey: string
): Promise<Invite> {
const newConfig: any = {
method: "post",
data: groupId,
...config
}
newConfig.headers["x-api-key"] = apiKey
const req = await request(url, newConfig)
return req
}

@@ -49,6 +49,4 @@ export type Credential = {

isRedeemed: boolean
group: GroupSummary
createdAt: Date
group: GroupSummary
groupName: string
groupId: string
}

@@ -55,0 +53,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc