Skip to content

Commit d32dd54

Browse files
committed
Added the array to comma-separated + bool to string conversion for all the parameters
1 parent 637b03c commit d32dd54

30 files changed

+367
-347
lines changed

src/Endpoints/AsyncSearch.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class AsyncSearch extends AbstractEndpoint
5252
public function delete(array $params = [])
5353
{
5454
$this->checkRequiredParameters(['id'], $params);
55-
$url = '/_async_search/' . urlencode((string) $params['id']);
55+
$url = '/_async_search/' . $this->encode($params['id']);
5656
$method = 'DELETE';
5757

5858
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
@@ -90,7 +90,7 @@ public function delete(array $params = [])
9090
public function get(array $params = [])
9191
{
9292
$this->checkRequiredParameters(['id'], $params);
93-
$url = '/_async_search/' . urlencode((string) $params['id']);
93+
$url = '/_async_search/' . $this->encode($params['id']);
9494
$method = 'GET';
9595

9696
$url = $this->addQueryString($url, $params, ['wait_for_completion_timeout','keep_alive','typed_keys','pretty','human','error_trace','source','filter_path']);
@@ -125,7 +125,7 @@ public function get(array $params = [])
125125
public function status(array $params = [])
126126
{
127127
$this->checkRequiredParameters(['id'], $params);
128-
$url = '/_async_search/status/' . urlencode((string) $params['id']);
128+
$url = '/_async_search/status/' . $this->encode($params['id']);
129129
$method = 'GET';
130130

131131
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
@@ -202,7 +202,7 @@ public function status(array $params = [])
202202
public function submit(array $params = [])
203203
{
204204
if (isset($params['index'])) {
205-
$url = '/' . urlencode((string) $params['index']) . '/_async_search';
205+
$url = '/' . $this->encode($params['index']) . '/_async_search';
206206
$method = 'POST';
207207
} else {
208208
$url = '/_async_search';

src/Endpoints/Autoscaling.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class Autoscaling extends AbstractEndpoint
5252
public function deleteAutoscalingPolicy(array $params = [])
5353
{
5454
$this->checkRequiredParameters(['name'], $params);
55-
$url = '/_autoscaling/policy/' . urlencode((string) $params['name']);
55+
$url = '/_autoscaling/policy/' . $this->encode($params['name']);
5656
$method = 'DELETE';
5757

5858
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
@@ -105,7 +105,7 @@ public function getAutoscalingCapacity(array $params = [])
105105
public function getAutoscalingPolicy(array $params = [])
106106
{
107107
$this->checkRequiredParameters(['name'], $params);
108-
$url = '/_autoscaling/policy/' . urlencode((string) $params['name']);
108+
$url = '/_autoscaling/policy/' . $this->encode($params['name']);
109109
$method = 'GET';
110110

111111
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
@@ -141,7 +141,7 @@ public function getAutoscalingPolicy(array $params = [])
141141
public function putAutoscalingPolicy(array $params = [])
142142
{
143143
$this->checkRequiredParameters(['name'], $params);
144-
$url = '/_autoscaling/policy/' . urlencode((string) $params['name']);
144+
$url = '/_autoscaling/policy/' . $this->encode($params['name']);
145145
$method = 'PUT';
146146

147147
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);

src/Endpoints/Cat.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class Cat extends AbstractEndpoint
5959
public function aliases(array $params = [])
6060
{
6161
if (isset($params['name'])) {
62-
$url = '/_cat/aliases/' . urlencode((string) $params['name']);
62+
$url = '/_cat/aliases/' . $this->encode($params['name']);
6363
$method = 'GET';
6464
} else {
6565
$url = '/_cat/aliases';
@@ -105,7 +105,7 @@ public function aliases(array $params = [])
105105
public function allocation(array $params = [])
106106
{
107107
if (isset($params['node_id'])) {
108-
$url = '/_cat/allocation/' . urlencode((string) $params['node_id']);
108+
$url = '/_cat/allocation/' . $this->encode($params['node_id']);
109109
$method = 'GET';
110110
} else {
111111
$url = '/_cat/allocation';
@@ -148,7 +148,7 @@ public function allocation(array $params = [])
148148
public function count(array $params = [])
149149
{
150150
if (isset($params['index'])) {
151-
$url = '/_cat/count/' . urlencode((string) $params['index']);
151+
$url = '/_cat/count/' . $this->encode($params['index']);
152152
$method = 'GET';
153153
} else {
154154
$url = '/_cat/count';
@@ -192,7 +192,7 @@ public function count(array $params = [])
192192
public function fielddata(array $params = [])
193193
{
194194
if (isset($params['fields'])) {
195-
$url = '/_cat/fielddata/' . urlencode((string) $params['fields']);
195+
$url = '/_cat/fielddata/' . $this->encode($params['fields']);
196196
$method = 'GET';
197197
} else {
198198
$url = '/_cat/fielddata';
@@ -317,7 +317,7 @@ public function help(array $params = [])
317317
public function indices(array $params = [])
318318
{
319319
if (isset($params['index'])) {
320-
$url = '/_cat/indices/' . urlencode((string) $params['index']);
320+
$url = '/_cat/indices/' . $this->encode($params['index']);
321321
$method = 'GET';
322322
} else {
323323
$url = '/_cat/indices';
@@ -403,7 +403,7 @@ public function master(array $params = [])
403403
public function mlDataFrameAnalytics(array $params = [])
404404
{
405405
if (isset($params['id'])) {
406-
$url = '/_cat/ml/data_frame/analytics/' . urlencode((string) $params['id']);
406+
$url = '/_cat/ml/data_frame/analytics/' . $this->encode($params['id']);
407407
$method = 'GET';
408408
} else {
409409
$url = '/_cat/ml/data_frame/analytics';
@@ -448,7 +448,7 @@ public function mlDataFrameAnalytics(array $params = [])
448448
public function mlDatafeeds(array $params = [])
449449
{
450450
if (isset($params['datafeed_id'])) {
451-
$url = '/_cat/ml/datafeeds/' . urlencode((string) $params['datafeed_id']);
451+
$url = '/_cat/ml/datafeeds/' . $this->encode($params['datafeed_id']);
452452
$method = 'GET';
453453
} else {
454454
$url = '/_cat/ml/datafeeds';
@@ -494,7 +494,7 @@ public function mlDatafeeds(array $params = [])
494494
public function mlJobs(array $params = [])
495495
{
496496
if (isset($params['job_id'])) {
497-
$url = '/_cat/ml/anomaly_detectors/' . urlencode((string) $params['job_id']);
497+
$url = '/_cat/ml/anomaly_detectors/' . $this->encode($params['job_id']);
498498
$method = 'GET';
499499
} else {
500500
$url = '/_cat/ml/anomaly_detectors';
@@ -542,7 +542,7 @@ public function mlJobs(array $params = [])
542542
public function mlTrainedModels(array $params = [])
543543
{
544544
if (isset($params['model_id'])) {
545-
$url = '/_cat/ml/trained_models/' . urlencode((string) $params['model_id']);
545+
$url = '/_cat/ml/trained_models/' . $this->encode($params['model_id']);
546546
$method = 'GET';
547547
} else {
548548
$url = '/_cat/ml/trained_models';
@@ -754,7 +754,7 @@ public function plugins(array $params = [])
754754
public function recovery(array $params = [])
755755
{
756756
if (isset($params['index'])) {
757-
$url = '/_cat/recovery/' . urlencode((string) $params['index']);
757+
$url = '/_cat/recovery/' . $this->encode($params['index']);
758758
$method = 'GET';
759759
} else {
760760
$url = '/_cat/recovery';
@@ -838,7 +838,7 @@ public function repositories(array $params = [])
838838
public function segments(array $params = [])
839839
{
840840
if (isset($params['index'])) {
841-
$url = '/_cat/segments/' . urlencode((string) $params['index']);
841+
$url = '/_cat/segments/' . $this->encode($params['index']);
842842
$method = 'GET';
843843
} else {
844844
$url = '/_cat/segments';
@@ -884,7 +884,7 @@ public function segments(array $params = [])
884884
public function shards(array $params = [])
885885
{
886886
if (isset($params['index'])) {
887-
$url = '/_cat/shards/' . urlencode((string) $params['index']);
887+
$url = '/_cat/shards/' . $this->encode($params['index']);
888888
$method = 'GET';
889889
} else {
890890
$url = '/_cat/shards';
@@ -930,7 +930,7 @@ public function shards(array $params = [])
930930
public function snapshots(array $params = [])
931931
{
932932
if (isset($params['repository'])) {
933-
$url = '/_cat/snapshots/' . urlencode((string) $params['repository']);
933+
$url = '/_cat/snapshots/' . $this->encode($params['repository']);
934934
$method = 'GET';
935935
} else {
936936
$url = '/_cat/snapshots';
@@ -1019,7 +1019,7 @@ public function tasks(array $params = [])
10191019
public function templates(array $params = [])
10201020
{
10211021
if (isset($params['name'])) {
1022-
$url = '/_cat/templates/' . urlencode((string) $params['name']);
1022+
$url = '/_cat/templates/' . $this->encode($params['name']);
10231023
$method = 'GET';
10241024
} else {
10251025
$url = '/_cat/templates';
@@ -1066,7 +1066,7 @@ public function templates(array $params = [])
10661066
public function threadPool(array $params = [])
10671067
{
10681068
if (isset($params['thread_pool_patterns'])) {
1069-
$url = '/_cat/thread_pool/' . urlencode((string) $params['thread_pool_patterns']);
1069+
$url = '/_cat/thread_pool/' . $this->encode($params['thread_pool_patterns']);
10701070
$method = 'GET';
10711071
} else {
10721072
$url = '/_cat/thread_pool';
@@ -1113,7 +1113,7 @@ public function threadPool(array $params = [])
11131113
public function transforms(array $params = [])
11141114
{
11151115
if (isset($params['transform_id'])) {
1116-
$url = '/_cat/transforms/' . urlencode((string) $params['transform_id']);
1116+
$url = '/_cat/transforms/' . $this->encode($params['transform_id']);
11171117
$method = 'GET';
11181118
} else {
11191119
$url = '/_cat/transforms';

src/Endpoints/Ccr.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class Ccr extends AbstractEndpoint
5252
public function deleteAutoFollowPattern(array $params = [])
5353
{
5454
$this->checkRequiredParameters(['name'], $params);
55-
$url = '/_ccr/auto_follow/' . urlencode((string) $params['name']);
55+
$url = '/_ccr/auto_follow/' . $this->encode($params['name']);
5656
$method = 'DELETE';
5757

5858
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
@@ -89,7 +89,7 @@ public function deleteAutoFollowPattern(array $params = [])
8989
public function follow(array $params = [])
9090
{
9191
$this->checkRequiredParameters(['index'], $params);
92-
$url = '/' . urlencode((string) $params['index']) . '/_ccr/follow';
92+
$url = '/' . $this->encode($params['index']) . '/_ccr/follow';
9393
$method = 'PUT';
9494

9595
$url = $this->addQueryString($url, $params, ['wait_for_active_shards','pretty','human','error_trace','source','filter_path']);
@@ -125,7 +125,7 @@ public function follow(array $params = [])
125125
public function followInfo(array $params = [])
126126
{
127127
$this->checkRequiredParameters(['index'], $params);
128-
$url = '/' . urlencode((string) $params['index']) . '/_ccr/info';
128+
$url = '/' . $this->encode($params['index']) . '/_ccr/info';
129129
$method = 'GET';
130130

131131
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
@@ -160,7 +160,7 @@ public function followInfo(array $params = [])
160160
public function followStats(array $params = [])
161161
{
162162
$this->checkRequiredParameters(['index'], $params);
163-
$url = '/' . urlencode((string) $params['index']) . '/_ccr/stats';
163+
$url = '/' . $this->encode($params['index']) . '/_ccr/stats';
164164
$method = 'GET';
165165

166166
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
@@ -196,7 +196,7 @@ public function followStats(array $params = [])
196196
public function forgetFollower(array $params = [])
197197
{
198198
$this->checkRequiredParameters(['index'], $params);
199-
$url = '/' . urlencode((string) $params['index']) . '/_ccr/forget_follower';
199+
$url = '/' . $this->encode($params['index']) . '/_ccr/forget_follower';
200200
$method = 'POST';
201201

202202
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
@@ -232,7 +232,7 @@ public function forgetFollower(array $params = [])
232232
public function getAutoFollowPattern(array $params = [])
233233
{
234234
if (isset($params['name'])) {
235-
$url = '/_ccr/auto_follow/' . urlencode((string) $params['name']);
235+
$url = '/_ccr/auto_follow/' . $this->encode($params['name']);
236236
$method = 'GET';
237237
} else {
238238
$url = '/_ccr/auto_follow';
@@ -270,7 +270,7 @@ public function getAutoFollowPattern(array $params = [])
270270
public function pauseAutoFollowPattern(array $params = [])
271271
{
272272
$this->checkRequiredParameters(['name'], $params);
273-
$url = '/_ccr/auto_follow/' . urlencode((string) $params['name']) . '/pause';
273+
$url = '/_ccr/auto_follow/' . $this->encode($params['name']) . '/pause';
274274
$method = 'POST';
275275

276276
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
@@ -305,7 +305,7 @@ public function pauseAutoFollowPattern(array $params = [])
305305
public function pauseFollow(array $params = [])
306306
{
307307
$this->checkRequiredParameters(['index'], $params);
308-
$url = '/' . urlencode((string) $params['index']) . '/_ccr/pause_follow';
308+
$url = '/' . $this->encode($params['index']) . '/_ccr/pause_follow';
309309
$method = 'POST';
310310

311311
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
@@ -341,7 +341,7 @@ public function pauseFollow(array $params = [])
341341
public function putAutoFollowPattern(array $params = [])
342342
{
343343
$this->checkRequiredParameters(['name'], $params);
344-
$url = '/_ccr/auto_follow/' . urlencode((string) $params['name']);
344+
$url = '/_ccr/auto_follow/' . $this->encode($params['name']);
345345
$method = 'PUT';
346346

347347
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
@@ -377,7 +377,7 @@ public function putAutoFollowPattern(array $params = [])
377377
public function resumeAutoFollowPattern(array $params = [])
378378
{
379379
$this->checkRequiredParameters(['name'], $params);
380-
$url = '/_ccr/auto_follow/' . urlencode((string) $params['name']) . '/resume';
380+
$url = '/_ccr/auto_follow/' . $this->encode($params['name']) . '/resume';
381381
$method = 'POST';
382382

383383
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
@@ -413,7 +413,7 @@ public function resumeAutoFollowPattern(array $params = [])
413413
public function resumeFollow(array $params = [])
414414
{
415415
$this->checkRequiredParameters(['index'], $params);
416-
$url = '/' . urlencode((string) $params['index']) . '/_ccr/resume_follow';
416+
$url = '/' . $this->encode($params['index']) . '/_ccr/resume_follow';
417417
$method = 'POST';
418418

419419
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
@@ -467,7 +467,7 @@ public function stats(array $params = [])
467467
public function unfollow(array $params = [])
468468
{
469469
$this->checkRequiredParameters(['index'], $params);
470-
$url = '/' . urlencode((string) $params['index']) . '/_ccr/unfollow';
470+
$url = '/' . $this->encode($params['index']) . '/_ccr/unfollow';
471471
$method = 'POST';
472472

473473
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);

src/Endpoints/Cluster.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function allocationExplain(array $params = [])
9191
public function deleteComponentTemplate(array $params = [])
9292
{
9393
$this->checkRequiredParameters(['name'], $params);
94-
$url = '/_component_template/' . urlencode((string) $params['name']);
94+
$url = '/_component_template/' . $this->encode($params['name']);
9595
$method = 'DELETE';
9696

9797
$url = $this->addQueryString($url, $params, ['timeout','master_timeout','pretty','human','error_trace','source','filter_path']);
@@ -162,7 +162,7 @@ public function deleteVotingConfigExclusions(array $params = [])
162162
public function existsComponentTemplate(array $params = [])
163163
{
164164
$this->checkRequiredParameters(['name'], $params);
165-
$url = '/_component_template/' . urlencode((string) $params['name']);
165+
$url = '/_component_template/' . $this->encode($params['name']);
166166
$method = 'HEAD';
167167

168168
$url = $this->addQueryString($url, $params, ['master_timeout','local','pretty','human','error_trace','source','filter_path']);
@@ -199,7 +199,7 @@ public function existsComponentTemplate(array $params = [])
199199
public function getComponentTemplate(array $params = [])
200200
{
201201
if (isset($params['name'])) {
202-
$url = '/_component_template/' . urlencode((string) $params['name']);
202+
$url = '/_component_template/' . $this->encode($params['name']);
203203
$method = 'GET';
204204
} else {
205205
$url = '/_component_template';
@@ -285,7 +285,7 @@ public function getSettings(array $params = [])
285285
public function health(array $params = [])
286286
{
287287
if (isset($params['index'])) {
288-
$url = '/_cluster/health/' . urlencode((string) $params['index']);
288+
$url = '/_cluster/health/' . $this->encode($params['index']);
289289
$method = 'GET';
290290
} else {
291291
$url = '/_cluster/health';
@@ -399,7 +399,7 @@ public function postVotingConfigExclusions(array $params = [])
399399
public function putComponentTemplate(array $params = [])
400400
{
401401
$this->checkRequiredParameters(['name'], $params);
402-
$url = '/_component_template/' . urlencode((string) $params['name']);
402+
$url = '/_component_template/' . $this->encode($params['name']);
403403
$method = 'PUT';
404404

405405
$url = $this->addQueryString($url, $params, ['create','timeout','master_timeout','pretty','human','error_trace','source','filter_path']);
@@ -542,10 +542,10 @@ public function reroute(array $params = [])
542542
public function state(array $params = [])
543543
{
544544
if (isset($params['index']) && isset($params['metric'])) {
545-
$url = '/_cluster/state/' . urlencode((string) $params['metric']) . '/' . urlencode((string) $params['index']);
545+
$url = '/_cluster/state/' . $this->encode($params['metric']) . '/' . $this->encode($params['index']);
546546
$method = 'GET';
547547
} elseif (isset($params['metric'])) {
548-
$url = '/_cluster/state/' . urlencode((string) $params['metric']);
548+
$url = '/_cluster/state/' . $this->encode($params['metric']);
549549
$method = 'GET';
550550
} else {
551551
$url = '/_cluster/state';
@@ -585,7 +585,7 @@ public function state(array $params = [])
585585
public function stats(array $params = [])
586586
{
587587
if (isset($params['node_id'])) {
588-
$url = '/_cluster/stats/nodes/' . urlencode((string) $params['node_id']);
588+
$url = '/_cluster/stats/nodes/' . $this->encode($params['node_id']);
589589
$method = 'GET';
590590
} else {
591591
$url = '/_cluster/stats';

src/Endpoints/DanglingIndices.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class DanglingIndices extends AbstractEndpoint
5555
public function deleteDanglingIndex(array $params = [])
5656
{
5757
$this->checkRequiredParameters(['index_uuid'], $params);
58-
$url = '/_dangling/' . urlencode((string) $params['index_uuid']);
58+
$url = '/_dangling/' . $this->encode($params['index_uuid']);
5959
$method = 'DELETE';
6060

6161
$url = $this->addQueryString($url, $params, ['accept_data_loss','timeout','master_timeout','pretty','human','error_trace','source','filter_path']);
@@ -93,7 +93,7 @@ public function deleteDanglingIndex(array $params = [])
9393
public function importDanglingIndex(array $params = [])
9494
{
9595
$this->checkRequiredParameters(['index_uuid'], $params);
96-
$url = '/_dangling/' . urlencode((string) $params['index_uuid']);
96+
$url = '/_dangling/' . $this->encode($params['index_uuid']);
9797
$method = 'POST';
9898

9999
$url = $this->addQueryString($url, $params, ['accept_data_loss','timeout','master_timeout','pretty','human','error_trace','source','filter_path']);

0 commit comments

Comments
 (0)