Skip to content
Mostey edited this page Sep 30, 2014 · 1 revision

Transactions

For retrieving your elite*gold transactions, the user-defined SecretWord is required. In order to access the resources, you need to specify your secret word first using the session.User.TBMProfile.SecretWord property.

If the secret word has been rejected by the system, an InvalidAuthenticationException will be thrown.

Retrieving recorded transactions

The library is capable of retrieving the recorded transactions for a given profile using the official TBM API. You are required to set your secret word in order to authenticate. Besides that, you can parse the recorded transactions of other users (= profiles) if you know their secret word.

You can choose whether to get all of your transactions, only received transactions or only sent transactions by providing the correct Transaction.Query flag.

session.User.TBMProfile.SecretWord = "mysecretword";
foreach(var transaction in session.User.TBMProfile.GetTransactions(session, Transaction.Query.Received))
    Console.WriteLine(transaction.EliteGold);

This sample code will retrieve only the received transactions and print the amount of elite*gold involved to the screen. For retrieving only the sent transactions, use the Transaction.Query.Sent flag. If you want to retrieve all transactions, xor both flags: Transaction.Query.Received | Transaction.Query.Sent.


Treasures

Creation

Treasures can be created using the Treasure.Create function as follows:

var treasure = new Treasure("Title", "Content", 500);
treasure.Create(session);

The sample code above will remotely create the treasure with the title, content and value given in the constructor.

Deletion

If you are the seller of the treasure, you may delete it safely in case it hasn't been purchased yet. Simply call the Treasure.Delete function that requires a valid treasure id as follows:

var treasure = new Treasure(555234);
treasure.Delete(session);

Replace 555234 with your treasure id.

Updating information

For updating a treasure, you can use the Treasure.Update function. Please note that the treasure id needs to be provided.

var treasure = new Treasure(432423);
treasure.Update(session);

Replace 432423 with your treasure id.

Affected properties

The following Treasure properties are currently implemented to be updated on execution:

  • Title as string
  • Content as Content (if you're either the seller or buyer of this treasure, otherwise this will always be empty)
  • Seller as User
  • Buyer as User (if any)
  • Cost as uint
  • CreationDate as DateTime
  • PurchaseDate as DateTime (if available)