Skip to content

Commit

Permalink
feat: realtor endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
andreoneres committed Apr 11, 2023
1 parent 21c1674 commit bfbdeb0
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,20 @@ Buscando um CNPJ específico.
$brasilApi->cnpj()->get('00000000000191');
```

### Corretoras

Buscando uma corretora específica pelo CNPJ.

```php
$brasilApi->realtors()->get('76621457000185');
```

Buscando todas as corretoras listadas pela CVM.

```php
$brasilApi->realtors()->getList();
```

### CPTEC

Buscando uma cidade pelo nome.
Expand Down
3 changes: 3 additions & 0 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use BrasilApi\Endpoints\CEP;
use BrasilApi\Endpoints\CEPV2;
use BrasilApi\Endpoints\CNPJ;
use BrasilApi\Endpoints\Realtors;
use BrasilApi\Endpoints\Collections\Endpoints;
use BrasilApi\Endpoints\CPTEC;
use BrasilApi\Endpoints\DDD;
Expand All @@ -33,6 +34,7 @@
* @method CEP cep()
* @method CEPV2 cepV2()
* @method CNPJ cnpj()
* @method Realtors realtors()
* @method CPTEC cptec()
* @method DDD ddd()
* @method Holidays holidays()
Expand Down Expand Up @@ -144,6 +146,7 @@ private function loadDefaults(): void
"cep" => CEP::class,
"cepV2" => CEPV2::class,
"cnpj" => CNPJ::class,
"realtors" => Realtors::class,
"cptec" => CPTEC::class,
"ddd" => DDD::class,
"holidays" => Holidays::class,
Expand Down
38 changes: 38 additions & 0 deletions src/Endpoints/Realtors.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

declare(strict_types=1);

namespace BrasilApi\Endpoints;

use BrasilApi\Endpoints\Abstracts\Endpoint;
use BrasilApi\Exceptions\BrasilApiException;

/**
* @see https://brasilapi.com.br/docs#tag/Corretoras
*/
class Realtors extends Endpoint
{
/**
* Find a specific realtor by CNPJ.
*
* @param string $cnpj Realtor CNPJ
*
* @return array
* @throws BrasilApiException
*/
public function get(string $cnpj): array
{
return $this->client->request("/cvm/corretoras/v1/{$cnpj}");
}

/**
* Find the realtors listed on the CVM.
*
* @return array
* @throws BrasilApiException
*/
public function getList(): array
{
return $this->client->request("/cvm/corretoras/v1");
}
}

0 comments on commit bfbdeb0

Please sign in to comment.