-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
50 lines (36 loc) · 1007 Bytes
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
/**
* Copyright (c) 2021. YiiMan\apiStorm
* Authors
* https://yiiman.ir
* https://ariaservice.net
******************************************************************************/
use YiiMan\ApiStorm\examples\post\PostCreateProduct;
use YiiMan\ApiStorm\examples\TestApi;
include __DIR__."/vendor/autoload.php";
$api = new TestApi();
$data = new PostCreateProduct();
$data->name0 = 'Pen';
$data->category0 = 10;
$data->color0 = "#fffff";
$data->status0 = 1;
if ($data->validate()) {
$response = $api->createProduct($data);
if ($response && $response->isSuccess()) {
echo $response->created_id;
}else{
var_export($response->getError());
}
}
echo "\n\n\n\n";
if ($data->validate()) {
$response = $api->createProduct2($data);
if ($response && $response->isSuccess()) {
echo "Created_id is: ". $response->created_id;
}else{
var_export($response->getError());
}
}
echo "\n\n\n\n";