1: <?php
2:
3: namespace Saklient\Cloud\Models;
4:
5: require_once __DIR__ . "/../../../Saklient/Cloud/Client.php";
6: use \Saklient\Cloud\Client;
7: require_once __DIR__ . "/../../../Saklient/Cloud/Models/Model.php";
8: use \Saklient\Cloud\Models\Model;
9: require_once __DIR__ . "/../../../Saklient/Cloud/Resources/Resource.php";
10: use \Saklient\Cloud\Resources\Resource;
11: require_once __DIR__ . "/../../../Saklient/Cloud/Resources/Script.php";
12: use \Saklient\Cloud\Resources\Script;
13: require_once __DIR__ . "/../../../Saklient/Cloud/Enums/EScope.php";
14: use \Saklient\Cloud\Enums\EScope;
15: require_once __DIR__ . "/../../../Saklient/Util.php";
16: use \Saklient\Util;
17: require_once __DIR__ . "/../../../Saklient/Errors/SaklientException.php";
18: use \Saklient\Errors\SaklientException;
19:
20:
21: class Model_Script extends Model {
22:
23: 24: 25: 26: 27: 28:
29: protected function _apiPath()
30: {
31: return "/note";
32: }
33:
34: 35: 36: 37: 38: 39:
40: protected function _rootKey()
41: {
42: return "Note";
43: }
44:
45: 46: 47: 48: 49: 50:
51: protected function _rootKeyM()
52: {
53: return "Notes";
54: }
55:
56: 57: 58: 59: 60: 61:
62: protected function _className()
63: {
64: return "Script";
65: }
66:
67: 68: 69: 70: 71: 72: 73: 74:
75: protected function _createResourceImpl($obj, $wrapped=false)
76: {
77: Util::validateArgCount(func_num_args(), 1);
78: Util::validateType($wrapped, "boolean");
79: return new Script($this->_client, $obj, $wrapped);
80: }
81:
82: 83: 84: 85: 86: 87: 88:
89: public function offset($offset)
90: {
91: Util::validateArgCount(func_num_args(), 1);
92: Util::validateType($offset, "int");
93: return $this->_offset($offset);
94: }
95:
96: 97: 98: 99: 100: 101: 102:
103: public function limit($count)
104: {
105: Util::validateArgCount(func_num_args(), 1);
106: Util::validateType($count, "int");
107: return $this->_limit($count);
108: }
109:
110: 111: 112: 113: 114: 115: 116: 117: 118:
119: public function filterBy($key, $value, $multiple=false)
120: {
121: Util::validateArgCount(func_num_args(), 2);
122: Util::validateType($key, "string");
123: Util::validateType($multiple, "boolean");
124: return $this->_filterBy($key, $value, $multiple);
125: }
126:
127: 128: 129: 130: 131: 132:
133: public function reset()
134: {
135: return $this->_reset();
136: }
137:
138: 139: 140: 141: 142: 143: 144:
145: public function getById($id)
146: {
147: Util::validateArgCount(func_num_args(), 1);
148: Util::validateType($id, "string");
149: return $this->_getById($id);
150: }
151:
152: 153: 154: 155: 156: 157:
158: public function find()
159: {
160: return $this->_find();
161: }
162:
163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173:
174: public function withNameLike($name)
175: {
176: Util::validateArgCount(func_num_args(), 1);
177: Util::validateType($name, "string");
178: return $this->_withNameLike($name);
179: }
180:
181: 182: 183: 184: 185: 186: 187: 188: 189: 190:
191: public function withTag($tag)
192: {
193: Util::validateArgCount(func_num_args(), 1);
194: Util::validateType($tag, "string");
195: return $this->_withTag($tag);
196: }
197:
198: 199: 200: 201: 202: 203: 204: 205:
206: public function withTags($tags)
207: {
208: Util::validateArgCount(func_num_args(), 1);
209: Util::validateType($tags, "\\ArrayObject");
210: return $this->_withTags($tags);
211: }
212:
213: 214: 215: 216: 217: 218: 219: 220:
221: public function withTagDnf($dnf)
222: {
223: Util::validateArgCount(func_num_args(), 1);
224: Util::validateType($dnf, "\\ArrayObject");
225: return $this->_withTagDnf($dnf);
226: }
227:
228: 229: 230: 231: 232: 233: 234: 235:
236: public function sortByName($reverse=false)
237: {
238: Util::validateType($reverse, "boolean");
239: return $this->_sortByName($reverse);
240: }
241:
242: 243: 244: 245: 246:
247: public function __construct(\Saklient\Cloud\Client $client)
248: {
249: parent::__construct($client);
250: Util::validateArgCount(func_num_args(), 1);
251: Util::validateType($client, "\\Saklient\\Cloud\\Client");
252: }
253:
254: 255: 256: 257: 258: 259:
260: public function withSharedScope()
261: {
262: $this->_filterBy("Scope", new \ArrayObject([EScope::shared]));
263: return $this;
264: }
265:
266: 267: 268: 269: 270: 271:
272: public function withUserScope()
273: {
274: $this->_filterBy("Scope", new \ArrayObject([EScope::user]));
275: return $this;
276: }
277:
278:
279:
280: }
281:
282: