diff --git a/docs/cache/develop/sdks/dart/cheat-sheet.mdx b/docs/cache/develop/sdks/dart/cheat-sheet.mdx new file mode 100644 index 000000000..780e84ff5 --- /dev/null +++ b/docs/cache/develop/sdks/dart/cheat-sheet.mdx @@ -0,0 +1,74 @@ +--- +sidebar_position: 1 +sidebar_label: Cheat Sheet +sidebar_class_name: sidebar-item-swift +title: Cheat Sheet for Dart +description: Get started really quickly coding using Dart with Momento Cache +--- + +import { SdkExampleCodeBlock } from "@site/src/components/SdkExampleCodeBlock"; +// This import is necessary even though it looks like it's un-used; The inject-example-code-snippet +// plugin will transform instances of SdkExampleCodeBlock to SdkExampleCodeBlockImpl +import { SdkExampleCodeBlockImpl } from "@site/src/components/SdkExampleCodeBlockImpl"; + +# Cheat Sheet for Dart with Momento Cache + +If you need to get going quickly with Dart and Momento Cache, this page contains the basic API calls you'll need. [Check the Dart SDK examples](https://github.com/momentohq/client-sdk-dart/tree/main/examples) for complete, working code samples. + +## Install the Momento SDK + +The latest version of the Momento Dart SDK is available on GitHub: [momentohq/client-sdk-dart](https://github.com/momentohq/client-sdk-dart). + +## Get your Momento API key + +You'll need a Momento API key. You can get one from the [Momento Web Console](https://console.gomomento.com/). +Once you have your token, store it in an environment variable so that the Momento client can consume it: + +``` +export MOMENTO_API_KEY= +``` + +**Note**: it is best practice to put the API key into something like AWS Secret Manager or GCP Secret Manager instead of an environment variable for enhanced security, but we are using one here for demo purposes. + +## Set up a CacheClient +This code creates the CacheClient that you will use to call the other methods. + + + +## Create a new cache in Momento Cache +Use this function to create a new cache in your account. + + + +## List the names of existing caches in your account +A simple list of the names of caches for the account. + + + +## Delete a cache +Use this function to delete a cache from your account. + + + +## Write an item to a cache +A simple example of doing a set operation. In the CacheClient.set() call, the TTL is optional. If you did pass it in, this would override the default TTL value set with the client connection object. + + + +## Read an item from a cache +This is an example of a simple read operation to get an item from a cache. + + + +## Delete an item from a cache +This is an example of deleting an item from a cache. + + + +## Running the code + +You can find complete, working examples in the [Dart SDK GitHub repo examples directory](https://github.com/momentohq/client-sdk-dart/tree/main/examples). + +:::info +Beyond these basic API calls check out the [API reference page](/cache/develop/api-reference/index.mdx) for more information on the full assortment of Momento API calls. +::: diff --git a/docs/cache/develop/sdks/dart/index.md b/docs/cache/develop/sdks/dart/index.md new file mode 100644 index 000000000..cb9d0728a --- /dev/null +++ b/docs/cache/develop/sdks/dart/index.md @@ -0,0 +1,29 @@ +--- +sidebar_position: 7 +title: Momento Dart SDK +pagination_prev: null +sidebar_label: Dart +description: Information about the Momento Dart SDK +--- + +# Momento Swift SDK + +Welcome to the Momento Dart SDK documentation! + +The Momento Dart SDK and source code are available via GitHub: [momentohq/client-sdk-swift](https://github.com/momentohq/client-sdk-swift). + +## Requirements + +- [Dart version 3](https://dart.dev/get-dart) or higher is required. +- A Momento API key is required; you can get one from the [Momento Web Console](https://console.gomomento.com/). + +## Resources + +- [Dart SDK cheat sheet](./cheat-sheet.mdx) +- [Dart SDK examples](https://github.com/momentohq/client-sdk-dart/tree/main/examples): working example projects that illustrate how to use the Dart SDK +- COMING SOON: Observability: Logging and client-side metrics with the Dart SDK +- COMING SOON: Taking your code to prod: configuration and error handling in the Dart SDK + +## Integrations + +COMING SOON diff --git a/docs/cache/getting-started.md b/docs/cache/getting-started.md index dbe2eedb0..8b6fce783 100644 --- a/docs/cache/getting-started.md +++ b/docs/cache/getting-started.md @@ -179,6 +179,7 @@ We currently have the following SDK languages available: - [Ruby](./develop/sdks/ruby) - [Elixir](./develop/sdks/elixir) - [Swift](./develop/sdks/swift) +- [Dart](./develop/sdks/dart) ## FAQ diff --git a/docs/cache/index.md b/docs/cache/index.md index d3a8b39ca..b9b3dc72e 100644 --- a/docs/cache/index.md +++ b/docs/cache/index.md @@ -44,6 +44,7 @@ In the following pages, you can learn about caching in general and how to use Mo - [Ruby](./cache/develop/sdks/ruby) - [Elixir](./cache/develop/sdks/elixir) - [Swift](./cache/develop/sdks/swift) + - [Dart](./develop/sdks/dart) - _Looking for Momento icons for your architecture diagrams?_ Download [Momento_Architecture_Icons.zip](@site/static/img/icons/Momento_Architecture_Icons.zip). diff --git a/docs/topics/develop/sdks/dart/cheat-sheet.mdx b/docs/topics/develop/sdks/dart/cheat-sheet.mdx new file mode 100644 index 000000000..98a562fba --- /dev/null +++ b/docs/topics/develop/sdks/dart/cheat-sheet.mdx @@ -0,0 +1,54 @@ +--- +sidebar_position: 1 +sidebar_label: Topics Cheat Sheet +sidebar_class_name: sidebar-item-swift +title: Topics cheat sheet for Swift +description: Get started really quickly coding using Swift with Momento Topics +--- + +import { SdkExampleCodeBlock } from "@site/src/components/SdkExampleCodeBlock"; +// This import is necessary even though it looks like it's un-used; The inject-example-code-snippet +// plugin will transform instances of SdkExampleCodeBlock to SdkExampleCodeBlockImpl +import { SdkExampleCodeBlockImpl } from "@site/src/components/SdkExampleCodeBlockImpl"; + +# Cheat Sheet for Swift with Momento Topics + +If you need to get going quickly with Swift and Momento Topics, this page contains the basic API calls you'll need. [Check the Swift SDK examples](https://github.com/momentohq/client-sdk-swift/tree/main/Examples) for complete, working code samples. + +## Install the Momento SDK + +The latest version of the Momento Swift SDK is available on GitHub: [momentohq/client-sdk-swift](https://github.com/momentohq/client-sdk-swift). + +## Get your Momento API key + +You'll need a Momento API key. You can get one from the [Momento Web Console](https://console.gomomento.com/). +Once you have your token, store it in an environment variable so that the Momento client can consume it: + +``` +export MOMENTO_API_KEY= +``` + +**Note**: it is best practice to put the API key into something like AWS Secret Manager or GCP Secret Manager instead of an environment variable for enhanced security, but we are using one here for demo purposes. + +## Set up a TopicClient +This code creates the TopicClient that you will use to interact with your pub/sub topic. + + + +## Publish a message to a topic +This is an example of publishing a message to a topic called "topic", then catching the return value to check if the publish was successful. + + + +## Subscribe to a topic +This is an example of subscribing to a topic called "topic", then catching the return value to check if it was successful. If a subscription was received, a `for try await` loop is used to asynchronously receive and print the messages that are published to this topic. + + + +## Running the code + +You can find complete, working examples in the [Swift SDK GitHub repo examples directory](https://github.com/momentohq/client-sdk-swift/tree/main/examples). + +:::info +Beyond these basic API calls check out the [API reference page](./../../api-reference) for more information on the full assortment of Momento API calls. +::: diff --git a/docs/topics/develop/sdks/dart/index.md b/docs/topics/develop/sdks/dart/index.md new file mode 100644 index 000000000..55fc88a16 --- /dev/null +++ b/docs/topics/develop/sdks/dart/index.md @@ -0,0 +1,29 @@ +--- +sidebar_position: 7 +title: Momento Topics Dart SDK +pagination_prev: null +sidebar_label: Dart +description: Information about the Momento Dart SDK +--- + +# Momento Topics Dart SDK + +Welcome to the Momento Dart SDK documentation! + +The Momento Dart SDK and source code are available via GitHub: [momentohq/client-sdk-swift](https://github.com/momentohq/client-sdk-dart). + +## Requirements + +- [Dart version 3](https://dart.dev/get-dart) or higher is required. +- A Momento API key is required; you can get one from the [Momento Web Console](https://console.gomomento.com/). + +## Resources + +- [Dart SDK cheat sheet](./cheat-sheet.mdx) +- [Dart SDK examples](https://github.com/momentohq/client-sdk-dart/tree/main/examples): working example projects that illustrate how to use the Dart SDK +- COMING SOON: Observability: Logging and client-side metrics with the Dart SDK +- COMING SOON: Taking your code to prod: configuration and error handling in the Dart SDK + +## Integrations + +COMING SOON diff --git a/docusaurus.config.js b/docusaurus.config.js index bfc85e8a6..5f29f3e9c 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -372,7 +372,7 @@ const config = { ], }, prism: { - additionalLanguages: ["java", "rust", "csharp", "php", "elixir", "swift"], + additionalLanguages: ["java", "rust", "csharp", "php", "elixir", "swift", "dart"], theme: lightCodeTheme, darkTheme: darkCodeTheme, }, diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/cache/develop/sdks/dart/cheat-sheet.mdx b/i18n/ja/docusaurus-plugin-content-docs/current/cache/develop/sdks/dart/cheat-sheet.mdx new file mode 100644 index 000000000..780e84ff5 --- /dev/null +++ b/i18n/ja/docusaurus-plugin-content-docs/current/cache/develop/sdks/dart/cheat-sheet.mdx @@ -0,0 +1,74 @@ +--- +sidebar_position: 1 +sidebar_label: Cheat Sheet +sidebar_class_name: sidebar-item-swift +title: Cheat Sheet for Dart +description: Get started really quickly coding using Dart with Momento Cache +--- + +import { SdkExampleCodeBlock } from "@site/src/components/SdkExampleCodeBlock"; +// This import is necessary even though it looks like it's un-used; The inject-example-code-snippet +// plugin will transform instances of SdkExampleCodeBlock to SdkExampleCodeBlockImpl +import { SdkExampleCodeBlockImpl } from "@site/src/components/SdkExampleCodeBlockImpl"; + +# Cheat Sheet for Dart with Momento Cache + +If you need to get going quickly with Dart and Momento Cache, this page contains the basic API calls you'll need. [Check the Dart SDK examples](https://github.com/momentohq/client-sdk-dart/tree/main/examples) for complete, working code samples. + +## Install the Momento SDK + +The latest version of the Momento Dart SDK is available on GitHub: [momentohq/client-sdk-dart](https://github.com/momentohq/client-sdk-dart). + +## Get your Momento API key + +You'll need a Momento API key. You can get one from the [Momento Web Console](https://console.gomomento.com/). +Once you have your token, store it in an environment variable so that the Momento client can consume it: + +``` +export MOMENTO_API_KEY= +``` + +**Note**: it is best practice to put the API key into something like AWS Secret Manager or GCP Secret Manager instead of an environment variable for enhanced security, but we are using one here for demo purposes. + +## Set up a CacheClient +This code creates the CacheClient that you will use to call the other methods. + + + +## Create a new cache in Momento Cache +Use this function to create a new cache in your account. + + + +## List the names of existing caches in your account +A simple list of the names of caches for the account. + + + +## Delete a cache +Use this function to delete a cache from your account. + + + +## Write an item to a cache +A simple example of doing a set operation. In the CacheClient.set() call, the TTL is optional. If you did pass it in, this would override the default TTL value set with the client connection object. + + + +## Read an item from a cache +This is an example of a simple read operation to get an item from a cache. + + + +## Delete an item from a cache +This is an example of deleting an item from a cache. + + + +## Running the code + +You can find complete, working examples in the [Dart SDK GitHub repo examples directory](https://github.com/momentohq/client-sdk-dart/tree/main/examples). + +:::info +Beyond these basic API calls check out the [API reference page](/cache/develop/api-reference/index.mdx) for more information on the full assortment of Momento API calls. +::: diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/cache/develop/sdks/dart/index.md b/i18n/ja/docusaurus-plugin-content-docs/current/cache/develop/sdks/dart/index.md new file mode 100644 index 000000000..cb9d0728a --- /dev/null +++ b/i18n/ja/docusaurus-plugin-content-docs/current/cache/develop/sdks/dart/index.md @@ -0,0 +1,29 @@ +--- +sidebar_position: 7 +title: Momento Dart SDK +pagination_prev: null +sidebar_label: Dart +description: Information about the Momento Dart SDK +--- + +# Momento Swift SDK + +Welcome to the Momento Dart SDK documentation! + +The Momento Dart SDK and source code are available via GitHub: [momentohq/client-sdk-swift](https://github.com/momentohq/client-sdk-swift). + +## Requirements + +- [Dart version 3](https://dart.dev/get-dart) or higher is required. +- A Momento API key is required; you can get one from the [Momento Web Console](https://console.gomomento.com/). + +## Resources + +- [Dart SDK cheat sheet](./cheat-sheet.mdx) +- [Dart SDK examples](https://github.com/momentohq/client-sdk-dart/tree/main/examples): working example projects that illustrate how to use the Dart SDK +- COMING SOON: Observability: Logging and client-side metrics with the Dart SDK +- COMING SOON: Taking your code to prod: configuration and error handling in the Dart SDK + +## Integrations + +COMING SOON diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/cache/getting-started.md b/i18n/ja/docusaurus-plugin-content-docs/current/cache/getting-started.md index c288b0a28..07ca15176 100644 --- a/i18n/ja/docusaurus-plugin-content-docs/current/cache/getting-started.md +++ b/i18n/ja/docusaurus-plugin-content-docs/current/cache/getting-started.md @@ -180,6 +180,7 @@ CLI の最新バージョンとインストール方法、使い方は [この - [Ruby](./develop/sdks/ruby) - [Elixir](./develop/sdks/elixir) - [Swift](./develop/sdks/swift) +- [Dart](./develop/sdks/dart) ## FAQ diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/cache/index.md b/i18n/ja/docusaurus-plugin-content-docs/current/cache/index.md index e9175a403..bd1e6990c 100644 --- a/i18n/ja/docusaurus-plugin-content-docs/current/cache/index.md +++ b/i18n/ja/docusaurus-plugin-content-docs/current/cache/index.md @@ -38,6 +38,7 @@ Momento Cacheは、以下のクラウドプロバイダーおよびリージョ - [Ruby](./cache/develop/sdks/ruby) - [Elixir](./cache/develop/sdks/elixir) - [Swift](./cache/develop/sdks/swift) + - [Dart](./cache/develop/sdks/dart) - アーキテクチャ図用のMomentoのアイコンをお探しですか?[Momento_Architecture_Icons.zip](@site/static/img/icons/Momento_Architecture_Icons.zip)をダウンロードしてください。 diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/topics/develop/sdks/dart/cheat-sheet.mdx b/i18n/ja/docusaurus-plugin-content-docs/current/topics/develop/sdks/dart/cheat-sheet.mdx new file mode 100644 index 000000000..98a562fba --- /dev/null +++ b/i18n/ja/docusaurus-plugin-content-docs/current/topics/develop/sdks/dart/cheat-sheet.mdx @@ -0,0 +1,54 @@ +--- +sidebar_position: 1 +sidebar_label: Topics Cheat Sheet +sidebar_class_name: sidebar-item-swift +title: Topics cheat sheet for Swift +description: Get started really quickly coding using Swift with Momento Topics +--- + +import { SdkExampleCodeBlock } from "@site/src/components/SdkExampleCodeBlock"; +// This import is necessary even though it looks like it's un-used; The inject-example-code-snippet +// plugin will transform instances of SdkExampleCodeBlock to SdkExampleCodeBlockImpl +import { SdkExampleCodeBlockImpl } from "@site/src/components/SdkExampleCodeBlockImpl"; + +# Cheat Sheet for Swift with Momento Topics + +If you need to get going quickly with Swift and Momento Topics, this page contains the basic API calls you'll need. [Check the Swift SDK examples](https://github.com/momentohq/client-sdk-swift/tree/main/Examples) for complete, working code samples. + +## Install the Momento SDK + +The latest version of the Momento Swift SDK is available on GitHub: [momentohq/client-sdk-swift](https://github.com/momentohq/client-sdk-swift). + +## Get your Momento API key + +You'll need a Momento API key. You can get one from the [Momento Web Console](https://console.gomomento.com/). +Once you have your token, store it in an environment variable so that the Momento client can consume it: + +``` +export MOMENTO_API_KEY= +``` + +**Note**: it is best practice to put the API key into something like AWS Secret Manager or GCP Secret Manager instead of an environment variable for enhanced security, but we are using one here for demo purposes. + +## Set up a TopicClient +This code creates the TopicClient that you will use to interact with your pub/sub topic. + + + +## Publish a message to a topic +This is an example of publishing a message to a topic called "topic", then catching the return value to check if the publish was successful. + + + +## Subscribe to a topic +This is an example of subscribing to a topic called "topic", then catching the return value to check if it was successful. If a subscription was received, a `for try await` loop is used to asynchronously receive and print the messages that are published to this topic. + + + +## Running the code + +You can find complete, working examples in the [Swift SDK GitHub repo examples directory](https://github.com/momentohq/client-sdk-swift/tree/main/examples). + +:::info +Beyond these basic API calls check out the [API reference page](./../../api-reference) for more information on the full assortment of Momento API calls. +::: diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/topics/develop/sdks/dart/index.md b/i18n/ja/docusaurus-plugin-content-docs/current/topics/develop/sdks/dart/index.md new file mode 100644 index 000000000..55fc88a16 --- /dev/null +++ b/i18n/ja/docusaurus-plugin-content-docs/current/topics/develop/sdks/dart/index.md @@ -0,0 +1,29 @@ +--- +sidebar_position: 7 +title: Momento Topics Dart SDK +pagination_prev: null +sidebar_label: Dart +description: Information about the Momento Dart SDK +--- + +# Momento Topics Dart SDK + +Welcome to the Momento Dart SDK documentation! + +The Momento Dart SDK and source code are available via GitHub: [momentohq/client-sdk-swift](https://github.com/momentohq/client-sdk-dart). + +## Requirements + +- [Dart version 3](https://dart.dev/get-dart) or higher is required. +- A Momento API key is required; you can get one from the [Momento Web Console](https://console.gomomento.com/). + +## Resources + +- [Dart SDK cheat sheet](./cheat-sheet.mdx) +- [Dart SDK examples](https://github.com/momentohq/client-sdk-dart/tree/main/examples): working example projects that illustrate how to use the Dart SDK +- COMING SOON: Observability: Logging and client-side metrics with the Dart SDK +- COMING SOON: Taking your code to prod: configuration and error handling in the Dart SDK + +## Integrations + +COMING SOON diff --git a/plugins/example-code-snippets/src/api-support/api-support-matrix-generator.ts b/plugins/example-code-snippets/src/api-support/api-support-matrix-generator.ts index 9c4638c46..b66f6405c 100644 --- a/plugins/example-code-snippets/src/api-support/api-support-matrix-generator.ts +++ b/plugins/example-code-snippets/src/api-support/api-support-matrix-generator.ts @@ -121,6 +121,14 @@ const SDKS: Array = [ authClientFile: undefined, leaderboardClientFile: undefined, }, + { + sdk: Sdk.DART, + cacheClientFile: 'lib/src/cache_client.dart', + configObjectFile: 'lib/src/config/cache_configuration.dart', + topicClientFile: 'lib/src/topic_client.dart', + authClientFile: undefined, + leaderboardClientFile: undefined, + }, ]; type Api = string | {displayName: string; functionName: string | RegExp}; diff --git a/plugins/example-code-snippets/src/examples/examples.ts b/plugins/example-code-snippets/src/examples/examples.ts index 73832970a..2b74af498 100644 --- a/plugins/example-code-snippets/src/examples/examples.ts +++ b/plugins/example-code-snippets/src/examples/examples.ts @@ -15,6 +15,7 @@ export enum ExampleLanguage { RUBY = 'ruby', ELIXIR = 'elixir', SWIFT = 'swift', + DART = 'dart', CLI = 'cli', } @@ -57,6 +58,8 @@ export function languageDisplayName(language: ExampleLanguage): string { return 'Elixir'; case ExampleLanguage.SWIFT: return 'Swift'; + case ExampleLanguage.DART: + return 'Dart'; case ExampleLanguage.CLI: return 'CLI'; default: diff --git a/plugins/example-code-snippets/src/examples/resolvers/sdk-repo-snippet-resolver.ts b/plugins/example-code-snippets/src/examples/resolvers/sdk-repo-snippet-resolver.ts index a1f186730..3257a192e 100644 --- a/plugins/example-code-snippets/src/examples/resolvers/sdk-repo-snippet-resolver.ts +++ b/plugins/example-code-snippets/src/examples/resolvers/sdk-repo-snippet-resolver.ts @@ -13,6 +13,7 @@ import {PhpSnippetSourceParser} from './source-parsers/languages/php-snippet-sou import {JavaSnippetSourceParser} from './source-parsers/languages/java-snippet-source-parser'; import {ElixirSnippetSourceParser} from './source-parsers/languages/elixir-snippet-source-parser'; import {SwiftSnippetSourceParser} from './source-parsers/languages/swift-snippet-source-parser'; +import {DartSnippetSourceParser} from './source-parsers/languages/dart-snippet-source-parser'; export class SdkRepoSnippetResolver implements SnippetResolver { private readonly sourceProvider: SdkSourceProvider = @@ -92,6 +93,8 @@ export class SdkRepoSnippetResolver implements SnippetResolver { return new ElixirSnippetSourceParser(sourceDir); case ExampleLanguage.SWIFT: return new SwiftSnippetSourceParser(sourceDir); + case ExampleLanguage.DART: + return new DartSnippetSourceParser(sourceDir); case ExampleLanguage.RUST: return undefined; case ExampleLanguage.RUBY: @@ -129,6 +132,8 @@ function sdkForLanguage(language: ExampleLanguage): Sdk { return Sdk.ELIXIR; case ExampleLanguage.SWIFT: return Sdk.SWIFT; + case ExampleLanguage.DART: + return Sdk.DART; case ExampleLanguage.CLI: return Sdk.CLI; default: diff --git a/plugins/example-code-snippets/src/examples/resolvers/source-parsers/languages/dart-snippet-source-parser.ts b/plugins/example-code-snippets/src/examples/resolvers/source-parsers/languages/dart-snippet-source-parser.ts new file mode 100644 index 000000000..a0c50078d --- /dev/null +++ b/plugins/example-code-snippets/src/examples/resolvers/source-parsers/languages/dart-snippet-source-parser.ts @@ -0,0 +1,35 @@ +import { + RegexSnippetSourceParser, + RegexSnippetTypeOptions, +} from '../regex-snippet-source-parser'; +import {ExampleSnippetType} from '../../../examples'; +import * as path from 'path'; + +export class DartSnippetSourceParser extends RegexSnippetSourceParser { + constructor(repoSourceDir: string) { + const wholeFileExamplesDir = 'examples/'; + const codeSnippetFiles: Array = [ + 'example/doc_example_apis/doc_example_apis.dart', + ]; + super({ + wholeFileExamplesDir: path.join(repoSourceDir, wholeFileExamplesDir), + snippetTypeParseOptions: new Map< + ExampleSnippetType, + RegexSnippetTypeOptions + >([ + [ + ExampleSnippetType.CODE, + { + snippetSourceFiles: codeSnippetFiles.map(f => + path.join(repoSourceDir, f) + ), + startRegex: snippetId => + new RegExp(`^Future example_${snippetId.valueOf()}\\(`), + endRegex: () => /^}/, + numLeadingSpacesToStrip: 2, + }, + ], + ]), + }); + } +} diff --git a/plugins/example-code-snippets/src/examples/sdk-source/sdk-github-repo-source-provider.ts b/plugins/example-code-snippets/src/examples/sdk-source/sdk-github-repo-source-provider.ts index 571040f8d..238df01cd 100644 --- a/plugins/example-code-snippets/src/examples/sdk-source/sdk-github-repo-source-provider.ts +++ b/plugins/example-code-snippets/src/examples/sdk-source/sdk-github-repo-source-provider.ts @@ -35,6 +35,8 @@ export function githubRepoNameForSdk(sdk: Sdk): string { return 'client-sdk-elixir'; case Sdk.SWIFT: return 'client-sdk-swift'; + case Sdk.DART: + return 'client-sdk-dart'; case Sdk.CLI: return 'momento-cli'; default: diff --git a/plugins/example-code-snippets/src/examples/sdk-source/sdks.ts b/plugins/example-code-snippets/src/examples/sdk-source/sdks.ts index e22fe2842..81c4d6951 100644 --- a/plugins/example-code-snippets/src/examples/sdk-source/sdks.ts +++ b/plugins/example-code-snippets/src/examples/sdk-source/sdks.ts @@ -13,6 +13,7 @@ export enum Sdk { RUBY = 'ruby', ELIXIR = 'elixir', SWIFT = 'swift', + DART = 'dart', CLI = 'cli', } @@ -40,6 +41,8 @@ export function sdkDisplayName(sdk: Sdk): string { return 'Elixir'; case Sdk.SWIFT: return 'Swift'; + case Sdk.DART: + return 'Dart'; case Sdk.CLI: return 'Cli'; default: diff --git a/plugins/example-code-snippets/src/inject-example-code-snippets.ts b/plugins/example-code-snippets/src/inject-example-code-snippets.ts index 05eb3bbeb..e56988b2c 100644 --- a/plugins/example-code-snippets/src/inject-example-code-snippets.ts +++ b/plugins/example-code-snippets/src/inject-example-code-snippets.ts @@ -75,6 +75,7 @@ function replaceValueWithExampleTabs(literal: unist.Literal): void { ruby={\`${snippetForLanguage(ExampleLanguage.RUBY, snippetId)}\`} elixir={\`${snippetForLanguage(ExampleLanguage.ELIXIR, snippetId)}\`} swift={\`${snippetForLanguage(ExampleLanguage.SWIFT, snippetId)}\`} + dart={\`${snippetForLanguage(ExampleLanguage.DART, snippetId)}\`} cli={\`${snippetForLanguage(ExampleLanguage.CLI, snippetId)}\`} /> `; @@ -93,6 +94,7 @@ function replaceValueWithExampleFileTabs(literal: unist.Literal): void { ruby={\`${fileTabContentsForLanguage(value, ExampleLanguage.RUBY)}\`} elixir={\`${fileTabContentsForLanguage(value, ExampleLanguage.ELIXIR)}\`} swift={\`${fileTabContentsForLanguage(value, ExampleLanguage.SWIFT)}\`} + dart={\`${fileTabContentsForLanguage(value, ExampleLanguage.DART)}\`} cli={\`${fileTabContentsForLanguage(value, ExampleLanguage.CLI)}\`} /> `; diff --git a/src/components/SdkExampleFileTabs/index.jsx b/src/components/SdkExampleFileTabs/index.jsx index d17fa0d59..989333879 100644 --- a/src/components/SdkExampleFileTabs/index.jsx +++ b/src/components/SdkExampleFileTabs/index.jsx @@ -11,6 +11,6 @@ import React from 'react'; * @param snippetId: string * @constructor */ -export const SdkExampleFileTabs = ({javascript, python, java, go, csharp, php, rust, ruby, elixir, swift, cli}) => {}; +export const SdkExampleFileTabs = ({javascript, python, java, go, csharp, php, rust, ruby, elixir, swift, dart, cli}) => {}; diff --git a/src/components/SdkExampleFileTabsImpl/index.jsx b/src/components/SdkExampleFileTabsImpl/index.jsx index 25acf49d2..4e5ee789b 100644 --- a/src/components/SdkExampleFileTabsImpl/index.jsx +++ b/src/components/SdkExampleFileTabsImpl/index.jsx @@ -20,12 +20,13 @@ import React from 'react'; * @param ruby * @param elixir * @param swift + * @param dart * @param cli * @returns {JSX.Element|null} * @constructor */ -export const SdkExampleFileTabsImpl = ({js, python, java, go, csharp, php, rust, ruby, elixir, swift, cli}) => { - if (js || python || java || go || csharp || php || rust || ruby || elixir || swift || cli) { +export const SdkExampleFileTabsImpl = ({js, python, java, go, csharp, php, rust, ruby, elixir, swift, dart, cli}) => { + if (js || python || java || go || csharp || php || rust || ruby || elixir || swift || dart || cli) { return ( {js && @@ -68,6 +69,10 @@ export const SdkExampleFileTabsImpl = ({js, python, java, go, csharp, php, rust, {swift} } + {dart && + + {dart} + } {cli && {cli} diff --git a/src/components/SdkExampleTabsImpl/index.jsx b/src/components/SdkExampleTabsImpl/index.jsx index f4d1736b3..7039248d1 100644 --- a/src/components/SdkExampleTabsImpl/index.jsx +++ b/src/components/SdkExampleTabsImpl/index.jsx @@ -20,12 +20,13 @@ import React from 'react'; * @param ruby * @param elixir * @param swift + * @param dart * @param cli * @returns {JSX.Element|null} * @constructor */ -export const SdkExampleTabsImpl = ({js, python, java, go, csharp, php, rust, ruby, elixir, swift, cli}) => { - if (js || python || java || go || csharp || php || rust || ruby || elixir || swift || cli) { +export const SdkExampleTabsImpl = ({js, python, java, go, csharp, php, rust, ruby, elixir, swift, dart, cli}) => { + if (js || python || java || go || csharp || php || rust || ruby || elixir || swift || dart || cli) { return ( {js && @@ -68,6 +69,10 @@ export const SdkExampleTabsImpl = ({js, python, java, go, csharp, php, rust, rub {swift} } + {dart && + + {dart} + } {cli && {cli}