NotCoffee418 / MultiTablePro

Advanced mass multi-tabling software
Creative Commons Zero v1.0 Universal
4 stars 0 forks source link

Licensing system & API connection #43

Open NotCoffee418 opened 5 years ago

NotCoffee418 commented 5 years ago

These should all send POST requests to their corresponding API url: Response is in json array. Just call it, call json deserialize and roll use the output. All responses look like this: array( 'result' => array(), 'errors' => array(), );

check if response contains errors before anything else (errors exists at all rather) errors: array("error strings", "other error") call Logger.Log() to display errors to user, or show em in the window

All relevant return data is contained in the "result" variable

/api/validate_license Post params: macaddr - mac address string license_key - (should be 'TRIAL' for trial check, all caps) request_product_group - should be 1 for MTP

Return is_active - int (0 or 1) (basically true or false but DB outputs tinyint) expires_at - time string (DateTime.Parse()) ^ Only these return on trial check

for non trial it also adds: 'product_name' => $r->product_name, 'product_description' => $r->product_description, 'first_name' => $r->first_name, 'last_name' => $r->last_name, 'email' => $r->email, 'restrictions' => $restrictions, // described below 'license_status_message' => 'Active license',

restrictions - array ( - not all keys may exist, so check if they do first - they all return as string (probably) UNLIMITED_COMPUTERS - bool MAX_STAKE - int of max buyin (Table.BigBlind x 100) BUILD_TYPE - enum("RELEASE", "INTERNAL", "BETA") (so string basically) - indicates optional access to non-release builds )

NotCoffee418 commented 5 years ago

/api/get_latest_version/multitable-pro(/beta) output in json:

array(2) {
  ["requested_version"]=>
  object(stdClass)#24 (7) {
    ["version_id"]=>
    string(1) "4"
    ["branch"]=>
    string(7) "RELEASE"
    ["version"]=>
    string(7) "1.0.0.1"
    ["release_date"]=>
    string(19) "2019-03-14 04:29:55"
    ["changelog"]=>
    NULL
    ["product_group_id"]=>
    string(1) "1"
    ["product_group_full_name"]=>
    string(14) "MultiTable Pro"
  }
  ["older_versions"]=>
  array(1) {
    [0]=>
    object(stdClass)#27 (7) {
      ["version_id"]=>
      string(1) "3"
      ["branch"]=>
      string(7) "RELEASE"
      ["version"]=>
      string(7) "1.0.0.0"
      ["release_date"]=>
      string(19) "2019-03-14 10:10:45"
      ["changelog"]=>
      string(4) "test"
      ["product_group_id"]=>
      string(1) "1"
      ["product_group_full_name"]=>
      string(14) "MultiTable Pro"
    }
  }
}

Invalid input or not found simply returns the whole thing as null

NotCoffee418 commented 5 years ago

/download:

/*
 * /Download page
 * $productGroupShort - Null will grab the first product in database
 * $branch - RELEASE, BETA, or INTERNAL (not case sensitive
 * $version - Assembly version eg 1.0.0.5
 * $downloadType -
 *      "view" display information about the version
 *      "setup" direct access to the version's setup file
 *      "update" direct access to the version's update files
 *
 * examples:
 * /download - displays download info for latest release version
 * /download/release/latest/setup - downloads the setup file
 * /download/beta/1.0.1.200 - displays info for a specific beta build if it's available
deMathias commented 5 years ago

/api/get_latest_version/multitable-pro(/beta) output in json:

array(2) {
  ["requested_version"]=>
  object(stdClass)#24 (7) {
    ["version_id"]=>
    string(1) "4"
    ["branch"]=>
    string(7) "RELEASE"
    ["version"]=>
    string(7) "1.0.0.1"
    ["release_date"]=>
    string(19) "2019-03-14 04:29:55"
    ["changelog"]=>
    NULL
    ["product_group_id"]=>
    string(1) "1"
    ["product_group_full_name"]=>
    string(14) "MultiTable Pro"
  }
  ["older_versions"]=>
  array(1) {
    [0]=>
    object(stdClass)#27 (7) {
      ["version_id"]=>
      string(1) "3"
      ["branch"]=>
      string(7) "RELEASE"
      ["version"]=>
      string(7) "1.0.0.0"
      ["release_date"]=>
      string(19) "2019-03-14 10:10:45"
      ["changelog"]=>
      string(4) "test"
      ["product_group_id"]=>
      string(1) "1"
      ["product_group_full_name"]=>
      string(14) "MultiTable Pro"
    }
  }
}

Invalid input or not found simply returns the whole thing as null

Keep getting 404 not found.

NotCoffee418 commented 5 years ago

@deMathias It's fixed. Happened because there are no published versions. Added a non-functional build for testing.