Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion adminSDK/reports/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async function listLoginEvents() {
console.log('Logins:');
activities.forEach((activity) => {
console.log(
`${activity.id?.time}: ${activity.actor?.email} (${activity.events?.[0]?.name})`,
`${activity.id?.time}: ${activity.actor?.email} (${activity.events?.[0]?.name})`,
);
});
}
Expand Down
36 changes: 36 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"$schema": "https://biomejs.dev/schemas/2.2.4/schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"files": {
"ignoreUnknown": true
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2,
"bracketSpacing": false
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"javascript": {
"formatter": {
"quoteStyle": "single"
}
},
"assist": {
"enabled": true,
"actions": {
"source": {
"organizeImports": "on"
}
}
}
}
52 changes: 26 additions & 26 deletions chat/client-libraries/cloud/authentication-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const APP_AUTH_OAUTH_SCOPES = ['https://www.googleapis.com/auth/chat.bot'];
// User authentication
const CLIENT_SECRETS_FILE = './credentials.json';
const CLIENT_SECRETS = JSON.parse(
await readFile(new URL(CLIENT_SECRETS_FILE, import.meta.url), 'utf8'),
await readFile(new URL(CLIENT_SECRETS_FILE, import.meta.url), 'utf8'),
).web;

/**
Expand Down Expand Up @@ -73,9 +73,9 @@ function getAuthenticatedUserOAuth2Client(scopes) {
return new Promise((resolve, reject) => {
// Create a client based on client secrets
const oAuth2Client = new OAuth2Client(
CLIENT_SECRETS.client_id,
CLIENT_SECRETS.client_secret,
CLIENT_SECRETS.redirect_uris[0],
CLIENT_SECRETS.client_id,
CLIENT_SECRETS.client_secret,
CLIENT_SECRETS.redirect_uris[0],
);

// Generate the URL to use for consent
Expand All @@ -86,31 +86,31 @@ function getAuthenticatedUserOAuth2Client(scopes) {

// Open an HTTP server to accept the OAuth2 callback
const server = http
.createServer(async (request, response) => {
try {
if (request.url.indexOf('/oauth2callback') > -1) {
.createServer(async (request, response) => {
try {
if (request.url.indexOf('/oauth2callback') > -1) {
// Acquire the code and close the server.
const queryString = new url.URL(
request.url,
'http://localhost:3000',
).searchParams;
const code = queryString.get('code');
response.end('Done!');
server.destroy();
// Acquire the tokens
const r = await oAuth2Client.getToken(code);
// Update credentials of the OAuth2 client.
oAuth2Client.setCredentials(r.tokens);
resolve(oAuth2Client);
}
} catch (e) {
reject(e);
const queryString = new url.URL(
request.url,
'http://localhost:3000',
).searchParams;
const code = queryString.get('code');
response.end('Done!');
server.destroy();
// Acquire the tokens
const r = await oAuth2Client.getToken(code);
// Update credentials of the OAuth2 client.
oAuth2Client.setCredentials(r.tokens);
resolve(oAuth2Client);
}
})
.listen(3000, () => {
} catch (e) {
reject(e);
}
})
.listen(3000, () => {
// Open default browser and start the flow
open(authorizeUrl, {wait: false}).then((cp) => cp.unref());
});
open(authorizeUrl, {wait: false}).then((cp) => cp.unref());
});
destroyer(server);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const USER_AUTH_OAUTH_SCOPES = [
async function main() {
// Create a client
const chatClient = await createClientWithUserCredentials(
USER_AUTH_OAUTH_SCOPES,
USER_AUTH_OAUTH_SCOPES,
);

// TODO(developer) Replace FILENAME here.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const USER_AUTH_OAUTH_SCOPES = [
async function main() {
// Create a client
const chatClient = await createClientWithUserCredentials(
USER_AUTH_OAUTH_SCOPES,
USER_AUTH_OAUTH_SCOPES,
);

// Initialize request argument(s)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const USER_AUTH_OAUTH_SCOPES = [
async function main() {
// Create a client
const chatClient = await createClientWithUserCredentials(
USER_AUTH_OAUTH_SCOPES,
USER_AUTH_OAUTH_SCOPES,
);

// Initialize request argument(s)
Expand Down
2 changes: 1 addition & 1 deletion chat/client-libraries/cloud/create-membership-user-cred.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const USER_AUTH_OAUTH_SCOPES = [
async function main() {
// Create a client
const chatClient = await createClientWithUserCredentials(
USER_AUTH_OAUTH_SCOPES,
USER_AUTH_OAUTH_SCOPES,
);

// Initialize request argument(s)
Expand Down
10 changes: 5 additions & 5 deletions chat/client-libraries/cloud/create-message-app-cred.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async function main() {
message: {
text:
'👋🌎 Hello world! I created this message by calling ' +
'the Chat API\'s `messages.create()` method.',
"the Chat API's `messages.create()` method.",
cardsV2: [
{
card: {
Expand Down Expand Up @@ -69,19 +69,19 @@ async function main() {
],
},
{
header: 'What\'s next',
header: "What's next",
collapsible: true,
widgets: [
{
textParagraph: {
text: '❤️ <a href=\'https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages.reactions/create\'>Add a reaction</a>.',
text: "❤️ <a href='https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages.reactions/create'>Add a reaction</a>.",
},
},
{
textParagraph: {
text:
'🔄 <a href=\'https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages/patch\'>Update</a> ' +
'or ❌ <a href=\'https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages/delete\'>delete</a> ' +
"🔄 <a href='https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages/patch'>Update</a> " +
"or ❌ <a href='https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages/delete'>delete</a> " +
'the message.',
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const USER_AUTH_OAUTH_SCOPES = [
async function main() {
// Create a client
const chatClient = await createClientWithUserCredentials(
USER_AUTH_OAUTH_SCOPES,
USER_AUTH_OAUTH_SCOPES,
);

// Initialize request argument(s)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const USER_AUTH_OAUTH_SCOPES = [
async function main() {
// Create a client
const chatClient = await createClientWithUserCredentials(
USER_AUTH_OAUTH_SCOPES,
USER_AUTH_OAUTH_SCOPES,
);

// Initialize request argument(s)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const USER_AUTH_OAUTH_SCOPES = [
async function main() {
// Create a client
const chatClient = await createClientWithUserCredentials(
USER_AUTH_OAUTH_SCOPES,
USER_AUTH_OAUTH_SCOPES,
);

// Initialize request argument(s)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const USER_AUTH_OAUTH_SCOPES = [
async function main() {
// Create a client
const chatClient = await createClientWithUserCredentials(
USER_AUTH_OAUTH_SCOPES,
USER_AUTH_OAUTH_SCOPES,
);

// Initialize request argument(s)
Expand All @@ -39,7 +39,7 @@ async function main() {
// If it fails, the message starts a new thread instead
messageReplyOption:
protos.google.chat.v1.CreateMessageRequest.MessageReplyOption
.REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD,
.REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD,
message: {
text: 'Hello with user credential!',
thread: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const USER_AUTH_OAUTH_SCOPES = [
async function main() {
// Create a client
const chatClient = await createClientWithUserCredentials(
USER_AUTH_OAUTH_SCOPES,
USER_AUTH_OAUTH_SCOPES,
);

// Initialize request argument(s)
Expand All @@ -39,7 +39,7 @@ async function main() {
// If it fails, the message starts a new thread instead
messageReplyOption:
protos.google.chat.v1.CreateMessageRequest.MessageReplyOption
.REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD,
.REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD,
message: {
text: 'Hello with user credential!',
thread: {
Expand Down
2 changes: 1 addition & 1 deletion chat/client-libraries/cloud/create-message-user-cred.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const USER_AUTH_OAUTH_SCOPES = [
async function main() {
// Create a client
const chatClient = await createClientWithUserCredentials(
USER_AUTH_OAUTH_SCOPES,
USER_AUTH_OAUTH_SCOPES,
);

// Initialize request argument(s)
Expand Down
2 changes: 1 addition & 1 deletion chat/client-libraries/cloud/create-reaction-user-cred.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const USER_AUTH_OAUTH_SCOPES = [
async function main() {
// Create a client
const chatClient = await createClientWithUserCredentials(
USER_AUTH_OAUTH_SCOPES,
USER_AUTH_OAUTH_SCOPES,
);

// Initialize request argument(s)
Expand Down
2 changes: 1 addition & 1 deletion chat/client-libraries/cloud/create-space-user-cred.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const USER_AUTH_OAUTH_SCOPES = [
async function main() {
// Create a client
const chatClient = await createClientWithUserCredentials(
USER_AUTH_OAUTH_SCOPES,
USER_AUTH_OAUTH_SCOPES,
);

// Initialize request argument(s)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const USER_AUTH_OAUTH_SCOPES = [
async function main() {
// Create a client
const chatClient = await createClientWithUserCredentials(
USER_AUTH_OAUTH_SCOPES,
USER_AUTH_OAUTH_SCOPES,
);

// Initialize request argument(s)
Expand Down
2 changes: 1 addition & 1 deletion chat/client-libraries/cloud/delete-membership-user-cred.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const USER_AUTH_OAUTH_SCOPES = [
async function main() {
// Create a client
const chatClient = await createClientWithUserCredentials(
USER_AUTH_OAUTH_SCOPES,
USER_AUTH_OAUTH_SCOPES,
);

// Initialize request argument(s)
Expand Down
2 changes: 1 addition & 1 deletion chat/client-libraries/cloud/delete-message-user-cred.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const USER_AUTH_OAUTH_SCOPES = [
async function main() {
// Create a client
const chatClient = await createClientWithUserCredentials(
USER_AUTH_OAUTH_SCOPES,
USER_AUTH_OAUTH_SCOPES,
);

// Initialize request argument(s)
Expand Down
2 changes: 1 addition & 1 deletion chat/client-libraries/cloud/delete-reaction-user-cred.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const USER_AUTH_OAUTH_SCOPES = [
async function main() {
// Create a client
const chatClient = await createClientWithUserCredentials(
USER_AUTH_OAUTH_SCOPES,
USER_AUTH_OAUTH_SCOPES,
);

// Initialize request argument(s)
Expand Down
2 changes: 1 addition & 1 deletion chat/client-libraries/cloud/delete-space-user-cred.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const USER_AUTH_OAUTH_SCOPES = ['https://www.googleapis.com/auth/chat.delete'];
async function main() {
// Create a client
const chatClient = await createClientWithUserCredentials(
USER_AUTH_OAUTH_SCOPES,
USER_AUTH_OAUTH_SCOPES,
);

// Initialize request argument(s)
Expand Down
2 changes: 1 addition & 1 deletion chat/client-libraries/cloud/find-dm-space-user-cred.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const USER_AUTH_OAUTH_SCOPES = [
async function main() {
// Create a client
const chatClient = await createClientWithUserCredentials(
USER_AUTH_OAUTH_SCOPES,
USER_AUTH_OAUTH_SCOPES,
);

// Initialize request argument(s)
Expand Down
2 changes: 1 addition & 1 deletion chat/client-libraries/cloud/get-custom-emoji-user-cred.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const USER_AUTH_OAUTH_SCOPES = [
async function main() {
// Create a client
const chatClient = await createClientWithUserCredentials(
USER_AUTH_OAUTH_SCOPES,
USER_AUTH_OAUTH_SCOPES,
);

// Initialize request argument(s)
Expand Down
2 changes: 1 addition & 1 deletion chat/client-libraries/cloud/get-membership-user-cred.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const USER_AUTH_OAUTH_SCOPES = [
async function main() {
// Create a client
const chatClient = await createClientWithUserCredentials(
USER_AUTH_OAUTH_SCOPES,
USER_AUTH_OAUTH_SCOPES,
);

// Initialize request argument(s)
Expand Down
2 changes: 1 addition & 1 deletion chat/client-libraries/cloud/get-message-user-cred.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const USER_AUTH_OAUTH_SCOPES = [
async function main() {
// Create a client
const chatClient = await createClientWithUserCredentials(
USER_AUTH_OAUTH_SCOPES,
USER_AUTH_OAUTH_SCOPES,
);

// Initialize request argument(s)
Expand Down
2 changes: 1 addition & 1 deletion chat/client-libraries/cloud/get-space-event-user-cred.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const USER_AUTH_OAUTH_SCOPES = ['SCOPE_NAME'];
async function main() {
// Create a client
const chatClient = await createClientWithUserCredentials(
USER_AUTH_OAUTH_SCOPES,
USER_AUTH_OAUTH_SCOPES,
);

// Initialize request argument(s)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const USER_AUTH_OAUTH_SCOPES = [
async function main() {
// Create a client
const chatClient = await createClientWithUserCredentials(
USER_AUTH_OAUTH_SCOPES,
USER_AUTH_OAUTH_SCOPES,
);

// Initialize request argument(s), replace the SPACE_NAME with an actual space name.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const USER_AUTH_OAUTH_SCOPES = [
async function main() {
// Create a client
const chatClient = await createClientWithUserCredentials(
USER_AUTH_OAUTH_SCOPES,
USER_AUTH_OAUTH_SCOPES,
);

// Initialize request argument(s)
Expand Down
2 changes: 1 addition & 1 deletion chat/client-libraries/cloud/get-space-user-cred.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const USER_AUTH_OAUTH_SCOPES = [
async function main() {
// Create a client
const chatClient = await createClientWithUserCredentials(
USER_AUTH_OAUTH_SCOPES,
USER_AUTH_OAUTH_SCOPES,
);

// Initialize request argument(s)
Expand Down
Loading
Loading