xerotic

HF API v2 Writable Field List

Jun 9th, 2020
1,137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.59 KB | None | 0 0
  1. <?php
  2.  
  3. require_once "hf_api.php";
  4.  
  5. // Initialize api instance
  6. $api = new HF_API();
  7.  
  8. // Set the access token for the specific authorized member
  9. $api->setAccessToken("ACCESS_TOKEN_HERE");
  10.  
  11. // Let's make a post
  12. $write = $api->write([
  13.     "posts" => [ // Posts Write Permissions
  14.         '_tid' => "THREAD_ID",
  15.         '_message' => "POST_MESSAGE",
  16.     ]
  17. ]);
  18.  
  19.  
  20. // Let's make a thread
  21. $write = $api->write([
  22.     "threads" => [ // Posts Write Permissions
  23.         '_fid' => "FORUM_ID",
  24.         '_subject' => "THREAD_SUBJECT",
  25.         '_message' => "FIRST_POST_MESSAGE",
  26.     ]
  27. ]);
  28.  
  29.  
  30. // Let's send a bytes donation
  31. $write = $api->write([
  32.     "bytes" => [ // Bytes Write Permissions
  33.         '_uid' => "USER_ID_RECIPIENT",
  34.         '_amount' => "DONATION_AMOUNT",
  35.         '_reason' => "OPTIONAL_DONATION_REASON",
  36.         '_pid' => "OPTIONAL_POST_ID"
  37.     ]
  38. ]);
  39.  
  40.  
  41. // Deposit to API Client Vault (min: 100)
  42. $write = $api->write([
  43.     "bytes" => [ // Bytes Write Permissions
  44.         '_deposit' => "DEPOSIT_AMOUNT"
  45.     ]
  46. ]);
  47.  
  48.  
  49. // Withdraw from API Client Vault to authorized user (min: 100)
  50. $write = $api->write([
  51.     "bytes" => [ // Bytes Write Permissions
  52.         '_withdraw' => "WITHDRAW_AMOUNT"
  53.     ]
  54. ]);
  55.  
  56.  
  57. // Create a new contract
  58. $write = $api->write([
  59.     "contracts" => [ // Bytes Write Permissions
  60.         '_action' => "new",
  61.         '_uid' => "OTHER_USER_ID",
  62.         '_theirproduct' => "OPTIONAL_OTHER_USER_PRODUCT",
  63.         '_theircurrency' => "OPTIONAL_OTHER_USER_CURRENCY",
  64.         '_theiramount' => "OPTIONAL_OTHER_USER_AMOUNT",
  65.         '_theirproduct' => "OPTIONAL_OTHER_USER_PRODUCT",
  66.         '_theircurrency' => "OPTIONAL_OTHER_USER_CURRENCY",
  67.         '_theiramount' => "OPTIONAL_OTHER_USER_AMOUNT",
  68.         '_tid' => "OPTIONAL_THREAD_ID",
  69.         '_muid' => "OPTIONAL_MIDDLEMAN_USER_ID",
  70.         '_timeout' => "OPTIONAL_CONTRACT_TIMEOUT",
  71.         '_position' => "YOUR_POSITION_IN_CONTRACT",
  72.         '_terms' => "CONTRACT_TERMS",
  73.         '_public' => "yes", // "yes" or omit for private
  74.         '_address' => "OPTIONAL_PAYMENT_ADDRESS"
  75.     ]
  76. ]);
  77.  
  78.  
  79. // Undo a newly created contract
  80. $write = $api->write([
  81.     "contracts" => [ // Bytes Write Permissions
  82.         '_action' => "undo",
  83.         '_cid' => "CONTRACT_ID"
  84.     ]
  85. ]);
  86.  
  87.  
  88. // Deny a new contract
  89. $write = $api->write([
  90.     "contracts" => [ // Bytes Write Permissions
  91.         '_action' => "deny",
  92.         '_cid' => "CONTRACT_ID"
  93.     ]
  94. ]);
  95.  
  96.  
  97. // Approve a new contract
  98. $write = $api->write([
  99.     "contracts" => [ // Bytes Write Permissions
  100.         '_action' => "approve",
  101.         '_cid' => "CONTRACT_ID",
  102.         '_address' => "OPTIONAL_PAYMENT_ADDRESS"
  103.     ]
  104. ]);
  105.  
  106.  
  107. // Deny a contract as middleman
  108. $write = $api->write([
  109.     "contracts" => [ // Bytes Write Permissions
  110.         '_action' => "middleman_deny",
  111.         '_cid' => "CONTRACT_ID"
  112.     ]
  113. ]);
  114.  
  115.  
  116. // Approve a contract as middleman
  117. $write = $api->write([
  118.     "contracts" => [ // Bytes Write Permissions
  119.         '_action' => "middleman_approve",
  120.         '_cid' => "CONTRACT_ID"
  121.     ]
  122. ]);
  123.  
  124.  
  125. // Cancel as contract (spawned from contract template) as Vendor
  126. $write = $api->write([
  127.     "contracts" => [ // Bytes Write Permissions
  128.         '_action' => "vendor_cancel",
  129.         '_cid' => "CONTRACT_ID"
  130.     ]
  131. ]);
  132.  
  133.  
  134. // Request cancel (requires both parties to cancel)
  135. $write = $api->write([
  136.     "contracts" => [ // Bytes Write Permissions
  137.         '_action' => "cancel",
  138.         '_cid' => "CONTRACT_ID"
  139.     ]
  140. ]);
  141.  
  142.  
  143. // Mark a contract as complete
  144. $write = $api->write([
  145.     "contracts" => [ // Bytes Write Permissions
  146.         '_action' => "complete",
  147.         '_cid' => "CONTRACT_ID",
  148.         '_txn' => "OPTIONAL_TXN"
  149.     ]
  150. ]);
Add Comment
Please, Sign In to add comment