Skip to content

Commit 6b15b89

Browse files
committed
docs(curation-sets): add phpdoc for curation set class methods
1 parent a48240b commit 6b15b89

4 files changed

Lines changed: 73 additions & 0 deletions

File tree

src/CurationSet.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,13 @@ private function endPointPath(): string
6767
}
6868

6969
/**
70+
* Create or update a curation set with the given name.
71+
*
72+
* @example
73+
* $client->curationSets['my-set']->upsert(['items' => [['id' => 'promote-hat', 'rule' => ['query' => 'hat', 'match' => 'exact']]]])
74+
*
75+
* @see https://typesense.org/docs/latest/api/curation.html
76+
*
7077
* @param array $params
7178
*
7279
* @return array
@@ -78,6 +85,13 @@ public function upsert(array $params): array
7885
}
7986

8087
/**
88+
* Retrieve a specific curation set by its name.
89+
*
90+
* @example
91+
* $client->curationSets['my-set']->retrieve()
92+
*
93+
* @see https://typesense.org/docs/latest/api/curation.html
94+
*
8195
* @return array
8296
* @throws TypesenseClientError|HttpClientException
8397
*/
@@ -87,6 +101,13 @@ public function retrieve(): array
87101
}
88102

89103
/**
104+
* Delete a specific curation set by its name.
105+
*
106+
* @example
107+
* $client->curationSets['my-set']->delete()
108+
*
109+
* @see https://typesense.org/docs/latest/api/curation.html
110+
*
90111
* @return array
91112
* @throws TypesenseClientError|HttpClientException
92113
*/
@@ -96,6 +117,16 @@ public function delete(): array
96117
}
97118

98119
/**
120+
* Access the items in this curation set. Use the returned object as an array to access
121+
* a single item by ID, or call `retrieve()` to list all items.
122+
*
123+
* @example
124+
* $client->curationSets['my-set']->getItems()->retrieve()
125+
* @example
126+
* $client->curationSets['my-set']->getItems()['promote-hat']->retrieve()
127+
*
128+
* @see https://typesense.org/docs/latest/api/curation.html
129+
*
99130
* @return CurationSetItems
100131
*/
101132
public function getItems(): CurationSetItems

src/CurationSetItem.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@ private function endPointPath(): string
5555
}
5656

5757
/**
58+
* Retrieve a specific curation item by its id.
59+
*
60+
* @example
61+
* $client->curationSets['my-set']->getItems()['promote-hat']->retrieve()
62+
*
63+
* @see https://typesense.org/docs/latest/api/curation.html
64+
*
5865
* @return array
5966
* @throws TypesenseClientError|HttpClientException
6067
*/
@@ -64,6 +71,13 @@ public function retrieve(): array
6471
}
6572

6673
/**
74+
* Create or update a curation set item with the given id.
75+
*
76+
* @example
77+
* $client->curationSets['my-set']->getItems()['promote-hat']->upsert(['rule' => ['query' => 'hat', 'match' => 'exact'], 'includes' => []])
78+
*
79+
* @see https://typesense.org/docs/latest/api/curation.html
80+
*
6781
* @param array $params
6882
*
6983
* @return array
@@ -75,6 +89,13 @@ public function upsert(array $params): array
7589
}
7690

7791
/**
92+
* Delete a specific curation item by its id.
93+
*
94+
* @example
95+
* $client->curationSets['my-set']->getItems()['promote-hat']->delete()
96+
*
97+
* @see https://typesense.org/docs/latest/api/curation.html
98+
*
7899
* @return array
79100
* @throws TypesenseClientError|HttpClientException
80101
*/

src/CurationSetItems.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ private function endPointPath(): string
5252
}
5353

5454
/**
55+
* Retrieve all curation items in a set.
56+
*
57+
* @example
58+
* $client->curationSets['my-set']->getItems()->retrieve()
59+
*
60+
* @see https://typesense.org/docs/latest/api/curation.html
61+
*
5562
* @return array
5663
* @throws TypesenseClientError|HttpClientException
5764
*/

src/CurationSets.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ public function __construct(ApiCall $apiCall)
3535
}
3636

3737
/**
38+
* Create or update a curation set with the given name.
39+
*
40+
* @example
41+
* $client->curationSets->upsert('my-set', ['items' => [['id' => 'promote-hat', 'rule' => ['query' => 'hat', 'match' => 'exact']]]])
42+
*
43+
* @see https://typesense.org/docs/latest/api/curation.html
44+
*
3845
* @param string $curationSetName
3946
* @param array $config
4047
*
@@ -47,6 +54,13 @@ public function upsert(string $curationSetName, array $config): array
4754
}
4855

4956
/**
57+
* Retrieve all curation sets.
58+
*
59+
* @example
60+
* $client->curationSets->retrieve()
61+
*
62+
* @see https://typesense.org/docs/latest/api/curation.html
63+
*
5064
* @return array
5165
* @throws TypesenseClientError|HttpClientException
5266
*/

0 commit comments

Comments
 (0)