Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update #6

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions PocketbaseExtended.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// PocketbaseArduino.cpp
// PocketbaseExtended.cpp

#include "PocketbaseArduino.h"
#include "PocketbaseExtended.h"
// #include <ESP8266HTTPClient.h>
// #include <ESP8266WiFi.h>
// #include <ESP8266HTTPClient.h>
Expand All @@ -15,7 +15,7 @@
#include <WiFiClientSecure.h>
#endif

PocketbaseArduino::PocketbaseArduino(const char *baseUrl)
PocketbaseExtended::PocketbaseExtended(const char *baseUrl)
{
base_url = baseUrl;

Expand All @@ -31,7 +31,7 @@ PocketbaseArduino::PocketbaseArduino(const char *baseUrl)
fields_param = "";
}

PocketbaseArduino &PocketbaseArduino::collection(const char *collection)
PocketbaseExtended &PocketbaseExtended::collection(const char *collection)
{
current_endpoint = "collections/" + String(collection) + "/";
return *this;
Expand Down Expand Up @@ -269,7 +269,7 @@ String performPOSTRequest(const char *endpoint, const String &requestBody)
#endif
}

String PocketbaseArduino::getOne(const char *recordId, const char *expand /* = nullptr */, const char *fields /* = nullptr */)
String PocketbaseExtended::getOne(const char *recordId, const char *expand /* = nullptr */, const char *fields /* = nullptr */)
{
String fullEndpoint = base_url + String(current_endpoint) + "records/" + recordId;

Expand All @@ -290,7 +290,7 @@ String PocketbaseArduino::getOne(const char *recordId, const char *expand /* = n
return performGETRequest(fullEndpoint.c_str());
}

String PocketbaseArduino::getList(
String PocketbaseExtended::getList(
const char *page /* = nullptr */,
const char *perPage /* = nullptr */,
const char *sort /* = nullptr */,
Expand Down Expand Up @@ -359,14 +359,14 @@ String PocketbaseArduino::getList(
return performGETRequest(fullEndpoint.c_str());
}

String PocketbaseArduino::deleteRecord(const char *recordId)
String PocketbaseExtended::deleteRecord(const char *recordId)
{
String fullEndpoint = base_url + String(current_endpoint) + "records/" + recordId;

return performDELETERequest(fullEndpoint.c_str());
}

String PocketbaseArduino::create(const String &requestBody)
String PocketbaseExtended::create(const String &requestBody)
{
// Construct the endpoint based on the current_endpoint
String fullEndpoint = current_endpoint + "records/";
Expand Down
4 changes: 4 additions & 0 deletions PocketbaseExtended.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ class PocketbaseExtended
public:
PocketbaseExtended(const char *baseUrl); // Constructor

// String performGETRequest(const char *endpoint);
// String performDELETERequest(const char *endpoint);
// String performPOSTRequest(const char *endpoint, const String &requestBody);

// Methods to build collection and record URLs
PocketbaseExtended &collection(const char *collection);

Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,20 @@ Arduino ESP8266/ESP32 Wrapper Library for Pocketbase

- [PocketbaseArduino](#pocketbasearduino)
- [Table of Contents](#table-of-contents)
- [Installation](#installation)
- [Dependencies](#dependencies)
- [Usage](#usage)
- [Contributing](#contributing)
- [License](#license)

## Installation
## Dependencies

TODO: Instructions on how to install and set up your project.
- ArduinoJSON
- ESP8266WiFi Library
- ESP8266HTTPClient
- BearSSLHelpers (For Https Requests)
- HTTPClient
- WiFi
- WiFiClientSecure

## Usage

Expand Down
2 changes: 1 addition & 1 deletion examples/pocketbaseextended_example.ino
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const char *ssid = "YOUR_SSID";
const char *password = "YOUR_PASSWORD";

// Initializing the Pocketbase instance
PocketbaseArduino pb("YOUR_POCKETBASE_BASE_URL");
PocketbaseExtended pb("YOUR_POCKETBASE_BASE_URL");
String record;

void setup()
Expand Down
2 changes: 1 addition & 1 deletion examples/pocketbaseextended_example_deleteRecord.ino
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const char *ssid = "YOUR_SSID";
const char *password = "YOUR_PASSWORD";

// Initializing the Pocketbase instance
PocketbaseArduino pb("YOUR_POCKETBASE_BASE_URL");
PocketbaseExtended pb("YOUR_POCKETBASE_BASE_URL");
String record;

void setup()
Expand Down
2 changes: 1 addition & 1 deletion examples/pocketbaseextended_example_getList.ino
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const char *ssid = "YOUR_SSID";
const char *password = "YOUR_PASSWORD";

// Initializing the Pocketbase instance
PocketbaseArduino pb("YOUR_POCKETBASE_BASE_URL");
PocketbaseExtended pb("YOUR_POCKETBASE_BASE_URL");
String record;

void setup()
Expand Down
2 changes: 1 addition & 1 deletion examples/pocketbaseextended_example_getOne.ino
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const char *ssid = "YOUR_SSID";
const char *password = "YOUR_PASSWORD";

// Initializing the Pocketbase instance
PocketbaseArduino pb("YOUR_POCKETBASE_BASE_URL");
PocketbaseExtended pb("YOUR_POCKETBASE_BASE_URL");
String record;

void setup()
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version=0.4.0
author=Jeo Carlo Lubao
maintainer=Jeo Carlo Lubao
sentence=Pocketbase Library for Arduino
paragraph=[Create, Update and Auth In Progress] This library simplifies the process of communicating with Pocketbase. It hides the complexity of authentication and json parsing.
paragraph=[Create, Update and Auth In Progress] This library simplifies the process of communicating with Pocketbase. It hides the complexity for communicating with Pocketbase.
category=Communication
url=https://github.com/jeoooo/pocketbasearduino
architectures=esp8266,esp32