-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: create readme file to help with package integration
- Loading branch information
1 parent
7b4a501
commit 6b5e6e7
Showing
3 changed files
with
70 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,79 @@ | ||
<!-- | ||
This README describes the package. If you publish this package to pub.dev, | ||
this README's contents appear on the landing page for your package. | ||
# Dart CAC Client | ||
|
||
For information about how to write a good package README, see the guide for | ||
[writing package pages](https://dart.dev/guides/libraries/writing-package-pages). | ||
This package provides a Dart interface for the CAC (Configuration as Code) client, allowing you to interact with the CAC server to retrieve and manage configurations. | ||
|
||
For general information about developing packages, see the Dart guide for | ||
[creating packages](https://dart.dev/guides/libraries/create-library-packages) | ||
and the Flutter guide for | ||
[developing packages and plugins](https://flutter.dev/developing-packages). | ||
--> | ||
## Table of Contents | ||
- [Dart CAC Client](#dart-cac-client) | ||
- [Table of Contents](#table-of-contents) | ||
- [Installation](#installation) | ||
- [Usage](#usage) | ||
- [Creating a Client](#creating-a-client) | ||
- [Starting Polling for Updates](#starting-polling-for-updates) | ||
- [Retrieving Configurations](#retrieving-configurations) | ||
- [Getting Default Configurations](#getting-default-configurations) | ||
- [Getting Resolved Configurations](#getting-resolved-configurations) | ||
- [Getting Last Modified Timestamp](#getting-last-modified-timestamp) | ||
- [Disposing the Client](#disposing-the-client) | ||
|
||
TODO: Put a short description of the package here that helps potential users | ||
know whether this package might be useful for them. | ||
## Installation | ||
|
||
## Features | ||
Add the following dependency to your `pubspec.yaml` file: | ||
|
||
TODO: List what your package can do. Maybe include images, gifs, or videos. | ||
```yaml | ||
dependencies: | ||
dart_cac_client: | ||
git: | ||
url: [email protected]:your_repo/dart_cac_client.git | ||
``` | ||
## Getting started | ||
## Usage | ||
TODO: List prerequisites and provide or point to information on how to | ||
start using the package. | ||
### Creating a Client | ||
To create a new CAC client, instantiate the DartCacClient class with the tenant name, update frequency (in seconds), and host URL | ||
## Usage | ||
```dart | ||
final client = DartCacClient('dev', 60, 'http://localhost:8080'); | ||
``` | ||
|
||
### Starting Polling for Updates | ||
Use the cacStartPolling method to start polling for configuration updates for the specified tenant: | ||
|
||
```dart | ||
client.cacStartPolling("<tenant name>"); | ||
``` | ||
|
||
### Retrieving Configurations | ||
Use the getConfigs method to retrieve configurations based on a filter query and filter prefix: | ||
```dart | ||
String configs = client.getConfigs('{"country": "India"}', 'country'); | ||
``` | ||
|
||
TODO: Include short and useful examples for package users. Add longer examples | ||
to `/example` folder. | ||
### Getting Default Configurations | ||
Use the getDefaultConfig method to retrieve the default configurations for the specified keys: | ||
|
||
```dart | ||
const like = 'sample'; | ||
String defaultConfigs = client.getDefaultConfig("india"); | ||
``` | ||
|
||
## Additional information | ||
### Getting Resolved Configurations | ||
Use the getResolvedConfig method to retrieve resolved configurations based on the provided query, keys, and merge strategy: | ||
|
||
TODO: Tell users more about the package: where to find more information, how to | ||
contribute to the package, how to file issues, what response they can expect | ||
from the package authors, and more. | ||
|
||
```dart | ||
String resolvedConfigs = client.getResolvedConfig( | ||
'{"query": "example"}', "key1, key2", MergeStrategy.MERGE/MergeStrategy.REPLACE); | ||
``` | ||
|
||
|
||
### Getting Last Modified Timestamp | ||
Use the getCacLastModified method to get the last modified timestamp of the configurations: | ||
|
||
```dart | ||
String lastModified = client.getCacLastModified(); | ||
``` | ||
|
||
### Disposing the Client | ||
Ensure that you dispose of the client properly to free up resources: | ||
```dart | ||
client.dispose(); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters