Skip to content

Commit 77863a7

Browse files
fix: __construct function for non-partner methods
1 parent 6acc195 commit 77863a7

1 file changed

Lines changed: 15 additions & 12 deletions

File tree

src/GreenApiClient.php

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class GreenApiClient {
2828
private $media;
2929
private $idInstance; = null;
3030
private $apiTokenInstance; = null;
31+
private $partnerToken = null;
3132

3233
/**
3334
* @var Account
@@ -87,21 +88,23 @@ public function __construct( $idInstance = null, $apiTokenInstance = null, $part
8788
$this->host = $host;
8889
$this->media = $media;
8990

91+
if ($this->idInstance && $this->apiTokenInstance) {
92+
$this->account = new Account( $this );
93+
$this->contacts = new Contacts( $this );
94+
$this->groups = new Groups( $this );
95+
$this->journals = new Journals( $this );
96+
$this->marking = new Marking( $this );
97+
$this->queues = new Queues( $this );
98+
$this->receiving = new Receiving( $this );
99+
$this->sending = new Sending( $this );
100+
$this->serviceMethods = new ServiceMethods( $this );
101+
$this->webhooks = new Webhooks( $this );
102+
$this->statuses = new Statuses( $this );
103+
}
104+
90105
if ($this->partnerToken) {
91106
$this->partner = new Partner( $this );
92107
}
93-
94-
$this->account = new Account( $this );
95-
$this->contacts = new Contacts( $this );
96-
$this->groups = new Groups( $this );
97-
$this->journals = new Journals( $this );
98-
$this->marking = new Marking( $this );
99-
$this->queues = new Queues( $this );
100-
$this->receiving = new Receiving( $this );
101-
$this->sending = new Sending( $this );
102-
$this->serviceMethods = new ServiceMethods( $this );
103-
$this->webhooks = new Webhooks( $this );
104-
$this->statuses = new Statuses( $this );
105108
}
106109

107110
/**

0 commit comments

Comments
 (0)