Skip to content

Commit

Permalink
docs: example restructuring (#751)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aman035 authored Oct 5, 2023
1 parent ef50b45 commit 63384c5
Show file tree
Hide file tree
Showing 17 changed files with 1,490 additions and 1,670 deletions.
667 changes: 667 additions & 0 deletions packages/examples/sdk-backend-node/chat/chat.lowlevel.ts

Large diffs are not rendered by default.

815 changes: 201 additions & 614 deletions packages/examples/sdk-backend-node/chat/chat.ts

Large diffs are not rendered by default.

30 changes: 28 additions & 2 deletions packages/examples/sdk-backend-node/chat/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,28 @@
export { runChatUseCases } from './chat';
export { runNFTChatUseCases } from './nftChat';
import { runChatLowlevelUseCases } from './chat.lowlevel';
import { runNFTChatLowLevelUseCases } from './nftChat.lowlevel';
import { runChatClassUseCases } from './chat';

export const runChatUseCases = async (): Promise<void> => {
console.log(`
░█████╗░██╗░░██╗░█████╗░████████╗
██╔══██╗██║░░██║██╔══██╗╚══██╔══╝
██║░░╚═╝███████║███████║░░░██║░░░
██║░░██╗██╔══██║██╔══██║░░░██║░░░
╚█████╔╝██║░░██║██║░░██║░░░██║░░░
░╚════╝░╚═╝░░╚═╝╚═╝░░╚═╝░░░╚═╝░░░
`);

await runChatClassUseCases();
console.log(`
▒█▀▀█ ▒█░▒█ ░█▀▀█ ▀▀█▀▀ ░ ▒█░░░ ▒█▀▀▀█ ▒█░░▒█ ▒█░░░ ▒█▀▀▀ ▒█░░▒█ ▒█▀▀▀ ▒█░░░
▒█░░░ ▒█▀▀█ ▒█▄▄█ ░▒█░░ ▄ ▒█░░░ ▒█░░▒█ ▒█▒█▒█ ▒█░░░ ▒█▀▀▀ ░▒█▒█░ ▒█▀▀▀ ▒█░░░
▒█▄▄█ ▒█░▒█ ▒█░▒█ ░▒█░░ █ ▒█▄▄█ ▒█▄▄▄█ ▒█▄▀▄█ ▒█▄▄█ ▒█▄▄▄ ░░▀▄▀░ ▒█▄▄▄ ▒█▄▄█
`);
await runChatLowlevelUseCases();
console.log(`
▒█▄░▒█ ▒█▀▀▀ ▀▀█▀▀ ▒█▀▀█ ▒█░▒█ ░█▀▀█ ▀▀█▀▀ ░ ▒█░░░ ▒█▀▀▀█ ▒█░░▒█ ▒█░░░ ▒█▀▀▀ ▒█░░▒█ ▒█▀▀▀ ▒█░░░
▒█▒█▒█ ▒█▀▀▀ ░▒█░░ ▒█░░░ ▒█▀▀█ ▒█▄▄█ ░▒█░░ ▄ ▒█░░░ ▒█░░▒█ ▒█▒█▒█ ▒█░░░ ▒█▀▀▀ ░▒█▒█░ ▒█▀▀▀ ▒█░░░
▒█░░▀█ ▒█░░░ ░▒█░░ ▒█▄▄█ ▒█░▒█ ▒█░▒█ ░▒█░░ █ ▒█▄▄█ ▒█▄▄▄█ ▒█▄▀▄█ ▒█▄▄█ ▒█▄▄▄ ░░▀▄▀░ ▒█▄▄▄ ▒█▄▄█
`);
await runNFTChatLowLevelUseCases();
};
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,7 @@ const skipExample = () => {
};

// Push Chat - Run Chat Use cases
export const runNFTChatUseCases = async (): Promise<void> => {
console.log(`
███ ██ ███████ ████████ ██████ ██ ██ █████ ████████
████ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ █████ ██ ██ ███████ ███████ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ████ ██ ██ ██████ ██ ██ ██ ██ ██
`);

export const runNFTChatLowLevelUseCases = async (): Promise<void> => {
if (skipExample()) {
console.log('Skipping examples as required env vars are missing');
return;
Expand Down
72 changes: 44 additions & 28 deletions packages/examples/sdk-backend-node/main.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { runNotificaitonsUseCases } from './notification';
import { runChatUseCases, runNFTChatUseCases } from './chat';
import { runUserCases } from './user';
import { runNotificationUseCases } from './notification';
import { runChatUseCases } from './chat';
import { runVideoUseCases } from './video';
import { runSpacesUseCases } from './spaces';
import { runPushAPICases } from './pushAPI';
import { runSpaceUseCases } from './space';

import { config } from './config';
import { ENV } from './types';
import { exit } from 'process';

// CONFIGS
const { env } = config;
Expand All @@ -15,12 +16,12 @@ const start = async (): Promise<void> => {
console.log(`${returnHeadingLog()}`);
console.log(`${returnENVLog()}`);

await runPushAPICases();
await runNotificaitonsUseCases();
await runUserCases();
await runNotificationUseCases();
await runChatUseCases();
await runNFTChatUseCases();
await runVideoUseCases();
await runSpacesUseCases();
await runSpaceUseCases();
exit(0);
};

start();
Expand All @@ -32,39 +33,54 @@ start();
// -----------
function returnHeadingLog() {
const headingLog = `
███████ ██████ ██ ██ ███████ ██ ██ ███ ██ ██████ ████████ ██ ██████ ███ ██ █████ ██ ██ ████████ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██
███████ ██ ██ █████ █████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██ ██ ██ ████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
███████ ██████ ██ ██ ██ ██████ ██ ████ ██████ ██ ██ ██████ ██ ████ ██ ██ ███████ ██ ██ ██
░██████╗██████╗░██╗░░██╗ ███████╗██╗░░░██╗███╗░░██╗░█████╗░████████╗██╗░█████╗░███╗░░██╗░█████╗░██╗░░░░░██╗████████╗██╗░░░██╗
██╔════╝██╔══██╗██║░██╔╝ ██╔════╝██║░░░██║████╗░██║██╔══██╗╚══██╔══╝██║██╔══██╗████╗░██║██╔══██╗██║░░░░░██║╚══██╔══╝╚██╗░██╔╝
╚█████╗░██║░░██║█████═╝░ █████╗░░██║░░░██║██╔██╗██║██║░░╚═╝░░░██║░░░██║██║░░██║██╔██╗██║███████║██║░░░░░██║░░░██║░░░░╚████╔╝░
░╚═══██╗██║░░██║██╔═██╗░ ██╔══╝░░██║░░░██║██║╚████║██║░░██╗░░░██║░░░██║██║░░██║██║╚████║██╔══██║██║░░░░░██║░░░██║░░░░░╚██╔╝░░
██████╔╝██████╔╝██║░╚██╗ ██║░░░░░╚██████╔╝██║░╚███║╚█████╔╝░░░██║░░░██║╚█████╔╝██║░╚███║██║░░██║███████╗██║░░░██║░░░░░░██║░░░
╚═════╝░╚═════╝░╚═╝░░╚═╝ ╚═╝░░░░░░╚═════╝░╚═╝░░╚══╝░╚════╝░░░░╚═╝░░░╚═╝░╚════╝░╚═╝░░╚══╝╚═╝░░╚═╝╚══════╝╚═╝░░░╚═╝░░░░░░╚═╝░░░
`;
return headingLog;
}

function returnENVLog() {
let environmentLog = `
███████ ████████ █████ ██████ ██ ███ ██ ██████
██ ██ ██ ██ ██ ██ ████ ██ ██
███████ ██ ███████ ██ ███ ██ ██ ██ ██ ██ ███
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
███████ ██ ██ ██ ██████ ██ ██ ████ ██████
███████╗███╗░░██╗██╗░░░██╗ ░░░░░░ ░██████╗████████╗░█████╗░░██████╗░██╗███╗░░██╗░██████╗░
██╔════╝████╗░██║██║░░░██║ ░░░░░░ ██╔════╝╚══██╔══╝██╔══██╗██╔════╝░██║████╗░██║██╔════╝░
█████╗░░██╔██╗██║╚██╗░██╔╝ █████╗ ╚█████╗░░░░██║░░░███████║██║░░██╗░██║██╔██╗██║██║░░██╗░
██╔══╝░░██║╚████║░╚████╔╝░ ╚════╝ ░╚═══██╗░░░██║░░░██╔══██║██║░░╚██╗██║██║╚████║██║░░╚██╗
███████╗██║░╚███║░░╚██╔╝░░ ░░░░░░ ██████╔╝░░░██║░░░██║░░██║╚██████╔╝██║██║░╚███║╚██████╔╝
╚══════╝╚═╝░░╚══╝░░░╚═╝░░░ ░░░░░░ ╚═════╝░░░░╚═╝░░░╚═╝░░╚═╝░╚═════╝░╚═╝╚═╝░░╚══╝░╚═════╝░
`;

if (env === ENV.PROD) {
environmentLog = `
██████ ██████ ██████ ██████ ██ ██ ██████ ████████ ██ ██████ ███ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██
██████ ██████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██████ ██████ ██████ ██████ ██ ██ ██████ ██ ████
███████╗███╗░░██╗██╗░░░██╗ ░░░░░░ ██████╗░██████╗░░█████╗░██████╗░
██╔════╝████╗░██║██║░░░██║ ░░░░░░ ██╔══██╗██╔══██╗██╔══██╗██╔══██╗
█████╗░░██╔██╗██║╚██╗░██╔╝ █████╗ ██████╔╝██████╔╝██║░░██║██║░░██║
██╔══╝░░██║╚████║░╚████╔╝░ ╚════╝ ██╔═══╝░██╔══██╗██║░░██║██║░░██║
███████╗██║░╚███║░░╚██╔╝░░ ░░░░░░ ██║░░░░░██║░░██║╚█████╔╝██████╔╝
╚══════╝╚═╝░░╚══╝░░░╚═╝░░░ ░░░░░░ ╚═╝░░░░░╚═╝░░╚═╝░╚════╝░╚═════╝░
`;
} else if (env === ENV.DEV) {
environmentLog = `
██████ ███████ ██ ██
██ ██ ██ ██ ██
██ ██ █████ ██ ██
██ ██ ██ ██ ██
██████ ███████ ████
███████╗███╗░░██╗██╗░░░██╗ ░░░░░░ ██████╗░███████╗██╗░░░██╗
██╔════╝████╗░██║██║░░░██║ ░░░░░░ ██╔══██╗██╔════╝██║░░░██║
█████╗░░██╔██╗██║╚██╗░██╔╝ █████╗ ██║░░██║█████╗░░╚██╗░██╔╝
██╔══╝░░██║╚████║░╚████╔╝░ ╚════╝ ██║░░██║██╔══╝░░░╚████╔╝░
███████╗██║░╚███║░░╚██╔╝░░ ░░░░░░ ██████╔╝███████╗░░╚██╔╝░░
╚══════╝╚═╝░░╚══╝░░░╚═╝░░░ ░░░░░░ ╚═════╝░╚══════╝░░░╚═╝░░░
`;
} else if (env === ENV.LOCAL) {
environmentLog = `
███████╗███╗░░██╗██╗░░░██╗ ░░░░░░ ██╗░░░░░░█████╗░░█████╗░░█████╗░██╗░░░░░
██╔════╝████╗░██║██║░░░██║ ░░░░░░ ██║░░░░░██╔══██╗██╔══██╗██╔══██╗██║░░░░░
█████╗░░██╔██╗██║╚██╗░██╔╝ █████╗ ██║░░░░░██║░░██║██║░░╚═╝███████║██║░░░░░
██╔══╝░░██║╚████║░╚████╔╝░ ╚════╝ ██║░░░░░██║░░██║██║░░██╗██╔══██║██║░░░░░
███████╗██║░╚███║░░╚██╔╝░░ ░░░░░░ ███████╗╚█████╔╝╚█████╔╝██║░░██║███████╗
╚══════╝╚═╝░░╚══╝░░░╚═╝░░░ ░░░░░░ ╚══════╝░╚════╝░░╚════╝░╚═╝░░╚═╝╚══════╝
`;
}

Expand Down
Loading

0 comments on commit 63384c5

Please sign in to comment.