/aws-incentives-api-rs

A Rust service for using the Amazon Gift Card API

Primary LanguageRustApache License 2.0Apache-2.0

AWS Incentives API

A Rust service for using the Amazon Gift Card API (aka. Amazon Incentives API) to generate Amazon gift cards.

This library implements the AWS Signature Version 4 signature algorithm.

"Every request to an endpoint of the Incentives API must be digitally signed using your Incentives API security credentials and the Signature Version 4 signature algorithm. Signing correctly using Signature Version 4 can be the toughest hurdle when calling Incentives API endpoints."

Usage

Using the service is simple. Instantiate the service with the following credentials, then call the .generate() method to generate a new giftcard code:

  • PartnerID
  • AWS Incentives API Access Key
  • AWS Incentives API Secret Key
  • AWS Incentives API Hostname
  • AWS Incentives API URL
let service = new_service(
    "PartnerID".to_string(),
    "AccessKey".to_string(),
    "SecretKey".to_string(),
    "agcod-v2-gamma.amazon.com".to_string(),         // Sandbox Host
    "https://agcod-v2-gamma.amazon.com".to_string(), // Sandbox URL
    "us-east-1",                                     // AWS Region
);
let giftcard_code = match service.generate().await {
    Ok(code) => {
        println!("successfully generated a giftcard code: {}", code)
    }
    Err(err) => {
        panic!("failed to generate giftcard code: {}", err)
    }
};