commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ApiClientBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
16 use DateTimeImmutable;
17 use stdClass;
18 
22 final class ApiClientBuilder implements Builder
23 {
28  private $id;
29 
34  private $name;
35 
40  private $scope;
41 
46  private $secret;
47 
52  private $lastUsedAt;
53 
58  private $deleteAt;
59 
64  private $createdAt;
65 
70  private $accessTokenValiditySeconds;
71 
76  private $refreshTokenValiditySeconds;
77 
84  public function getId()
85  {
86  return $this->id;
87  }
88 
95  public function getName()
96  {
97  return $this->name;
98  }
99 
106  public function getScope()
107  {
108  return $this->scope;
109  }
110 
118  public function getSecret()
119  {
120  return $this->secret;
121  }
122 
129  public function getLastUsedAt()
130  {
131  return $this->lastUsedAt;
132  }
133 
140  public function getDeleteAt()
141  {
142  return $this->deleteAt;
143  }
144 
151  public function getCreatedAt()
152  {
153  return $this->createdAt;
154  }
155 
163  {
164  return $this->accessTokenValiditySeconds;
165  }
166 
174  {
175  return $this->refreshTokenValiditySeconds;
176  }
177 
182  public function withId(?string $id)
183  {
184  $this->id = $id;
185 
186  return $this;
187  }
188 
193  public function withName(?string $name)
194  {
195  $this->name = $name;
196 
197  return $this;
198  }
199 
204  public function withScope(?string $scope)
205  {
206  $this->scope = $scope;
207 
208  return $this;
209  }
210 
215  public function withSecret(?string $secret)
216  {
217  $this->secret = $secret;
218 
219  return $this;
220  }
221 
226  public function withLastUsedAt(?DateTimeImmutable $lastUsedAt)
227  {
228  $this->lastUsedAt = $lastUsedAt;
229 
230  return $this;
231  }
232 
237  public function withDeleteAt(?DateTimeImmutable $deleteAt)
238  {
239  $this->deleteAt = $deleteAt;
240 
241  return $this;
242  }
243 
248  public function withCreatedAt(?DateTimeImmutable $createdAt)
249  {
250  $this->createdAt = $createdAt;
251 
252  return $this;
253  }
254 
259  public function withAccessTokenValiditySeconds(?int $accessTokenValiditySeconds)
260  {
261  $this->accessTokenValiditySeconds = $accessTokenValiditySeconds;
262 
263  return $this;
264  }
265 
270  public function withRefreshTokenValiditySeconds(?int $refreshTokenValiditySeconds)
271  {
272  $this->refreshTokenValiditySeconds = $refreshTokenValiditySeconds;
273 
274  return $this;
275  }
276 
277 
278  public function build(): ApiClient
279  {
280  return new ApiClientModel(
281  $this->id,
282  $this->name,
283  $this->scope,
284  $this->secret,
285  $this->lastUsedAt,
286  $this->deleteAt,
287  $this->createdAt,
288  $this->accessTokenValiditySeconds,
289  $this->refreshTokenValiditySeconds
290  );
291  }
292 
293  public static function of(): ApiClientBuilder
294  {
295  return new self();
296  }
297 }
withAccessTokenValiditySeconds(?int $accessTokenValiditySeconds)
withRefreshTokenValiditySeconds(?int $refreshTokenValiditySeconds)