vrchat 1.20.2 → 2.20.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/base.ts DELETED
@@ -1,70 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- /**
4
- * VRChat API Documentation
5
- *
6
- * The version of the OpenAPI document: 1.20.2
7
- * Contact: vrchatapi.lpv0t@aries.fyi
8
- *
9
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
10
- * https://openapi-generator.tech
11
- * Do not edit the class manually.
12
- */
13
-
14
-
15
- import { Configuration } from "./configuration";
16
- // Some imports not used depending on template conditions
17
- // @ts-ignore
18
- import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
19
-
20
- export const BASE_PATH = "https://api.vrchat.cloud/api/1".replace(/\/+$/, "");
21
-
22
- /**
23
- *
24
- * @export
25
- */
26
- export const COLLECTION_FORMATS = {
27
- csv: ",",
28
- ssv: " ",
29
- tsv: "\t",
30
- pipes: "|",
31
- };
32
-
33
- /**
34
- *
35
- * @export
36
- * @interface RequestArgs
37
- */
38
- export interface RequestArgs {
39
- url: string;
40
- options: AxiosRequestConfig;
41
- }
42
-
43
- /**
44
- *
45
- * @export
46
- * @class BaseAPI
47
- */
48
- export class BaseAPI {
49
- protected configuration: Configuration | undefined;
50
-
51
- constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
52
- if (configuration) {
53
- this.configuration = configuration;
54
- this.basePath = configuration.basePath || this.basePath;
55
- }
56
- }
57
- };
58
-
59
- /**
60
- *
61
- * @export
62
- * @class RequiredError
63
- * @extends {Error}
64
- */
65
- export class RequiredError extends Error {
66
- name: "RequiredError" = "RequiredError";
67
- constructor(public field: string, msg?: string) {
68
- super(msg);
69
- }
70
- }
package/common.ts DELETED
@@ -1,147 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- /**
4
- * VRChat API Documentation
5
- *
6
- * The version of the OpenAPI document: 1.20.2
7
- * Contact: vrchatapi.lpv0t@aries.fyi
8
- *
9
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
10
- * https://openapi-generator.tech
11
- * Do not edit the class manually.
12
- */
13
-
14
-
15
- import { Configuration } from "./configuration";
16
- import { RequiredError, RequestArgs } from "./base";
17
- import { AxiosInstance, AxiosResponse } from 'axios';
18
-
19
- /**
20
- *
21
- * @export
22
- */
23
- export const DUMMY_BASE_URL = 'https://example.com'
24
-
25
- /**
26
- *
27
- * @throws {RequiredError}
28
- * @export
29
- */
30
- export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
31
- if (paramValue === null || paramValue === undefined) {
32
- throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
33
- }
34
- }
35
-
36
- /**
37
- *
38
- * @export
39
- */
40
- export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
41
- if (configuration && configuration.apiKey) {
42
- const localVarApiKeyValue = typeof configuration.apiKey === 'function'
43
- ? await configuration.apiKey(keyParamName)
44
- : await configuration.apiKey;
45
- object[keyParamName] = localVarApiKeyValue;
46
- }
47
- }
48
-
49
- /**
50
- *
51
- * @export
52
- */
53
- export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
54
- if (configuration && (configuration.username || configuration.password)) {
55
- object["auth"] = { username: configuration.username, password: configuration.password };
56
- }
57
- }
58
-
59
- /**
60
- *
61
- * @export
62
- */
63
- export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
64
- if (configuration && configuration.accessToken) {
65
- const accessToken = typeof configuration.accessToken === 'function'
66
- ? await configuration.accessToken()
67
- : await configuration.accessToken;
68
- object["Authorization"] = "Bearer " + accessToken;
69
- }
70
- }
71
-
72
- /**
73
- *
74
- * @export
75
- */
76
- export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
77
- if (configuration && configuration.accessToken) {
78
- const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
79
- ? await configuration.accessToken(name, scopes)
80
- : await configuration.accessToken;
81
- object["Authorization"] = "Bearer " + localVarAccessTokenValue;
82
- }
83
- }
84
-
85
- function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void {
86
- if (typeof parameter === "object") {
87
- if (Array.isArray(parameter)) {
88
- (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
89
- }
90
- else {
91
- Object.keys(parameter).forEach(currentKey =>
92
- setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`)
93
- );
94
- }
95
- }
96
- else {
97
- if (urlSearchParams.has(key)) {
98
- urlSearchParams.append(key, parameter);
99
- }
100
- else {
101
- urlSearchParams.set(key, parameter);
102
- }
103
- }
104
- }
105
-
106
- /**
107
- *
108
- * @export
109
- */
110
- export const setSearchParams = function (url: URL, ...objects: any[]) {
111
- const searchParams = new URLSearchParams(url.search);
112
- setFlattenedQueryParams(searchParams, objects);
113
- url.search = searchParams.toString();
114
- }
115
-
116
- /**
117
- *
118
- * @export
119
- */
120
- export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
121
- const nonString = typeof value !== 'string';
122
- const needsSerialization = nonString && configuration && configuration.isJsonMime
123
- ? configuration.isJsonMime(requestOptions.headers['Content-Type'])
124
- : nonString;
125
- return needsSerialization
126
- ? JSON.stringify(value !== undefined ? value : {})
127
- : (value || "");
128
- }
129
-
130
- /**
131
- *
132
- * @export
133
- */
134
- export const toPathString = function (url: URL) {
135
- return url.pathname + url.search + url.hash
136
- }
137
-
138
- /**
139
- *
140
- * @export
141
- */
142
- export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
143
- return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
144
- const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
145
- return axios.request<T, R>(axiosRequestArgs);
146
- };
147
- }
package/configuration.ts DELETED
@@ -1,100 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- /**
4
- * VRChat API Documentation
5
- *
6
- * The version of the OpenAPI document: 1.20.2
7
- * Contact: vrchatapi.lpv0t@aries.fyi
8
- *
9
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
10
- * https://openapi-generator.tech
11
- * Do not edit the class manually.
12
- */
13
-
14
-
15
- export interface ConfigurationParameters {
16
- apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
17
- username?: string;
18
- password?: string;
19
- accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
20
- basePath?: string;
21
- baseOptions?: any;
22
- formDataCtor?: new () => any;
23
- }
24
-
25
- export class Configuration {
26
- /**
27
- * parameter for apiKey security
28
- * @param name security name
29
- * @memberof Configuration
30
- */
31
- apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
32
- /**
33
- * parameter for basic security
34
- *
35
- * @type {string}
36
- * @memberof Configuration
37
- */
38
- username?: string;
39
- /**
40
- * parameter for basic security
41
- *
42
- * @type {string}
43
- * @memberof Configuration
44
- */
45
- password?: string;
46
- /**
47
- * parameter for oauth2 security
48
- * @param name security name
49
- * @param scopes oauth2 scope
50
- * @memberof Configuration
51
- */
52
- accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
53
- /**
54
- * override base path
55
- *
56
- * @type {string}
57
- * @memberof Configuration
58
- */
59
- basePath?: string;
60
- /**
61
- * base options for axios calls
62
- *
63
- * @type {any}
64
- * @memberof Configuration
65
- */
66
- baseOptions?: any;
67
- /**
68
- * The FormData constructor that will be used to create multipart form data
69
- * requests. You can inject this here so that execution environments that
70
- * do not support the FormData class can still run the generated client.
71
- *
72
- * @type {new () => FormData}
73
- */
74
- formDataCtor?: new () => any;
75
-
76
- constructor(param: ConfigurationParameters = {}) {
77
- this.apiKey = param.apiKey;
78
- this.username = param.username;
79
- this.password = param.password;
80
- this.accessToken = param.accessToken;
81
- this.basePath = param.basePath;
82
- this.baseOptions = param.baseOptions;
83
- this.formDataCtor = param.formDataCtor;
84
- }
85
-
86
- /**
87
- * Check if the given MIME is a JSON MIME.
88
- * JSON MIME examples:
89
- * application/json
90
- * application/json; charset=UTF8
91
- * APPLICATION/JSON
92
- * application/vnd.company+json
93
- * @param mime - MIME (Multipurpose Internet Mail Extensions)
94
- * @return True if the given MIME is JSON, false otherwise.
95
- */
96
- public isJsonMime(mime: string): boolean {
97
- const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
98
- return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
99
- }
100
- }
package/cookies_load.js DELETED
@@ -1,37 +0,0 @@
1
- const vrchat = require("vrchat");
2
-
3
- const readline = require("readline")
4
-
5
- const tough = require("tough-cookie");
6
- const fs = require("fs");
7
-
8
- const COOKIE_FILE = "cookies.json";
9
- let cookieJar = new tough.CookieJar();
10
-
11
- if (fs.existsSync(COOKIE_FILE)) {
12
- const serializedCookies = fs.readFileSync(COOKIE_FILE, "utf-8");
13
- cookieJar = tough.CookieJar.deserializeSync(JSON.parse(serializedCookies));
14
- }
15
-
16
- const configuration = new vrchat.Configuration({
17
- username: "username",
18
- password: "password",
19
- baseOptions: {
20
- headers: {
21
- "User-Agent": "ExampleProgram/0.0.1 my@email.com",
22
- // Use this instead of jar if you want to hard code cookies
23
- // "Cookie": "auth=[AUTH_COOKIE_HERE]; twoFactorAuth=[TWO_FACTOR_AUTH_COOKIE_HERE]"
24
- },
25
- jar: cookieJar,
26
- }
27
- });
28
-
29
-
30
- const authenticationApi = new AuthenticationApi(configuration);
31
-
32
- async function main() {
33
- var currentUser = (await authenticationApi.getCurrentUser()).data
34
- console.log(`Logged in as: ${currentUser.displayName}`);
35
- }
36
-
37
- main();
package/cookies_store.js DELETED
@@ -1,50 +0,0 @@
1
- const vrchat = require("vrchat");
2
-
3
- const readline = require("readline")
4
-
5
- const tough = require("tough-cookie");
6
- const fs = require("fs");
7
-
8
- const rl = readline.createInterface({input: process.stdin, output: process.stdout});
9
- const prompt = (query) => new Promise((resolve) => rl.question(query, resolve));
10
-
11
-
12
- const COOKIE_FILE = "cookies.json";
13
- let cookieJar = new tough.CookieJar();
14
-
15
- const configuration = new vrchat.Configuration({
16
- username: "username",
17
- password: "password",
18
- baseOptions: {
19
- headers: { "User-Agent": "ExampleProgram/0.0.1 my@email.com"},
20
- jar: cookieJar,
21
- }
22
- });
23
-
24
-
25
- const authenticationApi = new AuthenticationApi(configuration);
26
-
27
- async function main() {
28
- var currentUser = (await authenticationApi.getCurrentUser()).data
29
-
30
- if (currentUser["requiresTwoFactorAuth"] && currentUser["requiresTwoFactorAuth"][0] === "emailOtp") {
31
- await authenticationApi.verify2FAEmailCode({ code: await prompt("email Code\n") })
32
- currentUser = (await authenticationApi.getCurrentUser()).data;
33
- }
34
- if (currentUser["requiresTwoFactorAuth"] && currentUser["requiresTwoFactorAuth"][0] === "totp") {
35
- await authenticationApi.verify2FA({ code: await prompt("2fa Code\n") })
36
- currentUser = (await authenticationApi.getCurrentUser()).data;
37
- }
38
-
39
- console.log(`Logged in as: ${currentUser.displayName}`);
40
-
41
- const serializedJar = JSON.stringify(cookieJar.serializeSync());
42
- fs.writeFileSync(COOKIE_FILE, serializedJar);
43
-
44
- const deserializedJar = tough.CookieJar.deserializeSync(serializedJar);
45
- const store = deserializedJar.store.idx["api.vrchat.cloud"]["/"];
46
- console.log(`auth=${store["auth"]["value"]}`);
47
- console.log(`twoFactorAuth=${store["twoFactorAuth"]["value"]}`);
48
- }
49
-
50
- main();