feat: server kotlin/java/rest/graphql

This commit is contained in:
Torsten Dittmann
2023-10-11 21:04:21 +02:00
parent 8574de6439
commit 3f8e61373d
3 changed files with 17 additions and 4 deletions

View File

@@ -74,6 +74,10 @@ const platformAliases: Record<string, keyof typeof languages> = {
[Platform.ServerPython]: 'py', [Platform.ServerPython]: 'py',
[Platform.ServerRuby]: 'rb', [Platform.ServerRuby]: 'rb',
[Platform.ServerSwift]: 'swift', [Platform.ServerSwift]: 'swift',
[Platform.ServerAndroidJava]: 'java',
[Platform.ServerAndroidKotlin]: 'kotlin',
[Platform.ServerGraphql]: 'graphql',
[Platform.ServerRest]: 'http',
vue: 'html', vue: 'html',
svelte: 'html' svelte: 'html'
}; };

View File

@@ -39,7 +39,11 @@ export enum Platform {
ServerPhp = 'server-php', ServerPhp = 'server-php',
ServerPython = 'server-python', ServerPython = 'server-python',
ServerRuby = 'server-ruby', ServerRuby = 'server-ruby',
ServerSwift = 'server-swift' ServerSwift = 'server-swift',
ServerAndroidKotlin = 'server-android-kotlin',
ServerAndroidJava = 'server-android-java',
ServerGraphql = 'server-graphql',
ServerRest = 'server-rest',
} }
export const platformMap: Record<Language | string, string> = { export const platformMap: Record<Language | string, string> = {
@@ -58,6 +62,10 @@ export const platformMap: Record<Language | string, string> = {
[Platform.ServerPython]: 'Python', [Platform.ServerPython]: 'Python',
[Platform.ServerRuby]: 'Ruby', [Platform.ServerRuby]: 'Ruby',
[Platform.ServerSwift]: 'Swift', [Platform.ServerSwift]: 'Swift',
[Platform.ServerAndroidKotlin]: 'Android (Kotlin)',
[Platform.ServerAndroidJava]: 'Android (Java)',
[Platform.ServerGraphql]: 'GraphQL',
[Platform.ServerRest]: 'REST',
sh: 'Shell', sh: 'Shell',
js: 'JavaScript', js: 'JavaScript',
jsx: 'React', jsx: 'React',

View File

@@ -208,9 +208,10 @@ export async function getService(
/** /**
* Exceptions for Android SDK. * Exceptions for Android SDK.
*/ */
const isAndroidJava = platform === Platform.ClientAndroidJava; const isAndroidJava = platform === Platform.ClientAndroidJava || platform === Platform.ServerAndroidJava;
const isAndroidKotlin = platform === Platform.ClientAndroidKotlin; const isAndroidKotlin = platform === Platform.ClientAndroidKotlin || platform === Platform.ServerAndroidKotlin;
const isAndroid = isAndroidJava || isAndroidKotlin; const isAndroid = isAndroidJava || isAndroidKotlin;
const isAndroidServer = platform === Platform.ServerAndroidJava || platform === Platform.ServerAndroidKotlin;
const api = await getApi(version, platform); const api = await getApi(version, platform);
const tag = api.tags?.find((n) => n.name === service); const tag = api.tags?.find((n) => n.name === service);
@@ -266,7 +267,7 @@ export async function getService(
); );
const path = isAndroid const path = isAndroid
? `/node_modules/@appwrite.io/repo/docs/examples/${version}/client-android/${ ? `/node_modules/@appwrite.io/repo/docs/examples/${version}/${isAndroidServer ? 'server-kotlin' : 'client-android'}/${
isAndroidJava ? 'java' : 'kotlin' isAndroidJava ? 'java' : 'kotlin'
}/${operation['x-appwrite'].demo}` }/${operation['x-appwrite'].demo}`
: `/node_modules/@appwrite.io/repo/docs/examples/${version}/${platform}/examples/${operation['x-appwrite'].demo}`; : `/node_modules/@appwrite.io/repo/docs/examples/${version}/${platform}/examples/${operation['x-appwrite'].demo}`;