diff --git a/api/v3/TwingleCampaign/Create.php b/api/v3/TwingleCampaign/Create.php new file mode 100644 index 0000000..f276bdf --- /dev/null +++ b/api/v3/TwingleCampaign/Create.php @@ -0,0 +1,45 @@ + ['id' => 12, 'name' => 'Twelve'], + 34 => ['id' => 34, 'name' => 'Thirty four'], + 56 => ['id' => 56, 'name' => 'Fifty six'], + ); + // ALTERNATIVE: $returnValues = []; // OK, success + // ALTERNATIVE: $returnValues = ["Some value"]; // OK, return a single value + + // Spec: civicrm_api3_create_success($values = 1, $params = [], $entity = NULL, $action = NULL) + return civicrm_api3_create_success($returnValues, $params, 'TwingleCampaign', 'Create'); + } + else { + throw new API_Exception(/*error_message*/ 'Everyone knows that the magicword is "sesame"', /*error_code*/ 'magicword_incorrect'); + } +} diff --git a/api/v3/TwingleCampaign/Get.php b/api/v3/TwingleCampaign/Get.php new file mode 100644 index 0000000..90b7f98 --- /dev/null +++ b/api/v3/TwingleCampaign/Get.php @@ -0,0 +1,45 @@ + ['id' => 12, 'name' => 'Twelve'], + 34 => ['id' => 34, 'name' => 'Thirty four'], + 56 => ['id' => 56, 'name' => 'Fifty six'], + ); + // ALTERNATIVE: $returnValues = []; // OK, success + // ALTERNATIVE: $returnValues = ["Some value"]; // OK, return a single value + + // Spec: civicrm_api3_create_success($values = 1, $params = [], $entity = NULL, $action = NULL) + return civicrm_api3_create_success($returnValues, $params, 'TwingleCampaign', 'Get'); + } + else { + throw new API_Exception(/*error_message*/ 'Everyone knows that the magicword is "sesame"', /*error_code*/ 'magicword_incorrect'); + } +} diff --git a/api/v3/TwingleCampaign/Getsingle.php b/api/v3/TwingleCampaign/Getsingle.php new file mode 100644 index 0000000..a4126ab --- /dev/null +++ b/api/v3/TwingleCampaign/Getsingle.php @@ -0,0 +1,45 @@ + ['id' => 12, 'name' => 'Twelve'], + 34 => ['id' => 34, 'name' => 'Thirty four'], + 56 => ['id' => 56, 'name' => 'Fifty six'], + ); + // ALTERNATIVE: $returnValues = []; // OK, success + // ALTERNATIVE: $returnValues = ["Some value"]; // OK, return a single value + + // Spec: civicrm_api3_create_success($values = 1, $params = [], $entity = NULL, $action = NULL) + return civicrm_api3_create_success($returnValues, $params, 'TwingleCampaign', 'Getsingle'); + } + else { + throw new API_Exception(/*error_message*/ 'Everyone knows that the magicword is "sesame"', /*error_code*/ 'magicword_incorrect'); + } +}