Skip to content

Commit d32f681

Browse files
committed
updated code with documentation
1 parent 805fcd0 commit d32f681

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

PocketbaseArduino.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,23 @@ PocketbaseArduino &PocketbaseArduino::collection(const char *collection)
104104
return *this;
105105
}
106106

107+
/**
108+
* @brief Fetches a single record from a Pocketbase collection
109+
*
110+
* @param recordId The ID of the record to view.
111+
*
112+
* @param expand (Optional) Auto expand record relations. Ex.:?expand=relField1,relField2.subRelField Supports up to 6-levels depth nested relations expansion.
113+
* The expanded relations will be appended to the record under the expand property (eg. "expand": {"relField1": {...}, ...}).
114+
* Only the relations to which the request user has permissions to view will be expanded.
115+
*
116+
* @param fields (Optional) Comma separated string of the fields to return in the JSON response (by default returns all fields). Ex.: ?fields=*,expand.relField.name
117+
* * targets all keys from the specific depth level. In addition, the following field modifiers are also supported:
118+
* :excerpt(maxLength, withEllipsis?)
119+
* Returns a short plain text version of the field string value.
120+
* Ex.: ?fields=*,description:excerpt(200,true)
121+
*
122+
* For more information, see: https://pocketbase.io/docs
123+
*/
107124
String PocketbaseArduino::getOne(const char *recordId, const char *expand /* = nullptr */, const char *fields /* = nullptr */)
108125
{
109126
String fullEndpoint;

PocketbaseArduino.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,25 @@ class PocketbaseArduino
1717

1818
// Methods to build collection and record URLs
1919
PocketbaseArduino &collection(const char *collection);
20+
21+
/**
22+
* @brief Fetches a single record from a Pocketbase collection
23+
*
24+
* @param recordId The ID of the record to view.
25+
*
26+
* @param expand (Optional) Auto expand record relations. Ex.:?expand=relField1,relField2.subRelField Supports up to 6-levels depth nested relations expansion.
27+
* The expanded relations will be appended to the record under the expand property (eg. "expand": {"relField1": {...}, ...}).
28+
* Only the relations to which the request user has permissions to view will be expanded.
29+
*
30+
* @param fields (Optional) Comma separated string of the fields to return in the JSON response (by default returns all fields). Ex.: ?fields=*,expand.relField.name
31+
* * targets all keys from the specific depth level.
32+
* In addition, the following field modifiers are also supported:
33+
* :excerpt(maxLength, withEllipsis?)
34+
* Returns a short plain text version of the field string value.
35+
* Ex.: ?fields=*,description:excerpt(200,true)
36+
*
37+
* For more information, see: https://pocketbase.io/docs
38+
*/
2039
String getOne(const char *recordId, const char *expand /* = nullptr */, const char *fields /* = nullptr */);
2140

2241
private:

0 commit comments

Comments
 (0)