async function listSpaces(authClient) {
  // Create a client
  const chatClient = new ChatServiceClient({
    authClient: authClient,
    scopes: SCOPES,
  });

  // Initialize request argument(s)
  const request = {
    // Filter spaces by space type (SPACE or GROUP_CHAT or DIRECT_MESSAGE)
    filter: 'space_type = "SPACE"'
  };

  // Make the request
  const pageResult = chatClient.listSpacesAsync(request);

  // Handle the response. Iterating over pageResult will yield results and
  // resolve additional pages automatically.
  for await (const response of pageResult) {
    console.log(response);
  }
}
Lists spaces with user credential.
@param {OAuth2Client} authClient An authorized OAuth2 client.