vkontakte-api
Advanced tools
Comparing version 2.5.4 to 3.0.0
@@ -5,2 +5,16 @@ # Changelog | ||
## [3.0.0](https://github.com/wolframdeus/vk-api/compare/v2.5.4...v3.0.0) (2021-07-05) | ||
### ⚠ BREAKING CHANGES | ||
* **response and params:** Now, parameters and responses are not formatted in casing. So, your parameters will | ||
be sent as they are passed, and response returned will not be modified | ||
* **response and params:** Now, parameters and responses are not formatted in casing. So, your parameters will | ||
be sent as they are passed, and response returned will not be modified | ||
### Features | ||
* **response and params:** response and parameters are not camlized now ([faf2cf5](https://github.com/wolframdeus/vk-api/commit/faf2cf5a6ec93e0d474f1db505ff7e2bdf554a8f)) | ||
### [2.5.4](https://github.com/wolframdeus/vk-api/compare/v2.5.3...v2.5.4) (2021-06-25) | ||
@@ -7,0 +21,0 @@ |
@@ -26,6 +26,5 @@ import { IRepositories } from '../types'; | ||
* Adds new repository if it is not implemented. | ||
* @param {N extends keyof this ? never : N} name | ||
* @param {{new(sendRequest: TSendRequest): R, prototype: R}} Repo | ||
* @param {TSendRequest} addRequestToQueue | ||
* @returns {this & Record<N, R>} | ||
* @param name - name of repository. | ||
* @param Repo - repository class. | ||
* @param addRequestToQueue - function which adds request to queue. | ||
*/ | ||
@@ -32,0 +31,0 @@ addRepository<N extends string, R extends Repository>(name: N extends keyof this ? never : N, Repo: { |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isVKAPIMessage=void 0;var utils_1=require("../utils");function isVKAPIMessage(e){return utils_1.isNonNullObject(e)&&"string"==typeof e.tunnelName&&"string"==typeof e.requestId&&!0===e.isVKAPIMessage}exports.isVKAPIMessage=isVKAPIMessage; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isVKAPIMessage=void 0;var utils_1=require("../utils");function isVKAPIMessage(e){return utils_1.isRecord(e)&&"string"==typeof e.tunnelName&&"string"==typeof e.requestId&&!0===e.isVKAPIMessage}exports.isVKAPIMessage=isVKAPIMessage; |
@@ -8,3 +8,2 @@ import { Repository } from '../Repository'; | ||
* @see https://vk.com/dev/account.ban | ||
* @type {(params: (IBanParams & IRequestOptionalParams)) => Promise<1>} | ||
*/ | ||
@@ -14,3 +13,2 @@ ban: import("../../types").TRepositoryMethod<IBanParams, 1>; | ||
* @see https://vk.com/dev/account.changePassword | ||
* @type {(params: (IChangePasswordParams & IRequestOptionalParams)) => Promise<IChangePasswordResult>} | ||
*/ | ||
@@ -20,3 +18,2 @@ changePassword: import("../../types").TRepositoryMethod<IChangePasswordParams, IChangePasswordResult>; | ||
* @see https://vk.com/dev/account.getActiveOffers | ||
* @type {(params: (IGetActiveOffersParams & IRequestOptionalParams)) => Promise<IGetActiveOffersResult>} | ||
*/ | ||
@@ -26,3 +23,2 @@ getActiveOffers: import("../../types").TRepositoryMethod<IGetActiveOffersParams, IGetActiveOffersResult>; | ||
* @see https://vk.com/dev/account.getAppPermissions | ||
* @type {(params: (IGetAppPermissionsParams & IRequestOptionalParams)) => Promise<number>} | ||
*/ | ||
@@ -32,3 +28,2 @@ getAppPermissions: import("../../types").TRepositoryMethod<IGetAppPermissionsParams, number>; | ||
* @see https://vk.com/dev/account.getBanned | ||
* @type {(params: (IGetBannedParams & IRequestOptionalParams)) => Promise<IGetBannedResult>} | ||
*/ | ||
@@ -38,3 +33,2 @@ getBanned: import("../../types").TRepositoryMethod<IGetBannedParams, IGetBannedResult>; | ||
* @see https://vk.com/dev/account.getCounters | ||
* @type {(params: (IGetCountersParams & IRequestOptionalParams)) => Promise<[] | Partial<Record<"friends" | "friends_suggestions" | "friends_recommendations" | "messages" | "menu_discover_badge" | "menu_clips_badge" | "menu_superapp_friends_badge" | "photos" | "videos" | "gifts" | "events" | "groups" | "notifications" | "sdk" | "app_requests", number>>>} | ||
*/ | ||
@@ -44,3 +38,2 @@ getCounters: import("../../types").TRepositoryMethod<IGetCountersParams, TGetCountersResult>; | ||
* @see https://vk.com/dev/account.getInfo | ||
* @type {(params: (IGetInfoParams & IRequestOptionalParams)) => Promise<IGetInfoResult>} | ||
*/ | ||
@@ -50,3 +43,2 @@ getInfo: import("../../types").TRepositoryMethod<IGetInfoParams, IGetInfoResult>; | ||
* @see https://vk.com/dev/account.getProfileInfo | ||
* @type {(params: (IGetProfileInfoParams & IRequestOptionalParams)) => Promise<IGetProfileInfoResult>} | ||
*/ | ||
@@ -56,3 +48,2 @@ getProfileInfo: import("../../types").TRepositoryMethod<IGetProfileInfoParams, IGetProfileInfoResult>; | ||
* @see https://vk.com/dev/account.getPushSettings | ||
* @type {(params: (({token: string} & IRequestOptionalParams) | ({deviceId: number} & IRequestOptionalParams))) => Promise<IGetPushSettingsResult>} | ||
*/ | ||
@@ -62,7 +53,6 @@ getPushSettings: import("../../types").TRepositoryMethod<{ | ||
} | { | ||
deviceId: number; | ||
device_id: number; | ||
}, IGetPushSettingsResult>; | ||
/** | ||
* @see https://vk.com/dev/account.registerDevice | ||
* @type {(params: (IRegisterDeviceParams & IRequestOptionalParams)) => Promise<1>} | ||
*/ | ||
@@ -72,3 +62,2 @@ registerDevice: import("../../types").TRepositoryMethod<IRegisterDeviceParams, 1>; | ||
* @see https://vk.com/dev/account.saveProfileInfo | ||
* @type {(params: (ISaveProfileInfoParams & IRequestOptionalParams)) => Promise<ISaveProfileInfoResult>} | ||
*/ | ||
@@ -78,3 +67,2 @@ saveProfileInfo: import("../../types").TRepositoryMethod<ISaveProfileInfoParams, ISaveProfileInfoResult>; | ||
* @see https://vk.com/dev/account.setInfo | ||
* @type {(params: ((TSetInfoParam<"intro", number> & IRequestOptionalParams) | (TSetInfoParam<"own_posts_default", 0 | 1> & IRequestOptionalParams) | (TSetInfoParam<"no_wall_replies", 0 | 1> & IRequestOptionalParams))) => Promise<1>} | ||
*/ | ||
@@ -84,3 +72,2 @@ setInfo: import("../../types").TRepositoryMethod<TSetInfoParams, 1>; | ||
* @see https://vk.com/dev/account.setNameInMenu | ||
* @type {(params: (ISetNameInMenuParams & IRequestOptionalParams)) => Promise<1>} | ||
*/ | ||
@@ -90,3 +77,2 @@ setNameInMenu: import("../../types").TRepositoryMethod<ISetNameInMenuParams, 1>; | ||
* @see https://vk.com/dev/account.setOffline | ||
* @type {(params: (ISetOfflineParams & IRequestOptionalParams)) => Promise<1>} | ||
*/ | ||
@@ -96,3 +82,2 @@ setOffline: import("../../types").TRepositoryMethod<ISetOfflineParams, 1>; | ||
* @see https://vk.com/dev/account.setOnline | ||
* @type {(params: (ISetOnlineParams & IRequestOptionalParams)) => Promise<1>} | ||
*/ | ||
@@ -102,3 +87,2 @@ setOnline: import("../../types").TRepositoryMethod<ISetOnlineParams, 1>; | ||
* @see https://vk.com/dev/account.setPushSettings | ||
* @type {(params: (({token: string} & {settings: IPushSettings, key: string, value: TPushSetting[]} & IRequestOptionalParams) | ({deviceId: number} & {settings: IPushSettings, key: string, value: TPushSetting[]} & IRequestOptionalParams))) => Promise<1>} | ||
*/ | ||
@@ -108,3 +92,2 @@ setPushSettings: import("../../types").TRepositoryMethod<TSetPushSettingsParams, 1>; | ||
* @see https://vk.com/dev/account.setSilenceMode | ||
* @type {(params: (TSetSilenceModeParams & IRequestOptionalParams)) => Promise<1>} | ||
*/ | ||
@@ -114,3 +97,2 @@ setSilenceMode: import("../../types").TRepositoryMethod<TSetSilenceModeParams, 1>; | ||
* @see https://vk.com/dev/account.unban | ||
* @type {(params: (IUnbanParams & IRequestOptionalParams)) => Promise<1>} | ||
*/ | ||
@@ -120,5 +102,4 @@ unban: import("../../types").TRepositoryMethod<IUnbanParams, 1>; | ||
* @see https://vk.com/dev/account.unregisterDevice | ||
* @type {(params: (({token: string} & {sandbox?: boolean} & IRequestOptionalParams) | ({deviceId: number} & {sandbox?: boolean} & IRequestOptionalParams))) => Promise<1>} | ||
*/ | ||
unregisterDevice: import("../../types").TRepositoryMethod<TUnregisterDeviceParams, 1>; | ||
} |
@@ -7,3 +7,3 @@ import { ERelationsStatus, ESex, IIdTitlePair, IPager, IPushSettings, TPseudoBoolean, TPushSetting, TUser } from '../../types'; | ||
} | { | ||
deviceId: number; | ||
device_id: number; | ||
}; | ||
@@ -17,4 +17,4 @@ export declare enum EAccountBirthDateVisibility { | ||
id: number; | ||
firstName: string; | ||
lastName: string; | ||
first_name: string; | ||
last_name: string; | ||
} & ({ | ||
@@ -27,3 +27,3 @@ status: 'processing' | 'declined' | 'response'; | ||
status: 'was_accepted' | 'was_declined'; | ||
repeatDate: string; | ||
repeat_date: string; | ||
}); | ||
@@ -34,3 +34,3 @@ /** | ||
export interface IBanParams { | ||
ownerId: number; | ||
owner_id: number; | ||
} | ||
@@ -42,6 +42,6 @@ export declare type TBanResult = 1; | ||
export interface IChangePasswordParams { | ||
restoreSid?: string; | ||
changePasswordHash?: string; | ||
oldPassword?: string; | ||
newPassword: string; | ||
restore_sid?: string; | ||
change_password_hash?: string; | ||
old_password?: string; | ||
new_password: string; | ||
} | ||
@@ -64,3 +64,3 @@ export interface IChangePasswordResult { | ||
export interface IGetAppPermissionsParams { | ||
userId: number; | ||
user_id: number; | ||
} | ||
@@ -78,4 +78,4 @@ export declare type TGetAppPermissionsResult = number; | ||
id: number; | ||
firstName: string; | ||
lastName: string; | ||
first_name: string; | ||
last_name: string; | ||
deactivated: 'banned'; | ||
@@ -100,9 +100,9 @@ }[]; | ||
country?: string; | ||
communityComments?: boolean; | ||
httpsRequired?: TPseudoBoolean; | ||
community_comments?: boolean; | ||
https_required?: TPseudoBoolean; | ||
intro?: TPseudoBoolean; | ||
linkRedirects?: Record<string, string>; | ||
link_redirects?: Record<string, string>; | ||
lang?: number; | ||
noWallReplies?: TPseudoBoolean; | ||
ownPostsDefault?: TPseudoBoolean; | ||
no_wall_replies?: TPseudoBoolean; | ||
own_posts_default?: TPseudoBoolean; | ||
settings?: { | ||
@@ -114,3 +114,3 @@ available: boolean; | ||
}[]; | ||
subscriptionCountry: string; | ||
subscription_country: string; | ||
} | ||
@@ -123,13 +123,13 @@ /** | ||
export interface IGetProfileInfoResult { | ||
firstName: string; | ||
first_name: string; | ||
id: number; | ||
lastName: string; | ||
maidenName?: string; | ||
nameRequest?: TNameRequest; | ||
screenName?: string; | ||
last_name: string; | ||
maiden_name?: string; | ||
name_request?: TNameRequest; | ||
screen_name?: string; | ||
sex: ESex; | ||
homeTown: string; | ||
home_town: string; | ||
status: string; | ||
bdate: string; | ||
bdateVisibility: EAccountBirthDateVisibility; | ||
bdate_visibility: EAccountBirthDateVisibility; | ||
city?: IIdTitlePair; | ||
@@ -139,5 +139,5 @@ country?: IIdTitlePair; | ||
relation: ERelationsStatus; | ||
relationPartner?: TUser; | ||
relationPending?: TPseudoBoolean; | ||
relationRequests?: TUser[]; | ||
relation_partner?: TUser; | ||
relation_pending?: TPseudoBoolean; | ||
relation_requests?: TUser[]; | ||
} | ||
@@ -150,10 +150,10 @@ /** | ||
disabled: TPseudoBoolean; | ||
disabledUntil?: number; | ||
disabled_until?: number; | ||
settings?: IPushSettings; | ||
conversations: IPager<{ | ||
disabledUntil: number; | ||
peerId: number; | ||
disabled_until: number; | ||
peer_id: number; | ||
sound: TPseudoBoolean; | ||
disabledMentions: TPseudoBoolean; | ||
disabledMassMentions: TPseudoBoolean; | ||
disabled_mentions: TPseudoBoolean; | ||
disabled_mass_mentions: TPseudoBoolean; | ||
}>; | ||
@@ -166,6 +166,6 @@ } | ||
token: string; | ||
deviceModel?: string; | ||
deviceYear?: number; | ||
deviceId: number; | ||
systemVersion?: string; | ||
device_model?: string; | ||
device_year?: number; | ||
device_id: number; | ||
system_version?: string; | ||
settings?: IPushSettings; | ||
@@ -179,15 +179,15 @@ sandbox?: boolean; | ||
export interface ISaveProfileInfoParams { | ||
firstName?: string; | ||
lastName?: string; | ||
maidenName?: string; | ||
screenName?: string; | ||
cancelRequestId?: number; | ||
first_name?: string; | ||
last_name?: string; | ||
maiden_name?: string; | ||
screen_name?: string; | ||
cancel_request_id?: number; | ||
sex?: Exclude<ESex, ESex.Unknown>; | ||
relation?: ERelationsStatus; | ||
relationPartnerId?: number; | ||
relation_partner_id?: number; | ||
bdate?: string; | ||
bdateVisibility?: EAccountBirthDateVisibility; | ||
homeTown?: string; | ||
countryId?: number; | ||
cityId?: number; | ||
bdate_visibility?: EAccountBirthDateVisibility; | ||
home_town?: string; | ||
country_id?: number; | ||
city_id?: number; | ||
status?: string; | ||
@@ -197,3 +197,3 @@ } | ||
changed: TPseudoBoolean; | ||
nameRequest?: TNameRequest; | ||
name_request?: TNameRequest; | ||
} | ||
@@ -213,3 +213,3 @@ /** | ||
export interface ISetNameInMenuParams { | ||
userId: number; | ||
user_id: number; | ||
name: string; | ||
@@ -245,5 +245,5 @@ } | ||
time: number; | ||
chatId?: number; | ||
userId?: number; | ||
peerId?: number; | ||
chat_id?: number; | ||
user_id?: number; | ||
peer_id?: number; | ||
sound: TPseudoBoolean; | ||
@@ -256,3 +256,3 @@ }; | ||
export interface IUnbanParams { | ||
ownerId: number; | ||
owner_id: number; | ||
} | ||
@@ -259,0 +259,0 @@ export declare type TUnbanResult = 1; |
@@ -8,5 +8,4 @@ import { Repository } from '../Repository'; | ||
* @see https://vk.com/dev/auth.restore | ||
* @type {(params: (IRestoreParams & IRequestOptionalParams)) => Promise<IRestoreResult>} | ||
*/ | ||
restore: import("../../types").TRepositoryMethod<IRestoreParams, IRestoreResult>; | ||
} |
@@ -6,3 +6,3 @@ /** | ||
phone: string; | ||
lastName: string; | ||
last_name: string; | ||
} | ||
@@ -9,0 +9,0 @@ export interface IRestoreResult { |
@@ -8,60 +8,48 @@ import { Repository } from '../Repository'; | ||
* @see https://vk.com/dev/database.getChairs | ||
* @type {TRepositoryMethod<IGetChairsParams, TGetChairsResult>} | ||
*/ | ||
*/ | ||
getChairs: import("../../types").TRepositoryMethod<IGetChairsParams, import("../../types").IPager<import("../../types").IIdTitlePair>>; | ||
/** | ||
* @see https://vk.com/dev/database.getCities | ||
* @type {TRepositoryMethod<IGetCitiesParams, TGetCitiesResult>} | ||
*/ | ||
*/ | ||
getCities: import("../../types").TRepositoryMethod<IGetCitiesParams, TGetCitiesResult>; | ||
/** | ||
* @see https://vk.com/dev/database.getCitiesById | ||
* @type {TRepositoryMethod<IGetCitiesByIdParams, TGetCitiesByIdResult>} | ||
*/ | ||
*/ | ||
getCitiesById: import("../../types").TRepositoryMethod<IGetCitiesByIdParams, TGetCitiesByIdResult>; | ||
/** | ||
* @see https://vk.com/dev/database.getCountries | ||
* @type {TRepositoryMethod<IGetCountriesParams, TGetCountriesResult>} | ||
*/ | ||
*/ | ||
getCountries: import("../../types").TRepositoryMethod<IGetCountriesParams, import("../../types").IPager<import("../../types").IIdTitlePair>>; | ||
/** | ||
* @see https://vk.com/dev/database.getCountriesById | ||
* @type {TRepositoryMethod<IGetCountriesByIdParams, TGetCountriesByIdResult>} | ||
*/ | ||
*/ | ||
getCountriesById: import("../../types").TRepositoryMethod<IGetCountriesByIdParams, TGetCountriesByIdResult>; | ||
/** | ||
* @see https://vk.com/dev/database.getFaculties | ||
* @type {TRepositoryMethod<IGetFacultiesParams, TGetFacultiesResult>} | ||
*/ | ||
*/ | ||
getFaculties: import("../../types").TRepositoryMethod<IGetFacultiesParams, import("../../types").IPager<import("../../types").IIdTitlePair>>; | ||
/** | ||
* @see https://vk.com/dev/database.getMetroStations | ||
* @type {TRepositoryMethod<IGetCountriesParams, TGetCountriesResult>} | ||
*/ | ||
*/ | ||
getMetroStations: import("../../types").TRepositoryMethod<IGetMetroStationsParams, TGetMetroStationsResult>; | ||
/** | ||
* @see https://vk.com/dev/database.getMetroStationsById | ||
* @type {TRepositoryMethod<IGetMetroStationsByIdParams, TGetMetroStationsByIdResult>} | ||
*/ | ||
*/ | ||
getMetroStationsById: import("../../types").TRepositoryMethod<IGetMetroStationsByIdParams, TGetMetroStationsByIdResult>; | ||
/** | ||
* @see https://vk.com/dev/database.getRegions | ||
* @type {TRepositoryMethod<IGetRegionsParams, TGetRegionsResult>} | ||
*/ | ||
*/ | ||
getRegions: import("../../types").TRepositoryMethod<IGetRegionsParams, import("../../types").IPager<import("../../types").IIdTitlePair>>; | ||
/** | ||
* @see https://vk.com/dev/database.getSchoolClasses | ||
* @type {TRepositoryMethod<IGetSchoolClassesParams, TGetSchoolClassesResult>} | ||
*/ | ||
*/ | ||
getSchoolClasses: import("../../types").TRepositoryMethod<IGetSchoolClassesParams, TGetSchoolClassesResult>; | ||
/** | ||
* @see https://vk.com/dev/database.getSchools | ||
* @type {TRepositoryMethod<IGetSchoolsParams, TGetSchoolsResult>} | ||
*/ | ||
*/ | ||
getSchools: import("../../types").TRepositoryMethod<IGetSchoolsParams, import("../../types").IPager<import("../../types").IIdTitlePair>>; | ||
/** | ||
* @see https://vk.com/dev/database.getUniversities | ||
* @type {TRepositoryMethod<IGetUniversitiesParams, TGetUniversitiesResult>} | ||
*/ | ||
*/ | ||
getUniversities: import("../../types").TRepositoryMethod<IGetUniversitiesParams, import("../../types").IPager<import("../../types").IIdTitlePair>>; | ||
} |
@@ -1,1 +0,1 @@ | ||
"use strict";var __extends=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function s(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(s.prototype=r.prototype,new s)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var e,r=1,s=arguments.length;r<s;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},__rest=this&&this.__rest||function(t,e){var r={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(r[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(s=Object.getOwnPropertySymbols(t);o<s.length;o++)e.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(t,s[o])&&(r[s[o]]=t[s[o]])}return r};Object.defineProperty(exports,"__esModule",{value:!0}),exports.DatabaseRepository=void 0;var Repository_1=require("../Repository"),utils_1=require("../../utils"),DatabaseRepository=function(t){function e(e){var r=t.call(this,"database",e)||this;return r.getChairs=r.r("getChairs"),r.getCities=r.r("getCities",function(t){var e=t.needAll,r=__rest(t,["needAll"]);return __assign(__assign({},r),{needAll:utils_1.formatOptionalBoolean(e)})}),r.getCitiesById=r.r("getCitiesById",function(t){var e=t.cityIds,r=__rest(t,["cityIds"]);return __assign(__assign({},r),{cityIds:utils_1.formatOptionalArray(e)})}),r.getCountries=r.r("getCountries",function(t){var e=t.code,r=t.needAll,s=__rest(t,["code","needAll"]);return __assign(__assign({},s),{needAll:utils_1.formatOptionalBoolean(r),code:utils_1.formatOptionalArray(e)})}),r.getCountriesById=r.r("getCountriesById",function(t){var e=t.countryIds,r=__rest(t,["countryIds"]);return __assign(__assign({},r),{countryIds:utils_1.formatOptionalArray(e)})}),r.getFaculties=r.r("getFaculties"),r.getMetroStations=r.r("getMetroStations",function(t){var e=t.extended,r=__rest(t,["extended"]);return __assign(__assign({},r),{extended:utils_1.formatOptionalBoolean(e)})}),r.getMetroStationsById=r.r("getMetroStationsById",function(t){var e=t.stationIds,r=__rest(t,["stationIds"]);return __assign(__assign({},r),{stationIds:utils_1.formatOptionalArray(e)})}),r.getRegions=r.r("getRegions"),r.getSchoolClasses=r.r("getSchoolClasses"),r.getSchools=r.r("getSchools"),r.getUniversities=r.r("getUniversities"),r}return __extends(e,t),e}(Repository_1.Repository);exports.DatabaseRepository=DatabaseRepository; | ||
"use strict";var __extends=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function s(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(s.prototype=r.prototype,new s)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var e,r=1,s=arguments.length;r<s;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},__rest=this&&this.__rest||function(t,e){var r={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(r[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(s=Object.getOwnPropertySymbols(t);o<s.length;o++)e.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(t,s[o])&&(r[s[o]]=t[s[o]])}return r};Object.defineProperty(exports,"__esModule",{value:!0}),exports.DatabaseRepository=void 0;var Repository_1=require("../Repository"),utils_1=require("../../utils"),DatabaseRepository=function(t){function e(e){var r=t.call(this,"database",e)||this;return r.getChairs=r.r("getChairs"),r.getCities=r.r("getCities",function(t){var e=t.need_all,r=__rest(t,["need_all"]);return __assign(__assign({},r),{need_all:utils_1.formatOptionalBoolean(e)})}),r.getCitiesById=r.r("getCitiesById",function(t){var e=t.city_ids,r=__rest(t,["city_ids"]);return __assign(__assign({},r),{city_ids:utils_1.formatOptionalArray(e)})}),r.getCountries=r.r("getCountries",function(t){var e=t.code,r=t.need_all,s=__rest(t,["code","need_all"]);return __assign(__assign({},s),{need_all:utils_1.formatOptionalBoolean(r),code:utils_1.formatOptionalArray(e)})}),r.getCountriesById=r.r("getCountriesById",function(t){var e=t.country_ids,r=__rest(t,["country_ids"]);return __assign(__assign({},r),{country_ids:utils_1.formatOptionalArray(e)})}),r.getFaculties=r.r("getFaculties"),r.getMetroStations=r.r("getMetroStations",function(t){var e=t.extended,r=__rest(t,["extended"]);return __assign(__assign({},r),{extended:utils_1.formatOptionalBoolean(e)})}),r.getMetroStationsById=r.r("getMetroStationsById",function(t){var e=t.station_ids,r=__rest(t,["station_ids"]);return __assign(__assign({},r),{station_ids:utils_1.formatOptionalArray(e)})}),r.getRegions=r.r("getRegions"),r.getSchoolClasses=r.r("getSchoolClasses"),r.getSchools=r.r("getSchools"),r.getUniversities=r.r("getUniversities"),r}return __extends(e,t),e}(Repository_1.Repository);exports.DatabaseRepository=DatabaseRepository; |
@@ -10,3 +10,3 @@ import { IIdTitlePair, IPager } from '../../types'; | ||
export interface IGetChairsParams { | ||
facultyId: number; | ||
faculty_id: number; | ||
offset?: number; | ||
@@ -20,6 +20,6 @@ count?: number; | ||
export interface IGetCitiesParams { | ||
countryId: number; | ||
regionId?: number; | ||
country_id: number; | ||
region_id?: number; | ||
q?: string; | ||
needAll?: boolean; | ||
need_all?: boolean; | ||
offset?: number; | ||
@@ -37,3 +37,3 @@ count?: number; | ||
export interface IGetCitiesByIdParams { | ||
cityIds?: number[]; | ||
city_ids?: number[]; | ||
} | ||
@@ -45,3 +45,3 @@ export declare type TGetCitiesByIdResult = IIdTitlePair[]; | ||
export interface IGetCountriesParams { | ||
needAll?: boolean; | ||
need_all?: boolean; | ||
code?: string[]; | ||
@@ -56,3 +56,3 @@ offset?: number; | ||
export interface IGetCountriesByIdParams { | ||
countryIds?: number[]; | ||
country_ids?: number[]; | ||
} | ||
@@ -64,3 +64,3 @@ export declare type TGetCountriesByIdResult = IIdTitlePair[]; | ||
export interface IGetFacultiesParams { | ||
universityId: number; | ||
university_id: number; | ||
offset?: number; | ||
@@ -74,3 +74,3 @@ count?: number; | ||
export interface IGetMetroStationsParams { | ||
cityId: number; | ||
city_id: number; | ||
offset?: number; | ||
@@ -89,3 +89,3 @@ count?: number; | ||
export interface IGetMetroStationsByIdParams { | ||
stationIds?: number[]; | ||
station_ids?: number[]; | ||
} | ||
@@ -96,3 +96,3 @@ export declare type TGetMetroStationsByIdResult = Array<{ | ||
color: string; | ||
cityId: number; | ||
city_id: number; | ||
}>; | ||
@@ -103,3 +103,3 @@ /** | ||
export interface IGetRegionsParams { | ||
countryId: number; | ||
country_id: number; | ||
q?: string; | ||
@@ -114,3 +114,3 @@ offset?: number; | ||
export interface IGetSchoolClassesParams { | ||
countryId?: number; | ||
country_id?: number; | ||
} | ||
@@ -124,3 +124,3 @@ declare type TSchoolClassId = number; | ||
export interface IGetSchoolsParams { | ||
cityId: number; | ||
city_id: number; | ||
q?: string; | ||
@@ -135,4 +135,4 @@ offset?: number; | ||
export interface IGetUniversitiesParams { | ||
countryId?: number; | ||
cityId: number; | ||
country_id?: number; | ||
city_id: number; | ||
q?: string; | ||
@@ -139,0 +139,0 @@ offset?: number; |
@@ -8,3 +8,2 @@ import { Repository } from '../Repository'; | ||
* @see https://vk.com/dev/donut.getFriends | ||
* @type {(params: (IGetFriendsParams & IRequestOptionalParams)) => Promise<IGetFriendsResult>} | ||
*/ | ||
@@ -14,3 +13,2 @@ getFriends: import("../../types").TRepositoryMethod<IGetFriendsParams, IGetFriendsResult>; | ||
* @see https://vk.com/dev/donut.getSubscription | ||
* @type {(params: (IGetSubscriptionParams & IRequestOptionalParams)) => Promise<IGetSubscriptionResult>} | ||
*/ | ||
@@ -20,3 +18,2 @@ getSubscription: import("../../types").TRepositoryMethod<IGetSubscriptionParams, IGetSubscriptionResult>; | ||
* @see https://vk.com/dev/donut.getSubscriptions | ||
* @type {(params: (IGetSubscriptionsParams & IRequestOptionalParams)) => Promise<IGetSubscriptionsResult>} | ||
*/ | ||
@@ -26,5 +23,4 @@ getSubscriptions: import("../../types").TRepositoryMethod<IGetSubscriptionsParams, IGetSubscriptionsResult>; | ||
* @see https://vk.com/dev/donut.isDon | ||
* @type {(params: (IIsDonParams & IRequestOptionalParams)) => Promise<0 | 1>} | ||
*/ | ||
isDon: import("../../types").TRepositoryMethod<IIsDonParams, import("../../types").TPseudoBoolean>; | ||
} |
import { ICommunity, IPager, TPseudoBoolean, TUser, TUserField } from '../../types'; | ||
interface ISubscription { | ||
ownerId: number; | ||
nextPaymentDate: number; | ||
owner_id: number; | ||
next_payment_date: number; | ||
amount: number; | ||
@@ -12,3 +12,3 @@ status: string; | ||
export interface IGetFriendsParams { | ||
ownerId: number; | ||
owner_id: number; | ||
offset?: number; | ||
@@ -24,3 +24,3 @@ count?: number; | ||
export interface IGetSubscriptionParams { | ||
ownerId: number; | ||
owner_id: number; | ||
} | ||
@@ -47,5 +47,5 @@ export interface IGetSubscriptionResult extends ISubscription { | ||
export interface IIsDonParams { | ||
ownerId: number; | ||
owner_id: number; | ||
} | ||
export declare type TIsDonResult = TPseudoBoolean; | ||
export {}; |
@@ -8,5 +8,4 @@ import { Repository } from '../Repository'; | ||
* @see https://vk.com/dev/downloadedGames.getPaidStatus | ||
* @type {(params: (IGetPaidStatusParams & IRequestOptionalParams)) => Promise<IGetPaidStatusResult>} | ||
*/ | ||
getPaidStatus: import("../../types").TRepositoryMethod<IGetPaidStatusParams, IGetPaidStatusResult>; | ||
} |
@@ -5,6 +5,6 @@ /** | ||
export interface IGetPaidStatusParams { | ||
userId: number; | ||
user_id: number; | ||
} | ||
export interface IGetPaidStatusResult { | ||
isPaid: boolean; | ||
is_paid: boolean; | ||
} |
@@ -8,5 +8,4 @@ import { Repository } from '../Repository'; | ||
* @see https://vk.com/dev/gifts.get | ||
* @type {(params: (IGetParams & IRequestOptionalParams)) => Promise<IPager<{id: number, fromId: number, message: string, date: number, gift: {id: number, thumb256: string, thumb96: string, thumb48: string}, privacy: EGiftPrivacy, giftHash: string}>>} | ||
*/ | ||
get: import("../../types").TRepositoryMethod<IGetParams, TGetResult>; | ||
} |
@@ -11,3 +11,3 @@ import { IPager } from '../../types'; | ||
export interface IGetParams { | ||
userId?: number; | ||
user_id?: number; | ||
count?: number; | ||
@@ -18,3 +18,3 @@ offset?: number; | ||
id: number; | ||
fromId: number; | ||
from_id: number; | ||
message: string; | ||
@@ -24,8 +24,8 @@ date: number; | ||
id: number; | ||
thumb256: string; | ||
thumb96: string; | ||
thumb48: string; | ||
thumb_256: string; | ||
thumb_96: string; | ||
thumb_48: string; | ||
}; | ||
privacy: EGiftPrivacy; | ||
giftHash: string; | ||
gift_hash: string; | ||
}>; |
@@ -8,3 +8,2 @@ import { Repository } from '../Repository'; | ||
* https://vk.com/dev/likes.add | ||
* @type {(params: (IAddParams & IRequestOptionalParams)) => Promise<IAddResult>} | ||
*/ | ||
@@ -14,3 +13,2 @@ add: import("../../types").TRepositoryMethod<IAddParams, IAddResult>; | ||
* @see https://vk.com/dev/likes.delete | ||
* @type {(params: (IDeleteParams & IRequestOptionalParams)) => Promise<IDeleteResult>} | ||
*/ | ||
@@ -20,3 +18,2 @@ delete: import("../../types").TRepositoryMethod<IDeleteParams, IDeleteResult>; | ||
* @see https://vk.com/dev/likes.getList | ||
* @type {(params: (IGetListParams & IRequestOptionalParams)) => Promise<IGetListResult>} | ||
*/ | ||
@@ -26,5 +23,4 @@ getList: import("../../types").TRepositoryMethod<IGetListParams, IGetListResult>; | ||
* @see https://vk.com/dev/likes.isLiked | ||
* @type {(params: (IIsLikedParams & IRequestOptionalParams)) => Promise<IIsLikedResult>} | ||
*/ | ||
isLiked: import("../../types").TRepositoryMethod<IIsLikedParams, IIsLikedResult>; | ||
} |
@@ -1,1 +0,1 @@ | ||
"use strict";var __extends=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var e,r=1,o=arguments.length;r<o;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)},__rest=this&&this.__rest||function(t,e){var r={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(t);n<o.length;n++)e.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(t,o[n])&&(r[o[n]]=t[o[n]])}return r};Object.defineProperty(exports,"__esModule",{value:!0}),exports.LikesRepository=void 0;var Repository_1=require("../Repository"),utils_1=require("../../utils"),LikesRepository=function(t){function e(e){var r=t.call(this,"likes",e)||this;return r.add=r.r("add"),r.delete=r.r("delete"),r.getList=r.r("getList",function(t){var e=t.friendsOnly,r=t.extended,o=t.skipOwn,n=__rest(t,["friendsOnly","extended","skipOwn"]);return __assign({friendsOnly:utils_1.formatOptionalBoolean(e),extended:utils_1.formatOptionalBoolean(r),skipOwn:utils_1.formatOptionalBoolean(o)},n)}),r.isLiked=r.r("isLiked"),r}return __extends(e,t),e}(Repository_1.Repository);exports.LikesRepository=LikesRepository; | ||
"use strict";var __extends=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var e,r=1,o=arguments.length;r<o;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)},__rest=this&&this.__rest||function(t,e){var r={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(t);n<o.length;n++)e.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(t,o[n])&&(r[o[n]]=t[o[n]])}return r};Object.defineProperty(exports,"__esModule",{value:!0}),exports.LikesRepository=void 0;var Repository_1=require("../Repository"),utils_1=require("../../utils"),LikesRepository=function(t){function e(e){var r=t.call(this,"likes",e)||this;return r.add=r.r("add"),r.delete=r.r("delete"),r.getList=r.r("getList",function(t){var e=t.friends_only,r=t.extended,o=t.skip_own,n=__rest(t,["friends_only","extended","skip_own"]);return __assign({friends_only:utils_1.formatOptionalBoolean(e),extended:utils_1.formatOptionalBoolean(r),skip_own:utils_1.formatOptionalBoolean(o)},n)}),r.isLiked=r.r("isLiked"),r}return __extends(e,t),e}(Repository_1.Repository);exports.LikesRepository=LikesRepository; |
@@ -8,5 +8,5 @@ import { IPager, TPseudoBoolean } from '../../types'; | ||
type: TObjectType; | ||
ownerId?: number; | ||
itemId: number; | ||
accessKey: string; | ||
owner_id?: number; | ||
item_id: number; | ||
access_key: string; | ||
} | ||
@@ -28,11 +28,11 @@ export interface IAddResult { | ||
type: TObjectType; | ||
ownerId: number; | ||
itemId: number; | ||
pageUrl?: string; | ||
owner_id: number; | ||
item_id: number; | ||
page_url?: string; | ||
filter?: 'likes' | 'copies'; | ||
friendsOnly?: boolean; | ||
friends_only?: boolean; | ||
extended?: boolean; | ||
offset?: number; | ||
count?: number; | ||
skipOwn?: boolean; | ||
skip_own?: boolean; | ||
} | ||
@@ -45,6 +45,6 @@ export interface IGetListResult extends IPager<number> { | ||
export interface IIsLikedParams { | ||
userId?: number; | ||
user_id?: number; | ||
type: TObjectType; | ||
ownerId?: number; | ||
itemId: number; | ||
owner_id?: number; | ||
item_id: number; | ||
} | ||
@@ -51,0 +51,0 @@ export interface IIsLikedResult { |
@@ -1,1 +0,1 @@ | ||
"use strict";var __extends=this&&this.__extends||function(){var t=function(r,e){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])})(r,e)};return function(r,e){function o(){this.constructor=r}t(r,e),r.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var r,e=1,o=arguments.length;e<o;e++)for(var s in r=arguments[e])Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s]);return t}).apply(this,arguments)},__rest=this&&this.__rest||function(t,r){var e={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&r.indexOf(o)<0&&(e[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(o=Object.getOwnPropertySymbols(t);s<o.length;s++)r.indexOf(o[s])<0&&Object.prototype.propertyIsEnumerable.call(t,o[s])&&(e[o[s]]=t[o[s]])}return e};Object.defineProperty(exports,"__esModule",{value:!0}),exports.MessagesRepository=void 0;var Repository_1=require("../Repository"),utils_1=require("../../utils"),MessagesRepository=function(t){function r(r){var e=t.call(this,"messages",r)||this;return e.send=e.r("send",function(t){var r=t.randomId,e=__rest(t,["randomId"]),o=void 0===r?Math.floor(1e7*Math.random()):r;return __assign(__assign({},e),"userIds"in e?{userIds:utils_1.formatOptionalArray(e.userIds),randomId:o}:{randomId:o})}),e}return __extends(r,t),r}(Repository_1.Repository);exports.MessagesRepository=MessagesRepository; | ||
"use strict";var __extends=this&&this.__extends||function(){var t=function(r,e){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])})(r,e)};return function(r,e){function o(){this.constructor=r}t(r,e),r.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var r,e=1,o=arguments.length;e<o;e++)for(var s in r=arguments[e])Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s]);return t}).apply(this,arguments)},__rest=this&&this.__rest||function(t,r){var e={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&r.indexOf(o)<0&&(e[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(o=Object.getOwnPropertySymbols(t);s<o.length;s++)r.indexOf(o[s])<0&&Object.prototype.propertyIsEnumerable.call(t,o[s])&&(e[o[s]]=t[o[s]])}return e};Object.defineProperty(exports,"__esModule",{value:!0}),exports.MessagesRepository=void 0;var Repository_1=require("../Repository"),utils_1=require("../../utils"),MessagesRepository=function(t){function r(r){var e=t.call(this,"messages",r)||this;return e.send=e.r("send",function(t){var r=t.random_id,e=__rest(t,["random_id"]),o=void 0===r?Math.floor(1e7*Math.random()):r;return __assign(__assign({},e),"user_ids"in e?{user_ids:utils_1.formatOptionalArray(e.user_ids),randomId:o}:{randomId:o})}),e}return __extends(r,t),r}(Repository_1.Repository);exports.MessagesRepository=MessagesRepository; |
@@ -1,2 +0,2 @@ | ||
import { IButton } from '../../types/objects'; | ||
import { IButton } from '../../types'; | ||
/** | ||
@@ -6,17 +6,17 @@ * @see https://vk.com/dev/messages.send | ||
export declare type TSendResult = number | Array<{ | ||
peerId: number; | ||
messageId: number; | ||
peer_id: number; | ||
message_id: number; | ||
error?: string; | ||
}>; | ||
export declare type TSendParams = { | ||
randomId?: number; | ||
peerId?: number; | ||
random_id?: number; | ||
peer_id?: number; | ||
domain?: string; | ||
chatId?: number; | ||
chat_id?: number; | ||
lat?: number; | ||
long?: number; | ||
replyTo?: number; | ||
forwardMessages?: number[]; | ||
stickerId?: number; | ||
groupId?: number; | ||
reply_to?: number; | ||
forward_messages?: number[]; | ||
sticker_id?: number; | ||
group_id?: number; | ||
keyboard?: { | ||
@@ -31,9 +31,9 @@ buttons: IButton[][]; | ||
payload?: any; | ||
dontParseLinks?: boolean; | ||
disableMentions?: boolean; | ||
dont_parse_links?: boolean; | ||
disable_mentions?: boolean; | ||
intent?: 'promo_newsletter' | 'bot_ad_invite' | 'bot_ad_promo'; | ||
} & ({ | ||
userId?: number; | ||
user_id?: number; | ||
} | { | ||
userIds?: number[]; | ||
user_ids?: number[]; | ||
}) & ({ | ||
@@ -40,0 +40,0 @@ message: string; |
@@ -8,3 +8,2 @@ import { TSendMessageResult, ISendMessageParams, IMarkAsViewedParams } from './types'; | ||
* @see https://vk.com/dev/notifications.markAsViewed | ||
* @type {TRepositoryMethod<IMarkAsViewedParams, TMarkAsViewedResult>} | ||
*/ | ||
@@ -14,5 +13,4 @@ markAsViewed: import("../../types").TRepositoryMethod<IMarkAsViewedParams, import("../../types").TPseudoBoolean>; | ||
* @see https://vk.com/dev/notifications.sendMessage | ||
* @type {TRepositoryMethod<ISendMessageParams, TSendMessageResult>} | ||
*/ | ||
sendMessage: import("../../types").TRepositoryMethod<ISendMessageParams, TSendMessageResult>; | ||
} |
@@ -1,1 +0,1 @@ | ||
"use strict";var __extends=this&&this.__extends||function(){var t=function(r,e){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])})(r,e)};return function(r,e){function o(){this.constructor=r}t(r,e),r.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var r,e=1,o=arguments.length;e<o;e++)for(var s in r=arguments[e])Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s]);return t}).apply(this,arguments)},__rest=this&&this.__rest||function(t,r){var e={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&r.indexOf(o)<0&&(e[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(o=Object.getOwnPropertySymbols(t);s<o.length;s++)r.indexOf(o[s])<0&&Object.prototype.propertyIsEnumerable.call(t,o[s])&&(e[o[s]]=t[o[s]])}return e};Object.defineProperty(exports,"__esModule",{value:!0}),exports.NotificationsRepository=void 0;var Repository_1=require("../Repository"),utils_1=require("../../utils"),NotificationsRepository=function(t){function r(r){var e=t.call(this,"notifications",r)||this;return e.markAsViewed=e.r("markAsViewed"),e.sendMessage=e.r("sendMessage",function(t){var r=t.userIds,e=__rest(t,["userIds"]);return __assign(__assign({},e),{userIds:utils_1.formatOptionalArray(r)})}),e}return __extends(r,t),r}(Repository_1.Repository);exports.NotificationsRepository=NotificationsRepository; | ||
"use strict";var __extends=this&&this.__extends||function(){var t=function(r,e){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])})(r,e)};return function(r,e){function o(){this.constructor=r}t(r,e),r.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var r,e=1,o=arguments.length;e<o;e++)for(var i in r=arguments[e])Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i]);return t}).apply(this,arguments)},__rest=this&&this.__rest||function(t,r){var e={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&r.indexOf(o)<0&&(e[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(o=Object.getOwnPropertySymbols(t);i<o.length;i++)r.indexOf(o[i])<0&&Object.prototype.propertyIsEnumerable.call(t,o[i])&&(e[o[i]]=t[o[i]])}return e};Object.defineProperty(exports,"__esModule",{value:!0}),exports.NotificationsRepository=void 0;var Repository_1=require("../Repository"),utils_1=require("../../utils"),NotificationsRepository=function(t){function r(r){var e=t.call(this,"notifications",r)||this;return e.markAsViewed=e.r("markAsViewed"),e.sendMessage=e.r("sendMessage",function(t){var r=t.user_ids,e=__rest(t,["user_ids"]);return __assign(__assign({},e),{user_ids:utils_1.formatOptionalArray(r)})}),e}return __extends(r,t),r}(Repository_1.Repository);exports.NotificationsRepository=NotificationsRepository; |
@@ -12,7 +12,7 @@ import { TPseudoBoolean } from '../../types'; | ||
export interface ISendMessageResultOk { | ||
userId: number; | ||
user_id: number; | ||
status: true; | ||
} | ||
export interface ISendMessageResultError { | ||
userId: number; | ||
user_id: number; | ||
status: false; | ||
@@ -26,6 +26,6 @@ error: { | ||
export interface ISendMessageParams { | ||
userIds: Array<string | number>; | ||
user_ids: Array<string | number>; | ||
message: string; | ||
fragment?: string; | ||
groupId?: number; | ||
group_id?: number; | ||
} |
@@ -17,6 +17,6 @@ import { TRepositoryMethod, TSendRequest } from '../../types'; | ||
* Creates method which sends request. | ||
* @param {string} method | ||
* @param method | ||
* @param prepare | ||
* @param format | ||
* @returns {TRepositoryMethod<P, R>} | ||
* @protected | ||
*/ | ||
@@ -27,5 +27,4 @@ protected r<P, R, FR = R>(method: string, prepare?: (params: P) => any, format?: (response: R, params: P) => FR): TRepositoryMethod<P, R>; | ||
* for chaining. | ||
* @param {M extends (TRepositoryNonOverridableMethods | "implement") ? never : M} method | ||
* @param {(params: P) => any} prepare | ||
* @returns {this & {[key in M]: TRepositoryMethod<P, R>}} | ||
* @param method | ||
* @param prepare | ||
*/ | ||
@@ -32,0 +31,0 @@ implement<P, R, M extends string>(method: M extends TRepositoryNonOverridableMethods | keyof this ? never : M, prepare?: (params: P) => any): this & { |
@@ -6,16 +6,10 @@ import { Repository } from '../Repository'; | ||
constructor(sendRequest: TSendRequest); | ||
/** | ||
* @type {(params: (IAddStickersParams & IRequestOptionalParams)) => Promise<IAddStickersResult>} | ||
*/ | ||
addStickers: import("../../types").TRepositoryMethod<IAddStickersParams, import("../../types").IPager<{ | ||
stickerId: number; | ||
isPurchased: boolean; | ||
sticker_id: number; | ||
is_purchased: boolean; | ||
}>>; | ||
/** | ||
* @type {(params: (IGetStickersParams & IRequestOptionalParams)) => Promise<IPager<{stickerId: number, isPurchased: boolean}>>} | ||
*/ | ||
getStickers: import("../../types").TRepositoryMethod<IGetStickersParams, import("../../types").IPager<{ | ||
stickerId: number; | ||
isPurchased: boolean; | ||
sticker_id: number; | ||
is_purchased: boolean; | ||
}>>; | ||
} |
@@ -1,1 +0,1 @@ | ||
"use strict";var __extends=this&&this.__extends||function(){var t=function(r,e){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])})(r,e)};return function(r,e){function s(){this.constructor=r}t(r,e),r.prototype=null===e?Object.create(e):(s.prototype=e.prototype,new s)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var r,e=1,s=arguments.length;e<s;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t}).apply(this,arguments)},__rest=this&&this.__rest||function(t,r){var e={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&r.indexOf(s)<0&&(e[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(s=Object.getOwnPropertySymbols(t);o<s.length;o++)r.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(t,s[o])&&(e[s[o]]=t[s[o]])}return e};Object.defineProperty(exports,"__esModule",{value:!0}),exports.SpecialsRepository=void 0;var Repository_1=require("../Repository"),utils_1=require("../../utils"),SpecialsRepository=function(t){function r(r){var e=t.call(this,"specials",r)||this;return e.addStickers=e.r("addStickers",function(t){var r=t.userIds,e=t.stickerIds,s=__rest(t,["userIds","stickerIds"]);return __assign(__assign({},s),{userIds:utils_1.formatOptionalArray(r),stickerIds:utils_1.formatOptionalArray(e)})}),e.getStickers=e.r("getStickers"),e}return __extends(r,t),r}(Repository_1.Repository);exports.SpecialsRepository=SpecialsRepository; | ||
"use strict";var __extends=this&&this.__extends||function(){var t=function(r,e){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])})(r,e)};return function(r,e){function s(){this.constructor=r}t(r,e),r.prototype=null===e?Object.create(e):(s.prototype=e.prototype,new s)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var r,e=1,s=arguments.length;e<s;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t}).apply(this,arguments)},__rest=this&&this.__rest||function(t,r){var e={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&r.indexOf(s)<0&&(e[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(s=Object.getOwnPropertySymbols(t);o<s.length;o++)r.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(t,s[o])&&(e[s[o]]=t[s[o]])}return e};Object.defineProperty(exports,"__esModule",{value:!0}),exports.SpecialsRepository=void 0;var Repository_1=require("../Repository"),utils_1=require("../../utils"),SpecialsRepository=function(t){function r(r){var e=t.call(this,"specials",r)||this;return e.addStickers=e.r("addStickers",function(t){var r=t.user_ids,e=t.sticker_ids,s=__rest(t,["user_ids","sticker_ids"]);return __assign(__assign({},s),{user_ids:utils_1.formatOptionalArray(r),sticker_ids:utils_1.formatOptionalArray(e)})}),e.getStickers=e.r("getStickers"),e}return __extends(r,t),r}(Repository_1.Repository);exports.SpecialsRepository=SpecialsRepository; |
import { IPager } from '../../types'; | ||
declare type TStickersPager = IPager<{ | ||
stickerId: number; | ||
isPurchased: boolean; | ||
sticker_id: number; | ||
is_purchased: boolean; | ||
}>; | ||
export interface IAddStickersParams { | ||
userIds: (number | string)[]; | ||
packId: number; | ||
user_ids: (number | string)[]; | ||
pack_id: number; | ||
text: string; | ||
stickerIds?: number[]; | ||
sticker_ids?: number[]; | ||
} | ||
export declare type TAddStickersResult = TStickersPager; | ||
export interface IGetStickersParams { | ||
userId: number | string; | ||
packId: number | string; | ||
user_id: number | string; | ||
pack_id: number | string; | ||
} | ||
export declare type TGetStickersResult = TStickersPager; | ||
export {}; |
@@ -8,3 +8,2 @@ import { Repository } from '../Repository'; | ||
* @see https://vk.com/dev/statEvents.addMiniAppsCustom | ||
* @type {TRepositoryMethod<TAddMiniAppsCustomParams, TAddMiniAppsCustomResult>} | ||
*/ | ||
@@ -14,5 +13,4 @@ addMiniAppsCustom: import("../../types").TRepositoryMethod<TAddMiniAppsCustomParams, 1>; | ||
* @see https://vk.com/dev/statEvents.addMiniApps | ||
* @type {TRepositoryMethod<IAddMiniAppsParams, TAddMiniAppsCustomResult>} | ||
*/ | ||
addMiniApps: import("../../types").TRepositoryMethod<IAddMiniAppsParams, 1>; | ||
} |
@@ -7,19 +7,19 @@ /** | ||
event: string; | ||
userId: number; | ||
user_id: number; | ||
timezone?: string; | ||
miniAppId: number; | ||
mini_app_id: number; | ||
url: string; | ||
vkPlatform: string; | ||
vk_platform: string; | ||
json?: Record<any, any>; | ||
timestamp?: Date | number; | ||
} & ({ | ||
typeNavgo: { | ||
type_navgo: { | ||
type: 'type_mini_app_custom_event_item'; | ||
}; | ||
} | { | ||
typeView: { | ||
type_view: { | ||
type: 'type_mini_app_custom_event_item'; | ||
}; | ||
} | { | ||
typeClick: { | ||
type_click: { | ||
type: 'type_mini_app_custom_event_item'; | ||
@@ -26,0 +26,0 @@ }; |
@@ -8,3 +8,2 @@ import { Repository } from '../Repository'; | ||
* @see https://vk.com/dev/stats.get | ||
* @type {TRepositoryMethod<TGetParams, TGetResult>} | ||
*/ | ||
@@ -14,3 +13,2 @@ get: import("../../types").TRepositoryMethod<TGetParams, TGetResult>; | ||
* @see https://vk.com/dev/stats.getPostReach | ||
* @type {TRepositoryMethod<IGetPostReachParams, IGetPostReachResult>} | ||
*/ | ||
@@ -20,5 +18,4 @@ getPostReach: import("../../types").TRepositoryMethod<IGetPostReachParams, IGetPostReachResult>; | ||
* @see https://vk.com/dev/stats.trackVisitor | ||
* @type {TRepositoryMethod<ITrackVisitorParams, TTrackVisitorResult>} | ||
*/ | ||
trackVisitor: import("../../types").TRepositoryMethod<ITrackVisitorParams, 1>; | ||
} |
@@ -1,1 +0,1 @@ | ||
"use strict";var __extends=this&&this.__extends||function(){var t=function(r,e){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])})(r,e)};return function(r,e){function o(){this.constructor=r}t(r,e),r.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var r,e=1,o=arguments.length;e<o;e++)for(var s in r=arguments[e])Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s]);return t}).apply(this,arguments)},__rest=this&&this.__rest||function(t,r){var e={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&r.indexOf(o)<0&&(e[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(o=Object.getOwnPropertySymbols(t);s<o.length;s++)r.indexOf(o[s])<0&&Object.prototype.propertyIsEnumerable.call(t,o[s])&&(e[o[s]]=t[o[s]])}return e};Object.defineProperty(exports,"__esModule",{value:!0}),exports.StatsRepository=void 0;var Repository_1=require("../Repository"),utils_1=require("../../utils"),StatsRepository=function(t){function r(r){var e=t.call(this,"stats",r)||this;return e.get=e.r("get",function(t){var r=t.extended,e=t.filters,o=__rest(t,["extended","filters"]);return __assign(__assign({},o),{extended:utils_1.formatOptionalBoolean(r),filters:utils_1.formatOptionalArray(e)})}),e.getPostReach=e.r("getPostReach",function(t){var r=t.postIds,e=__rest(t,["postIds"]);return __assign(__assign({},e),{postIds:utils_1.formatOptionalArray(r)})}),e.trackVisitor=e.r("trackVisitor"),e}return __extends(r,t),r}(Repository_1.Repository);exports.StatsRepository=StatsRepository; | ||
"use strict";var __extends=this&&this.__extends||function(){var t=function(r,e){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])})(r,e)};return function(r,e){function o(){this.constructor=r}t(r,e),r.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var r,e=1,o=arguments.length;e<o;e++)for(var s in r=arguments[e])Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s]);return t}).apply(this,arguments)},__rest=this&&this.__rest||function(t,r){var e={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&r.indexOf(o)<0&&(e[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(o=Object.getOwnPropertySymbols(t);s<o.length;s++)r.indexOf(o[s])<0&&Object.prototype.propertyIsEnumerable.call(t,o[s])&&(e[o[s]]=t[o[s]])}return e};Object.defineProperty(exports,"__esModule",{value:!0}),exports.StatsRepository=void 0;var Repository_1=require("../Repository"),utils_1=require("../../utils"),StatsRepository=function(t){function r(r){var e=t.call(this,"stats",r)||this;return e.get=e.r("get",function(t){var r=t.extended,e=t.filters,o=__rest(t,["extended","filters"]);return __assign(__assign({},o),{extended:utils_1.formatOptionalBoolean(r),filters:utils_1.formatOptionalArray(e)})}),e.getPostReach=e.r("getPostReach",function(t){var r=t.post_ids,e=__rest(t,["post_ids"]);return __assign(__assign({},e),{post_ids:utils_1.formatOptionalArray(r)})}),e.trackVisitor=e.r("trackVisitor"),e}return __extends(r,t),r}(Repository_1.Repository);exports.StatsRepository=StatsRepository; |
@@ -5,17 +5,17 @@ /** | ||
export declare type TGetParams = { | ||
timestampFrom?: number; | ||
timestampTo?: number; | ||
timestamp_from?: number; | ||
timestamp_to?: number; | ||
interval?: 'day' | 'week' | 'month' | 'year' | 'all'; | ||
intervalsCount?: number; | ||
intervals_count?: number; | ||
filters?: string[]; | ||
statsGroups?: 'visitors' | 'reach' | 'activity'; | ||
stats_groups?: 'visitors' | 'reach' | 'activity'; | ||
extended?: boolean; | ||
} & ({ | ||
groupId: number; | ||
group_id: number; | ||
} | { | ||
appId: number; | ||
app_id: number; | ||
}); | ||
export declare type TGetResult = Array<{ | ||
periodFrom: string; | ||
periodTo: string; | ||
period_from: string; | ||
period_to: string; | ||
reach: { | ||
@@ -37,5 +37,5 @@ age: Array<{ | ||
}>; | ||
mobileReach: number; | ||
mobile_reach: number; | ||
reach: number; | ||
reachSubscribers: number; | ||
reach_subscribers: number; | ||
sex: Array<{ | ||
@@ -45,3 +45,3 @@ value: 'm' | 'f'; | ||
}>; | ||
sexAge: Array<{ | ||
sex_age: Array<{ | ||
value: string; | ||
@@ -55,3 +55,3 @@ count: number; | ||
views: number; | ||
mobileViews: number; | ||
mobile_views: number; | ||
visitors: number; | ||
@@ -64,13 +64,13 @@ }; | ||
export interface IGetPostReachParams { | ||
ownerId: number; | ||
postIds: number[]; | ||
owner_id: number; | ||
post_ids: number[]; | ||
} | ||
export interface IGetPostReachResult { | ||
reachSubscribers: number; | ||
reachTotal: number; | ||
reachAds: number; | ||
reachViral: number; | ||
reach_subscribers: number; | ||
reach_total: number; | ||
reach_ads: number; | ||
reach_viral: number; | ||
links: number; | ||
toGroup: number; | ||
joinGroup: number; | ||
to_group: number; | ||
join_group: number; | ||
report: number; | ||
@@ -77,0 +77,0 @@ hide: number; |
@@ -8,3 +8,2 @@ import { Repository } from '../Repository'; | ||
* @see https://vk.com/dev/status.get | ||
* @type {(params: (({userId: number} & IRequestOptionalParams) | ({groupId: number} & IRequestOptionalParams))) => Promise<IGetResult>} | ||
*/ | ||
@@ -14,5 +13,4 @@ get: import("../../types").TRepositoryMethod<TGetParams, IGetResult>; | ||
* @see https://vk.com/dev/status.set | ||
* @type {(params: (ISetParams & IRequestOptionalParams)) => Promise<1>} | ||
*/ | ||
set: import("../../types").TRepositoryMethod<ISetParams, 1>; | ||
} |
@@ -1,2 +0,2 @@ | ||
import { IAudio } from '../../types/objects'; | ||
import { IAudio } from '../../types'; | ||
/** | ||
@@ -6,5 +6,5 @@ * @see https://vk.com/dev/status.get | ||
export declare type TGetParams = { | ||
userId: number; | ||
user_id: number; | ||
} | { | ||
groupId: number; | ||
group_id: number; | ||
}; | ||
@@ -20,4 +20,4 @@ export interface IGetResult { | ||
text: string; | ||
groupId?: number; | ||
group_id?: number; | ||
} | ||
export declare type TSetResult = 1; |
@@ -8,3 +8,2 @@ import { Repository } from '../Repository'; | ||
* @see https://vk.com/dev/storage.get | ||
* @type {<P extends IGetSingleKeyParams | IGetMultipleKeysParams>(params: P) => Promise<P extends IGetSingleKeyParams ? TGetSingleKeyResult : TGetMultipleKeysResult>} | ||
*/ | ||
@@ -14,3 +13,2 @@ get: import("../../types").TRepositoryMethod<TGetParams, TGetResult>; | ||
* @see https://vk.com/dev/storage.getKeys | ||
* @type {(params: (IGetKeysParams & IRequestOptionalParams)) => Promise<string[]>} | ||
*/ | ||
@@ -20,5 +18,4 @@ getKeys: import("../../types").TRepositoryMethod<IGetKeysParams, TGetKeysResult>; | ||
* @see https://vk.com/dev/storage.set | ||
* @type {(params: (ISetParams & IRequestOptionalParams)) => Promise<1>} | ||
*/ | ||
set: import("../../types").TRepositoryMethod<ISetParams, 1>; | ||
} |
@@ -5,3 +5,3 @@ /** | ||
interface IGetSharedParams { | ||
userId?: number; | ||
user_id?: number; | ||
} | ||
@@ -23,3 +23,3 @@ export interface IGetSingleKeyParams extends IGetSharedParams { | ||
export interface IGetKeysParams { | ||
userId?: number; | ||
user_id?: number; | ||
offset?: number; | ||
@@ -33,3 +33,3 @@ count?: number; | ||
export interface ISetParams { | ||
userId?: number; | ||
user_id?: number; | ||
key: string; | ||
@@ -36,0 +36,0 @@ value: string; |
@@ -8,3 +8,2 @@ import { Repository } from '../Repository'; | ||
* @see https://vk.com/dev/streaming.getServerUrl | ||
* @type {TRepositoryMethod<IGetServerUrlParams, IGetServerUrlResult>} | ||
*/ | ||
@@ -14,3 +13,2 @@ getServerUrl: import("../../types").TRepositoryMethod<IGetServerUrlParams, IGetServerUrlResult>; | ||
* @see https://vk.com/dev/streaming.getSettings | ||
* @type {TRepositoryMethod<IGetSettingsParams, IGetSettingsResult>} | ||
*/ | ||
@@ -20,3 +18,2 @@ getSettings: import("../../types").TRepositoryMethod<IGetSettingsParams, IGetSettingsResult>; | ||
* @see https://vk.com/dev/streaming.getStats | ||
* @type {TRepositoryMethod<IGetStatsParams, IGetStatsResult>} | ||
*/ | ||
@@ -26,3 +23,2 @@ getStats: import("../../types").TRepositoryMethod<IGetStatsParams, IGetStatsResult>; | ||
* @see https://vk.com/dev/streaming.getStem | ||
* @type {TRepositoryMethod<IGetStemParams, IGetStemResult>} | ||
*/ | ||
@@ -32,5 +28,4 @@ getStem: import("../../types").TRepositoryMethod<IGetStemParams, IGetStemResult>; | ||
* @see https://vk.com/dev/streaming.setSettings | ||
* @type {TRepositoryMethod<ISetSettingsParams, TSetSettingsResult>} | ||
*/ | ||
setSettings: import("../../types").TRepositoryMethod<ISetSettingsParams, 1>; | ||
} |
@@ -17,3 +17,3 @@ export declare type TMonthlyTier = 'unlimited' | 'tier_1' | 'tier_2' | 'tier_3' | 'tier_4' | 'tier_5' | 'tier_6'; | ||
export interface IGetSettingsResult { | ||
monthlyLimit: TMonthlyTier; | ||
monthly_limit: TMonthlyTier; | ||
} | ||
@@ -26,7 +26,7 @@ /** | ||
interval?: '5m' | '1h' | '24h'; | ||
startTime?: number; | ||
endTime?: number; | ||
start_time?: number; | ||
end_time?: number; | ||
} | ||
export interface IGetStatsResult { | ||
eventType: 'post' | 'comment' | 'share'; | ||
event_type: 'post' | 'comment' | 'share'; | ||
stats: Array<{ | ||
@@ -50,4 +50,4 @@ timestamp: number; | ||
export interface ISetSettingsParams { | ||
monthlyTier: TMonthlyTier; | ||
monthly_tier: TMonthlyTier; | ||
} | ||
export declare type TSetSettingsResult = 1; |
@@ -6,5 +6,5 @@ import { TBoolean, IPager, ERelationsStatus, ESex, TUser, TUserField, TNameCase } from '../../types'; | ||
export interface TGetParams { | ||
userIds: Array<string | number>; | ||
user_ids: Array<string | number>; | ||
fields?: TUserField[]; | ||
nameCase?: TNameCase; | ||
name_case?: TNameCase; | ||
} | ||
@@ -16,7 +16,7 @@ export declare type TGetResult = TUser[]; | ||
export interface IGetFollowersParams { | ||
userId?: number; | ||
user_id?: number; | ||
offset?: number; | ||
count?: number; | ||
fields?: TUserField[]; | ||
nameCase?: TNameCase; | ||
name_case?: TNameCase; | ||
} | ||
@@ -28,3 +28,3 @@ export declare type TGetFollowersResult = IPager<TUser>; | ||
export interface IGetSubscriptionsParams { | ||
userId?: number; | ||
user_id?: number; | ||
extended?: TBoolean; | ||
@@ -40,3 +40,3 @@ offset?: number; | ||
export interface IReportParams { | ||
userId: number; | ||
user_id: number; | ||
type: 'porn' | 'spam' | 'insult' | 'advertisеment'; | ||
@@ -59,25 +59,25 @@ comment: string; | ||
hometown?: string; | ||
universityCountry?: number; | ||
university_country?: number; | ||
university?: number; | ||
universityFaculty?: number; | ||
universityChair?: number; | ||
university_faculty?: number; | ||
university_chair?: number; | ||
sex?: ESex; | ||
status?: ERelationsStatus; | ||
ageFrom?: number; | ||
ageTo?: number; | ||
birthDay?: number; | ||
birthMonth?: number; | ||
birthYear?: number; | ||
age_from?: number; | ||
age_to?: number; | ||
birth_day?: number; | ||
birth_month?: number; | ||
birth_year?: number; | ||
online?: TBoolean; | ||
hasPhoto?: TBoolean; | ||
schoolCountry?: number; | ||
schoolCity?: number; | ||
schoolClass?: number; | ||
has_photo?: TBoolean; | ||
school_country?: number; | ||
school_city?: number; | ||
school_class?: number; | ||
school?: number; | ||
schoolYear?: number; | ||
school_year?: number; | ||
religion?: string; | ||
company?: string; | ||
position?: string; | ||
groupId?: number; | ||
fromList?: Array<'friends' | 'subscriptions'>; | ||
group_id?: number; | ||
from_list?: Array<'friends' | 'subscriptions'>; | ||
} | ||
@@ -84,0 +84,0 @@ export declare type TSearchResult = IPager<TUser & { |
@@ -22,3 +22,6 @@ import { Repository } from '../Repository'; | ||
report: import("../../types").TRepositoryMethod<IReportParams, 1>; | ||
/** | ||
* @see https://vk.com/dev/users.search | ||
*/ | ||
search: import("../../types").TRepositoryMethod<ISearchParams, TSearchResult>; | ||
} |
@@ -1,1 +0,1 @@ | ||
"use strict";var __extends=this&&this.__extends||function(){var t=function(r,e){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])})(r,e)};return function(r,e){function o(){this.constructor=r}t(r,e),r.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var r,e=1,o=arguments.length;e<o;e++)for(var s in r=arguments[e])Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s]);return t}).apply(this,arguments)},__rest=this&&this.__rest||function(t,r){var e={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&r.indexOf(o)<0&&(e[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(o=Object.getOwnPropertySymbols(t);s<o.length;s++)r.indexOf(o[s])<0&&Object.prototype.propertyIsEnumerable.call(t,o[s])&&(e[o[s]]=t[o[s]])}return e};Object.defineProperty(exports,"__esModule",{value:!0}),exports.UsersRepository=void 0;var Repository_1=require("../Repository"),utils_1=require("../../utils"),UsersRepository=function(t){function r(r){var e=t.call(this,"users",r)||this;return e.get=e.r("get",function(t){var r=t.userIds,e=t.fields,o=__rest(t,["userIds","fields"]);return __assign(__assign({},o),{userIds:utils_1.formatOptionalArray(r),fields:utils_1.formatOptionalArray(e)})}),e.getFollowers=e.r("getFollowers",function(t){var r=t.fields,e=__rest(t,["fields"]);return __assign(__assign({},e),{fields:utils_1.formatOptionalArray(r)})}),e.getSubscriptions=e.r("getSubscriptions",function(t){var r=t.fields,e=t.extended,o=__rest(t,["fields","extended"]);return __assign(__assign({},o),{extended:utils_1.formatOptionalBoolean(e),fields:utils_1.formatOptionalArray(r)})}),e.report=e.r("getSubscriptions"),e.search=e.r("search",function(t){var r=t.sort,e=t.online,o=t.hasPhoto,s=__rest(t,["sort","online","hasPhoto"]);return __assign({sort:void 0===r?void 0:"number"==typeof r?r:utils_1.toPseudoBoolean("popularity"===r),online:utils_1.formatOptionalBoolean(e),hasPhoto:utils_1.formatOptionalBoolean(o)},s)}),e}return __extends(r,t),r}(Repository_1.Repository);exports.UsersRepository=UsersRepository; | ||
"use strict";var __extends=this&&this.__extends||function(){var t=function(r,e){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])})(r,e)};return function(r,e){function o(){this.constructor=r}t(r,e),r.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var r,e=1,o=arguments.length;e<o;e++)for(var s in r=arguments[e])Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s]);return t}).apply(this,arguments)},__rest=this&&this.__rest||function(t,r){var e={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&r.indexOf(o)<0&&(e[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(o=Object.getOwnPropertySymbols(t);s<o.length;s++)r.indexOf(o[s])<0&&Object.prototype.propertyIsEnumerable.call(t,o[s])&&(e[o[s]]=t[o[s]])}return e};Object.defineProperty(exports,"__esModule",{value:!0}),exports.UsersRepository=void 0;var Repository_1=require("../Repository"),utils_1=require("../../utils"),UsersRepository=function(t){function r(r){var e=t.call(this,"users",r)||this;return e.get=e.r("get",function(t){var r=t.user_ids,e=t.fields,o=__rest(t,["user_ids","fields"]);return __assign(__assign({},o),{user_ids:utils_1.formatOptionalArray(r),fields:utils_1.formatOptionalArray(e)})}),e.getFollowers=e.r("getFollowers",function(t){var r=t.fields,e=__rest(t,["fields"]);return __assign(__assign({},e),{fields:utils_1.formatOptionalArray(r)})}),e.getSubscriptions=e.r("getSubscriptions",function(t){var r=t.fields,e=t.extended,o=__rest(t,["fields","extended"]);return __assign(__assign({},o),{extended:utils_1.formatOptionalBoolean(e),fields:utils_1.formatOptionalArray(r)})}),e.report=e.r("getSubscriptions"),e.search=e.r("search",function(t){var r=t.sort,e=t.online,o=t.has_photo,s=__rest(t,["sort","online","has_photo"]);return __assign({sort:void 0===r?void 0:"number"==typeof r?r:utils_1.toPseudoBoolean("popularity"===r),online:utils_1.formatOptionalBoolean(e),has_photo:utils_1.formatOptionalBoolean(o)},s)}),e}return __extends(r,t),r}(Repository_1.Repository);exports.UsersRepository=UsersRepository; |
@@ -29,6 +29,6 @@ import { IPager, TPseudoBoolean } from '../../types'; | ||
url: string; | ||
shortUrl: string; | ||
short_url: string; | ||
key: string; | ||
views: number; | ||
accessKey?: string; | ||
access_key?: string; | ||
}>; | ||
@@ -41,5 +41,5 @@ /** | ||
source?: string; | ||
accessKey?: string; | ||
access_key?: string; | ||
interval?: 'hour' | 'day' | 'week' | 'month' | 'forever'; | ||
intervalsCount?: number; | ||
intervals_count?: number; | ||
extended?: boolean; | ||
@@ -52,4 +52,4 @@ } | ||
views: number; | ||
sexAge: Array<{ | ||
ageRange: string; | ||
sex_age: Array<{ | ||
age_range: string; | ||
female: TPseudoBoolean; | ||
@@ -59,7 +59,7 @@ male: TPseudoBoolean; | ||
countries: Array<{ | ||
countryId: number; | ||
country_id: number; | ||
views: number; | ||
}>; | ||
cities: Array<{ | ||
cityId: number; | ||
city_id: number; | ||
views: number; | ||
@@ -83,6 +83,6 @@ }>; | ||
export interface IGetShortLinkResult { | ||
shortUrl: string; | ||
short_url: string; | ||
url: string; | ||
key: string; | ||
accessKey?: string; | ||
access_key?: string; | ||
} | ||
@@ -93,7 +93,7 @@ /** | ||
export interface IResolveScreenNameParams { | ||
screenName: string; | ||
screen_name: string; | ||
} | ||
export declare type TResolveScreenNameResult = { | ||
type: 'user' | 'group' | 'application'; | ||
objectId: number; | ||
object_id: number; | ||
} | {}; |
@@ -8,3 +8,2 @@ import { Repository } from '../Repository'; | ||
* @see https://vk.com/dev/utils.checkLink | ||
* @type {TRepositoryMethod<ICheckLinkParams, ICheckLinkResult>} | ||
*/ | ||
@@ -14,3 +13,2 @@ checkLink: import("../../types").TRepositoryMethod<ICheckLinkParams, ICheckLinkResult>; | ||
* @see https://vk.com/dev/utils.deleteFromLastShortened | ||
* @type {TRepositoryMethod<IDeleteFromLastShortenedParams, TDeleteFromLastShortenedResult>} | ||
*/ | ||
@@ -20,3 +18,2 @@ deleteFromLastShortened: import("../../types").TRepositoryMethod<IDeleteFromLastShortenedParams, 1>; | ||
* @see https://vk.com/dev/utils.getLastShortenedLinks | ||
* @type {TRepositoryMethod<IGetLastShortenedLinksParams, TGetLastShortenedLinksResult>} | ||
*/ | ||
@@ -26,3 +23,2 @@ getLastShortenedLinks: import("../../types").TRepositoryMethod<IGetLastShortenedLinksParams, TGetLastShortenedLinksResult>; | ||
* @see https://vk.com/dev/utils.getLinkStats | ||
* @type {TRepositoryMethod<IGetLinkStatsParams, TGetLastShortenedLinksResult>} | ||
*/ | ||
@@ -32,3 +28,2 @@ getLinkStats: import("../../types").TRepositoryMethod<IGetLinkStatsParams, IGetLinkStatsResult>; | ||
* @see https://vk.com/dev/utils.getServerTime | ||
* @type {TRepositoryMethod<IGetServerTimeParams, TGetServerTimeResult>} | ||
*/ | ||
@@ -38,3 +33,2 @@ getServerTime: import("../../types").TRepositoryMethod<IGetServerTimeParams, number>; | ||
* @see https://vk.com/dev/utils.getShortLink | ||
* @type {TRepositoryMethod<IGetShortLinkParams, IGetShortLinkResult>} | ||
*/ | ||
@@ -44,5 +38,4 @@ getShortLink: import("../../types").TRepositoryMethod<IGetShortLinkParams, IGetShortLinkResult>; | ||
* @see https://vk.com/dev/utils.resolveScreenName | ||
* @type {TRepositoryMethod<IResolveScreenNameParams, TResolveScreenNameResult>} | ||
*/ | ||
resolveScreenName: import("../../types").TRepositoryMethod<IResolveScreenNameParams, TResolveScreenNameResult>; | ||
} |
@@ -6,5 +6,5 @@ import { IPost } from '../../types'; | ||
export interface IGetCommentsParams { | ||
widgetApiId?: number; | ||
widget_api_id?: number; | ||
url: string; | ||
pageId?: string; | ||
page_id?: string; | ||
order?: 'date' | 'likes' | 'last_comment'; | ||
@@ -23,3 +23,3 @@ fields?: string[]; | ||
export interface IGetPagesParams { | ||
widgetApiId?: number; | ||
widget_api_id?: number; | ||
order?: 'date' | 'comments' | 'likes' | 'friend_likes'; | ||
@@ -44,4 +44,4 @@ period?: 'day' | 'week' | 'month' | 'alltime'; | ||
date: number; | ||
pageId: string; | ||
page_id: string; | ||
}>; | ||
} |
@@ -8,3 +8,2 @@ import { Repository } from '../Repository'; | ||
* @see https://vk.com/dev/widgets.getComments | ||
* @type {TRepositoryMethod<IGetCommentsParams, IGetCommentsResult>} | ||
*/ | ||
@@ -14,5 +13,4 @@ getComments: import("../../types").TRepositoryMethod<IGetCommentsParams, IGetCommentsResult>; | ||
* @see https://vk.com/dev/widgets.getPages | ||
* @type {TRepositoryMethod<IGetPagesParams, IGetPagesResult>} | ||
*/ | ||
getPages: import("../../types").TRepositoryMethod<IGetPagesParams, IGetPagesResult>; | ||
} |
import { AuthRepository, DatabaseRepository, DonutRepository, GiftsRepository, LikesRepository, StorageRepository, SpecialsRepository, MessagesRepository, NotificationsRepository, StatEventsRepository, StatsRepository, StreamingRepository, UsersRepository, UtilsRepository, WidgetsRepository, DownloadedGamesRepository, AccountRepository, StatusRepository, Repository } from '../repositories'; | ||
/** | ||
* Any record. | ||
*/ | ||
export declare type TAnyRecord = Record<string, unknown>; | ||
/** | ||
* Enum of available languages. | ||
@@ -61,3 +65,3 @@ */ | ||
*/ | ||
accessToken?: string; | ||
access_token?: string; | ||
/** | ||
@@ -64,0 +68,0 @@ * Language. |
@@ -1,17 +0,3 @@ | ||
import { TBoolean, TPseudoBoolean } from './types'; | ||
import { TAnyRecord, TBoolean, TPseudoBoolean } from './types'; | ||
/** | ||
* Converts text to snake case. | ||
* @param {string} text | ||
* @returns {string} | ||
*/ | ||
export declare function toSnakeCase(text: string): string; | ||
export declare const recursiveToSnakeCase: (value: any) => any; | ||
/** | ||
* Converts text to camel case. | ||
* @param {string} text | ||
* @returns {string} | ||
*/ | ||
export declare function toCamelCase(text: string): string; | ||
export declare const recursiveToCamelCase: (value: any) => any; | ||
/** | ||
* Converts boolean to pseudo boolean type. | ||
@@ -39,2 +25,2 @@ * @param {boolean} value | ||
*/ | ||
export declare function isNonNullObject(value: any): value is Record<string, unknown>; | ||
export declare function isRecord(value: any): value is TAnyRecord; |
@@ -1,1 +0,1 @@ | ||
"use strict";function createRecursiveKeysFormatter(e){var o=function(t){return null===t?null:Array.isArray(t)?t.map(o):"object"==typeof t?Object.keys(t).reduce(function(r,a){return r[e(a)]=o(t[a]),r},{}):t};return o}function toSnakeCase(e){return e.replace(/[A-Z]/g,function(e){return"_"+e.toLowerCase()})}function toCamelCase(e){return e.replace(/_./g,function(e){return e.slice(1).toUpperCase()})}function toPseudoBoolean(e){return e?1:0}function formatOptionalBoolean(e){return void 0===e?void 0:"boolean"==typeof e?toPseudoBoolean(e):e}function formatOptionalArray(e){return void 0===e?e:e.join(",")}function isNonNullObject(e){return"object"==typeof e&&null!==e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.isNonNullObject=exports.formatOptionalArray=exports.formatOptionalBoolean=exports.toPseudoBoolean=exports.recursiveToCamelCase=exports.toCamelCase=exports.recursiveToSnakeCase=exports.toSnakeCase=void 0,exports.toSnakeCase=toSnakeCase,exports.recursiveToSnakeCase=createRecursiveKeysFormatter(toSnakeCase),exports.toCamelCase=toCamelCase,exports.recursiveToCamelCase=createRecursiveKeysFormatter(toCamelCase),exports.toPseudoBoolean=toPseudoBoolean,exports.formatOptionalBoolean=formatOptionalBoolean,exports.formatOptionalArray=formatOptionalArray,exports.isNonNullObject=isNonNullObject; | ||
"use strict";function toPseudoBoolean(o){return o?1:0}function formatOptionalBoolean(o){return void 0===o?void 0:"boolean"==typeof o?toPseudoBoolean(o):o}function formatOptionalArray(o){return void 0===o?o:o.join(",")}function isRecord(o){return"object"==typeof o&&null!==o}Object.defineProperty(exports,"__esModule",{value:!0}),exports.isRecord=exports.formatOptionalArray=exports.formatOptionalBoolean=exports.toPseudoBoolean=void 0,exports.toPseudoBoolean=toPseudoBoolean,exports.formatOptionalBoolean=formatOptionalBoolean,exports.formatOptionalArray=formatOptionalArray,exports.isRecord=isRecord; |
@@ -1,3 +0,3 @@ | ||
import { IRepositories, IRequestOptionalParams, TAddRepository, TSendRequest } from '../types'; | ||
export interface IVKAPIConstructorProps extends IRequestOptionalParams { | ||
import { IRepositories, TAddRepository, TLang, TSendRequest } from '../types'; | ||
export interface IVKAPIConstructorProps { | ||
/** | ||
@@ -20,2 +20,16 @@ * Requests per second instance can perform. Required to prevent block from | ||
baseUrl?: string; | ||
/** | ||
* Access token. | ||
*/ | ||
accessToken?: string; | ||
/** | ||
* Language. | ||
* @default "ru" | ||
*/ | ||
lang?: TLang; | ||
/** | ||
* API version. | ||
* @default "5.110" | ||
*/ | ||
v?: string; | ||
} | ||
@@ -22,0 +36,0 @@ export interface IVKAPI extends IRepositories { |
@@ -1,1 +0,1 @@ | ||
"use strict";var __extends=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},__awaiter=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function s(e){try{a(n.next(e))}catch(e){i(e)}}function u(e){try{a(n.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,u)}a((n=n.apply(e,t||[])).next())})},__generator=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.VKAPI=void 0;var isomorphic_fetch_1=__importDefault(require("isomorphic-fetch")),VKError_1=require("../VKError"),utils_1=require("../utils"),Core_1=require("../Core"),Queue_1=require("../Queue"),VKAPI=function(e){function t(t){void 0===t&&(t={});var r=e.call(this)||this;r.accessToken=null,r.sendRequest=function(e){return __awaiter(r,void 0,void 0,function(){var t,r,n,o,i,s,u,a,c,l;return __generator(this,function(f){switch(f.label){case 0:return t=e.method,r=e.params,n=e.format,o=void 0===n?function(e){return e}:n,i=__assign({v:this.v,accessToken:this.accessToken,lang:this.lang},r),s=utils_1.recursiveToSnakeCase(i),u=Object.entries(s).filter(function(e){return void 0!==e[1]}).map(function(e){var t=e[0],r=e[1],n="object"==typeof r?JSON.stringify(r):String(r);return encodeURIComponent(t)+"="+encodeURIComponent(n)}).join("&"),a=this.baseUrl+"/"+t,this.isBrowser?[2,new Promise(function(t,r){var n="__vkapicallback"+Math.random().toString().slice(2),s=document.createElement("script");s.src=a+"?"+u+"&callback="+n,window[n]=function(n){if(document.head.removeChild(s),null==n?void 0:n.response)return t(o(utils_1.recursiveToCamelCase(n.response),i));r(new VKError_1.VKError({errorInfo:utils_1.recursiveToCamelCase((null==n?void 0:n.error)||{}),config:e}))},document.head.appendChild(s)})]:[4,isomorphic_fetch_1.default(a,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},body:u})];case 1:if(!(c=f.sent()).ok)throw new Error("Unsuccessful response: "+c.status+". "+c.statusText);return[4,c.json()];case 2:if("response"in(l=f.sent()))return[2,o(utils_1.recursiveToCamelCase(l.response),i)];throw new VKError_1.VKError({errorInfo:utils_1.recursiveToCamelCase((null==l?void 0:l.error)||{}),config:e})}})})},r.addRequestToQueue=function(e){return __awaiter(r,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return[4,this.queue.await()];case 1:return t.sent(),[2,this.sendRequest(e)]}})})},r.addRepository=function(t,n){return e.prototype.addRepository.call(r,t,n,r.addRequestToQueue)};var n=t.rps,o=void 0===n?3:n,i=t.accessToken,s=t.v,u=void 0===s?"5.110":s,a=t.lang,c=void 0===a?"ru":a,l=t.isBrowser,f=void 0!==l&&l,p=t.baseUrl,_=void 0===p?"https://api.vk.com/method":p;return r.accessToken=i||null,r.v=u,r.lang=c,r.isBrowser=f,r.queue=new Queue_1.Queue({timeout:Math.ceil(1e3/o)}),r.baseUrl=_.endsWith("/")?_.slice(0,_.length-1):_,r.init(r.addRequestToQueue),r}return __extends(t,e),t}(Core_1.Core);exports.VKAPI=VKAPI; | ||
"use strict";var __extends=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},__awaiter=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function s(e){try{u(r.next(e))}catch(e){i(e)}}function a(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},__generator=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.VKAPI=void 0;var isomorphic_fetch_1=__importDefault(require("isomorphic-fetch")),Core_1=require("../Core"),Queue_1=require("../Queue"),utils_1=require("./utils"),VKAPI=function(e){function t(t){void 0===t&&(t={});var n=e.call(this)||this;n.accessToken=null,n.sendRequest=function(e){return __awaiter(n,void 0,void 0,function(){var t,n,r,o,i,s,a,u,c;return __generator(this,function(l){switch(l.label){case 0:return t=e.method,n=e.params,r=e.format,o=void 0===r?function(e){return e}:r,i=__assign({v:this.v,access_token:this.accessToken,lang:this.lang},n),s=Object.entries(i).filter(function(e){return void 0!==e[1]}).map(function(e){var t=e[0],n=e[1],r="object"==typeof n?JSON.stringify(n):String(n);return encodeURIComponent(t)+"="+encodeURIComponent(r)}).join("&"),a=this.baseUrl+"/"+t,this.isBrowser?[2,new Promise(function(t,n){var r="__vkapicallback"+Math.random().toString().slice(2),u=document.createElement("script");u.src=a+"?"+s+"&callback="+r,window[r]=function(r){document.head.removeChild(u);try{t(o(utils_1.validateResponse(r,e),i))}catch(e){n(e)}},document.head.appendChild(u)})]:[4,isomorphic_fetch_1.default(a,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},body:s})];case 1:if(!(u=l.sent()).ok)throw new Error("Unsuccessful response: "+u.status+". "+u.statusText);l.label=2;case 2:return l.trys.push([2,4,,5]),[4,u.json()];case 3:return c=l.sent(),[3,5];case 4:throw l.sent(),new Error("Response from server was not JSON");case 5:return[2,o(utils_1.validateResponse(c,e),i)]}})})},n.addRequestToQueue=function(e){return __awaiter(n,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return[4,this.queue.await()];case 1:return t.sent(),[2,this.sendRequest(e)]}})})},n.addRepository=function(t,r){return e.prototype.addRepository.call(n,t,r,n.addRequestToQueue)};var r=t.rps,o=void 0===r?3:r,i=t.accessToken,s=t.v,a=void 0===s?"5.110":s,u=t.lang,c=void 0===u?"ru":u,l=t.isBrowser,f=void 0!==l&&l,p=t.baseUrl,h=void 0===p?"https://api.vk.com/method":p;return n.accessToken=i||null,n.v=a,n.lang=c,n.isBrowser=f,n.queue=new Queue_1.Queue({timeout:Math.ceil(1e3/o)}),n.baseUrl=h.endsWith("/")?h.slice(0,h.length-1):h,n.init(n.addRequestToQueue),n}return __extends(t,e),t}(Core_1.Core);exports.VKAPI=VKAPI; |
@@ -74,5 +74,5 @@ /** | ||
export interface IErrorInfo { | ||
errorCode: EErrors | number; | ||
errorMsg: string; | ||
requestParams: Array<{ | ||
error_code: EErrors | number; | ||
error_msg: string; | ||
request_params: Array<{ | ||
key: string; | ||
@@ -79,0 +79,0 @@ value: string; |
import { VKError } from './VKError'; | ||
import { IErrorInfo } from './types'; | ||
/** | ||
* States if value is VKError. | ||
* States that value is VKError. | ||
* @param value | ||
@@ -8,1 +9,6 @@ * @returns {value is VKError} | ||
export declare function isVKError(value: any): value is VKError; | ||
/** | ||
* States that value is error information. | ||
* @param value | ||
*/ | ||
export declare function isErrorInfo(value: any): value is IErrorInfo; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isVKError=void 0;var VKError_1=require("./VKError");function isVKError(r){return r instanceof VKError_1.VKError}exports.isVKError=isVKError; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isErrorInfo=exports.isVKError=void 0;var VKError_1=require("./VKError"),utils_1=require("../utils");function isVKError(r){return r instanceof VKError_1.VKError}function isErrorInfo(r){return utils_1.isRecord(r)&&"number"==typeof r.error_code&&"string"==typeof r.error_msg&&Array.isArray(r.request_params)&&r.request_params.every(function(r){return utils_1.isRecord(r)&&"string"==typeof r.key&&"string"==typeof r.value})}exports.isVKError=isVKError,exports.isErrorInfo=isErrorInfo; |
@@ -1,1 +0,1 @@ | ||
"use strict";var __extends=this&&this.__extends||function(){var r=function(t,o){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,t){r.__proto__=t}||function(r,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])})(t,o)};return function(t,o){function e(){this.constructor=t}r(t,o),t.prototype=null===o?Object.create(o):(e.prototype=o.prototype,new e)}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.VKError=void 0;var ERROR_NAME="VKError",VKError=function(r){function t(o){var e=r.call(this,o.errorInfo.errorMsg)||this,n=o.errorInfo,c=o.config;return e.errorInfo=n,e.config=c,e.name=ERROR_NAME,Error.captureStackTrace&&Error.captureStackTrace(e,t),Object.setPrototypeOf(e,t.prototype),e}return __extends(t,r),t}(Error);exports.VKError=VKError; | ||
"use strict";var __extends=this&&this.__extends||function(){var r=function(t,o){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,t){r.__proto__=t}||function(r,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])})(t,o)};return function(t,o){function e(){this.constructor=t}r(t,o),t.prototype=null===o?Object.create(o):(e.prototype=o.prototype,new e)}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.VKError=void 0;var ERROR_NAME="VKError",VKError=function(r){function t(o){var e=r.call(this,o.errorInfo.error_msg)||this,n=o.errorInfo,c=o.config;return e.errorInfo=n,e.config=c,e.name=ERROR_NAME,Error.captureStackTrace&&Error.captureStackTrace(e,t),Object.setPrototypeOf(e,t.prototype),e}return __extends(t,r),t}(Error);exports.VKError=VKError; |
{ | ||
"name": "vkontakte-api", | ||
"version": "2.5.4", | ||
"version": "3.0.0", | ||
"description": "TypeScript library to make requests performing to VK API simple", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/wolframdeus/vk-api", |
@@ -0,0 +0,0 @@ [npm-badge]: https://img.shields.io/npm/v/vkontakte-api.svg |
@@ -0,0 +0,0 @@ [npm-badge]: https://img.shields.io/npm/v/vkontakte-api.svg |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
224295
221
3194
57