public static function setAccountById($number) { if (!isset(KeysAndSecrets::$clients[$number])) { die("That client id isn't configured yet. Try running SetupApiAccounts.sh to add more.\n"); } else { KeysAndSecrets::$number = $number; KeysAndSecrets::$key = KeysAndSecrets::$clients[$number]["key"]; KeysAndSecrets::$secret = KeysAndSecrets::$clients[$number]["secret"]; KeysAndSecrets::$name = KeysAndSecrets::$clients[$number]["name"]; KeysAndSecrets::$environment = KeysAndSecrets::$clients[$number]["environment"]; } }
<?php // Base Script to be copied then modified. // COPY THEN MODIFY require_once dirname(__DIR__) . "/Classes/Api/Account_Credentials/KeysAndSecrets.php"; $account_credentials = new KeysAndSecrets(); $account_credentials->setAccount(); //START CALL SPECIFIC require_once dirname(__DIR__) . "/Classes/Api/List/ListGet.php"; //Call Specifc//Incomplete// $api_object = new ListGet(); //Call Specifc//Incomplete// $api_object->setAccount($account_credentials); include_once dirname(__DIR__) . "/Use_Case_Vars/ListGetVars.php"; //Call Specifc//Incomplete// //END CALL SPECIFIC require_once dirname(__DIR__) . "/Classes/CliScriptAbstract.php"; $script = new CliScriptAbstract(); require_once dirname(__DIR__) . "/Classes/Client_Library/Sailthru_Implementation_Client.php"; include_once dirname(__DIR__) . "/Setup_Files/ScriptSettings.php"; new ScriptSettings(); //////////////////// VARS /* There are three ways to input vars for a script: 1) Thorugh the Command Line Interface, CLI, when you run the script. 2) The vars array in this file. 3) An include file specific to this script. The Use_Vase_Vars include above. While they are essentially equivalent, The Use Case include is the prefered method. The other two are provided to give ease of use in a given situation. They can also be used in conjunction -with each overridden by the next in the order given above. That means if you add two vars, a & b, to the use case
<?php // Base Script to be copied then modified. // COPY THEN MODIFY ini_set("auto_detect_line_endings", true); $bad_zephyr_functions = array(preg_quote("filter("), preg_quote("slice("), preg_quote("sort("), preg_quote("bucket_list("), preg_quote("filter_content("), preg_quote("content_intersect("), preg_quote("intersect("), preg_quote("first("), preg_quote("map("), preg_quote("purchased_items("), preg_quote("push("), preg_quote("values(")); require_once dirname(dirname(__DIR__)) . "/Classes/Api/Account_Credentials/KeysAndSecrets.php"; $account_credentials = new KeysAndSecrets(); $account_credentials->setAccount(); // Create API Objects require_once dirname(dirname(__DIR__)) . "/Classes/Api/Template/TemplateGet.php"; $template_get = new TemplateGet(); $template_get->setAccount($account_credentials); require_once dirname(dirname(__DIR__)) . "/Classes/Api/Include/IncludeGet.php"; $include_get = new IncludeGet(); $include_get->setAccount($account_credentials); // End Create API Objects require_once dirname(dirname(__DIR__)) . "/Classes/CliScriptAbstract.php"; $script = new CliScriptAbstract(); require_once dirname(dirname(__DIR__)) . "/Classes/Client_Library/Sailthru_Implementation_Client.php"; include_once dirname(dirname(__DIR__)) . "/Setup_Files/ScriptSettings.php"; new ScriptSettings(); //Read in CLI Vars //Add new parameters to print out in the help screen that are exclusive to this custom Script. Can use the simpler format here or the format api classes use. // $cli_params = ["example" => "What example should be used to do"]; // $api_object->createCliParameters($cli_params); $template_get->setDescription("Return a how compatible a given template is, or an Account's templates are, with regards to Pinning."); $input_vars = $script->readCliArguments($argv, $template_get); $template_get->ingestInput($input_vars["config_vars"] + $input_vars["wildcard_vars"], CliScriptAbstract::$flags["isOverride"]); //Validates and Assigns Vars //////////////////// START MAIN PROGRAM