Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vkontakte-api

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vkontakte-api - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

2

CHANGELOG.md

@@ -5,2 +5,4 @@ # Changelog

### [3.0.1](https://github.com/wolframdeus/vk-api/compare/v3.0.0...v3.0.1) (2021-07-05)
## [3.0.0](https://github.com/wolframdeus/vk-api/compare/v2.5.4...v3.0.0) (2021-07-05)

@@ -7,0 +9,0 @@

2

package.json
{
"name": "vkontakte-api",
"version": "3.0.0",
"version": "3.0.1",
"description": "TypeScript library to make requests performing to VK API simple",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/wolframdeus/vk-api",

@@ -7,6 +7,4 @@ [npm-badge]: https://img.shields.io/npm/v/vkontakte-api.svg

TypeScript library to make requests performing to VK API simple.
TypeScript library to make requests performing to VK API simple.
Docs: [EN](https://github.com/wolframdeus/vk-api/blob/master/README.md) / [RU](https://github.com/wolframdeus/vk-api/blob/master/README-RU.md)
## Installation

@@ -50,5 +48,5 @@ ```bash

Additionally, you can pass properties `accessToken` and `lang` which will be
used as default parameters for each request. So, you have no need to pass them
each time until overriding is needed:
Additionally, you can pass suck properties as `accessToken` and `lang` which
will be used as default parameters for each request. So, you have no need to
pass them each time until overriding is needed:

@@ -71,4 +69,3 @@ ```typescript

// Firstly, describe parameters and result. Dont forget that sent parameters
// will be snake cased, and result - camel cased.
// Firstly, describe parameters and result.
/**

@@ -79,3 +76,3 @@ * @see https://vk.com/dev/auth.restore

phone: string;
lastName: string;
last_name: string;
}

@@ -88,3 +85,3 @@

// Create repository class which should extends abstract Repository.
// Create repository class which should extend abstract Repository.
export class AuthRepository extends Repository {

@@ -100,8 +97,10 @@ constructor(sendRequest: TSendRequest) {

* @see https://vk.com/dev/auth.restore
* @type {(params: (IRestoreParams & IRequestOptionalParams)) => Promise<IRestoreResult>}
*/
// Describe all repository methods. As the first we should pass method name.
// As a second one - function which modifies passed parameters however we
// want. You could use such functions as "formatOptionalArray" or
// "formatOptionalBoolean" from 'vkontakte-api'.
// Describe all repository methods.
// As the first argument we should pass method name.
// As the second one - function which modifies passed parameters
// the way we want.
// And as the third one - function, which formats server's response.
// You could use such functions as "formatOptionalArray" or
// "formatOptionalBoolean" from this package.
restore = this.r<IRestoreParams, IRestoreResult>('restore');

@@ -114,3 +113,3 @@ }

// At this moment, TypeScript knows about such repository as 'auth'.
api.auth.restore({phone: '...', lastName: '...'});
api.auth.restore({phone: '...', last_name: '...'});
```

@@ -146,3 +145,3 @@

api.users.get({userIds: ['vladkibenko']}).then(console.log);
api.users.get({user_ids: ['vladkibenko']}).then(console.log);
```

@@ -153,3 +152,3 @@

api.notifications.sendMessage({
userIds: ['vladkibenko'],
user_ids: ['vladkibenko'],
message: 'Hello Vlad!',

@@ -167,4 +166,4 @@ });

api.users.get({
userIds: ['vladkibenko'],
accessToken: 'some application token',
user_ids: ['vladkibenko'],
access_token: 'some application token',
// Or you could just use 'en' or 3.

@@ -176,5 +175,3 @@ lang: ELang.EN,

Some methods or repositories are still not implemented. Nevertheless, you are
free to perform custom requests. **Make sure, all of `Params` and `Response`
fields are camel cased, because internally, `vkontakte-api` moves them from
snake to camel case for easier usage**:
free to perform custom requests.

@@ -188,10 +185,7 @@ ```typescript

interface Params {
cityIds: string;
city_ids: string;
}
// Description of response.
type Response = Array<{
id: number;
title: string;
}>;
type Response = {id: number; title: string}[];

@@ -202,3 +196,3 @@ // @see https://vk.com/dev/database.getCitiesById

params: {
cityIds: [1].join(','),
city_ids: [1].join(','),
},

@@ -224,3 +218,3 @@ }).then(console.log);

Here is simple example:
Here is the simple example:
```typescript

@@ -237,3 +231,3 @@ import {fork, isMaster, Worker} from 'cluster';

// Here we can use all of the VKAPI methods
api.users.get({userIds: ['vladkibenko']}).then(console.log);
api.users.get({user_ids: ['vladkibenko']}).then(console.log);
}

@@ -240,0 +234,0 @@

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