datasquirel/users/social/google-auth.d.ts

54 lines
2.4 KiB
TypeScript
Raw Normal View History

2024-11-08 15:44:31 +00:00
export = googleAuth;
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/**
* @typedef {object | null} FunctionReturn
* @property {boolean} success - Did the function run successfully?
* @property {import("../../types/user.td").DATASQUIREL_LoggedInUser | null} user - Returned User
* @property {number} [dsqlUserId] - Dsql User Id
* @property {string} [msg] - Response message
*/
/**
* SERVER FUNCTION: Login with google Function
* ==============================================================================
*
* @async
*
* @param {object} params - main params object
* @param {string} params.key - API full access key
* @param {string} params.token - Google access token gotten from the client side
* @param {string} params.database - Target database name(slug)
* @param {string} params.clientId - Google client id
* @param {http.ServerResponse} params.response - HTTPS response object
* @param {string} params.encryptionKey - Encryption key
* @param {string} params.encryptionSalt - Encryption salt
* @param {object} [params.additionalFields] - Additional Fields to be added to the user object
2024-12-06 10:44:26 +00:00
* @param {boolean} [params.user_id] - User ID
* @param {string | number} [params.apiUserID] - Required for Local
* @param {boolean} [params.useLocal] - Whether to use a remote database instead of API
2024-11-08 15:44:31 +00:00
*
* @returns { Promise<FunctionReturn> }
*/
2024-12-06 10:44:26 +00:00
declare function googleAuth({ key, token, database, clientId, response, encryptionKey, encryptionSalt, additionalFields, user_id, apiUserID, useLocal, }: {
2024-11-08 15:44:31 +00:00
key: string;
token: string;
database: string;
clientId: string;
response: http.ServerResponse;
encryptionKey: string;
encryptionSalt: string;
additionalFields?: object;
2024-12-06 10:44:26 +00:00
user_id?: boolean;
apiUserID?: string | number;
useLocal?: boolean;
2024-11-08 15:44:31 +00:00
}): Promise<FunctionReturn>;
declare namespace googleAuth {
export { FunctionReturn };
}
import http = require("http");
type FunctionReturn = object | null;