SnipeSDK Documentation

Introduction

Welcome to the SnipeSDK documentation! The SnipeSDK is a Dart library that provides a convenient way to interact with the Snipe API for token management, event tracking, and other related functionalities. This documentation will guide you through the setup, available methods, and usage examples of the SnipeSDK.

Getting Started

Installation

To use the SnipeSDK in your Dart project, add the following dependency to your pubspec.yaml file:

dependencies:
  snipe_sdk_flutter: ^0.0.1

Then, run:

flutter pub get

Or:

flutter pub add snipe_sdk_flutter 

Initialization

Before using the SnipeSDK, you need to initialize it with your API key using the init method:

import 'package:snipesdk/snipesdk.dart';

void main() {
  SnipeSdk snipeSdk = SnipeSdk();
  snipeSdk.init("your_api_key_here");
}

Methods

1. signUp(String hash)

This method allows you to sign up a user with a given hash.

try {
  String output = await snipeSdk.signUp("user_hash");
  print("Sign up response: $output");
} catch (error) {
  print("Error: $error");
}

2. trackEvent(...)

This method allows you to track an event with various parameters such as eventId, snipeId, transactionAmount, partialPercentage, and debitTokens.

try {
  dynamic response = await snipeSdk.trackEvent(
    eventId: "event_id",
    snipeId: "user_snipe_id",
    transactionAmount: 100,
    partialPercentage: 50,
    debitTokens: [{"token_id": "token1", "value": 20}],
  );
  print("Track event response: $response");
} catch (error) {
  print("Error: $error");
}

3. getTokenHistory(String snipeId)

This method retrieves the token history for a specific user.

try {
  dynamic response = await snipeSdk.getTokenHistory("user_snipe_id");
  print("Token history response: $response");
} catch (error) {
  print("Error: $error");
}

4. getTokenDetails(String snipeId)

This method retrieves details of all tokens associated with a specific user.

try {
  dynamic response = await snipeSdk.getTokenDetails("user_snipe_id");
  print("Token details response: $response");
} catch (error) {
  print("Error: $error");
}

5. getCoinData(String snipeId)

This method retrieves coin data for a specific user.

try {
  dynamic response = await snipeSdk.getCoinData("user_snipe_id");
  print("Coin data response: $response");
} catch (error) {
  print("Error: $error");
}

6. getStreaks(String snipeId)

This method retrieves streaks for a specific user.

try {
  dynamic response = await snipeSdk.getStreaks("user_snipe_id");
  print("Streaks response: $response");
} catch (error) {
  print("Error: $error");
}

Conclusion

Congratulations! You've successfully integrated the SnipeSDK into your Dart project. This documentation should serve as a helpful guide for utilizing the available methods and understanding their parameters. If you encounter any issues or have further questions, feel free to reach out to the Snipe support team. Happy coding!

Libraries

snipe_sdk_flutter