From a8ff85042ffbfe94b678fd818c02deb613bfd116 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Fri, 07 Aug 2026 20:42:54 +0000
Subject: [PATCH] =Continuing on with Integrations setup. Working on PostMark now

---
 inc/integrations/_Base.php |   28 ++++++++++++----------------
 1 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/inc/integrations/_Base.php b/inc/integrations/_Base.php
index 1697e69..0f96c90 100644
--- a/inc/integrations/_Base.php
+++ b/inc/integrations/_Base.php
@@ -31,14 +31,7 @@
 	protected string $apiVersion;
 	protected Cache $cache;
 	protected ?string $cacheName = null;
-	//Use Trait "Requests" to set this
-	protected bool $hasRequests = false;
-	protected ?RateLimits $requestLimiter = null;
-	//Use Trait "OAuth" to set this
-	protected ?RateLimits $oauthLimiter = null;
-	protected bool $hasOAuth = false;
-	//Use trait "Webhooks" to set this true
-	protected bool $hasWebhooks = false;
+
 
 	/**
 	 * @var array Each item in the array becomes a li element in the ordered list of instructions
@@ -61,7 +54,7 @@
 	 * @var bool Flag to indicate there are extra options that warrant a dedicated options page for this service
 	 * Usually used for default field values for syncable services
 	 */
-	public bool $hasExtraOptions = false;
+	public static bool $hasExtraOptions = false;
 	public bool $hasBatchCreate = false;
 	public bool $hasBatchUpdate = false;
 	public bool $hasBatchDelete = false;
@@ -93,6 +86,8 @@
 	 */
 	protected array $contentTypes = [];
 
+	protected array $credentials;
+
 
 	/**
 	 * Check if integration is properly configured
@@ -104,7 +99,10 @@
 
 	public function loadCredentials():array
 	{
-		return Auth::getInstance()->getCredentials($this->service_name, $this->userID);
+		if (!isset($this->credentials)) {
+			$this->credentials = Auth::getInstance()->getCredentials($this->service_name, $this->userID);
+		}
+		return $this->credentials;
 	}
 
 	protected function logError(string $method, string $message, array $context = []):void
@@ -143,13 +141,11 @@
 		if (!is_null($this->userID)) {
 			$key .= '_'.$this->userID;
 		}
-
-		if ($this->hasRequests && !isset($this->requestLimiter) && !is_null($this->oauthLimiter)) {
-			$this->requestLimiter = new RateLimits($key);
+		if (method_exists($this, 'initializeRequestLimiter')) {
+			$this->initializeRequestLimiter();
 		}
-		if ($this->hasOAuth && !isset($this->oauthLimiter) && !is_null($this->oauthLimiter)) {
-			$key .= '_oauth';
-			$this->oauthLimiter = new RateLimits($key, ['s' => 1,'m' => 10, 'h' => 100]);
+		if (method_exists($this, 'intializeOAuthRateLimiter')) {
+			$this->initializeOAuthRateLimiter();
 		}
 	}
 

--
Gitblit v1.10.0