├── .github └── workflows │ ├── codeql.yml │ ├── maven-publish.yml │ └── maven.yml ├── .gitignore ├── LICENSE ├── README.md ├── pom.xml └── src ├── main └── java │ └── br │ └── com │ └── brasilapi │ ├── BrasilAPI.java │ ├── Cache.java │ ├── Log.java │ ├── Service.java │ └── api │ ├── API.java │ ├── Bank.java │ ├── CEP.java │ ├── CEP2.java │ ├── CNPJ.java │ ├── CPTEC.java │ ├── CPTECCidade.java │ ├── CPTECClimaAeroporto.java │ ├── CPTECClimaCapital.java │ ├── CPTECClimaPrevisao.java │ ├── CPTECOnda.java │ ├── Corretora.java │ ├── DDD.java │ ├── Feriados.java │ ├── FipeMarca.java │ ├── FipePreco.java │ ├── FipeTabela.java │ ├── IBGEMunicipio.java │ ├── IBGEUF.java │ ├── ISBN.java │ ├── NCM.java │ ├── PIX.java │ ├── RegistroBR.java │ └── Taxa.java └── test └── java └── br └── com └── brasilapi └── BrasilAPITest.java /.github/workflows/codeql.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | # 7 | # ******** NOTE ******** 8 | # We have attempted to detect the languages in your repository. Please check 9 | # the `language` matrix defined below to confirm you have the correct set of 10 | # supported CodeQL languages. 11 | # 12 | name: "CodeQL" 13 | 14 | on: 15 | push: 16 | branches: [ "main" ] 17 | pull_request: 18 | # The branches below must be a subset of the branches above 19 | branches: [ "main" ] 20 | schedule: 21 | - cron: '36 7 * * 5' 22 | 23 | jobs: 24 | analyze: 25 | name: Analyze 26 | runs-on: ubuntu-latest 27 | permissions: 28 | actions: read 29 | contents: read 30 | security-events: write 31 | 32 | strategy: 33 | fail-fast: false 34 | matrix: 35 | language: [ 'java' ] 36 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] 37 | # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support 38 | 39 | steps: 40 | - name: Checkout repository 41 | uses: actions/checkout@v3 42 | 43 | # Initializes the CodeQL tools for scanning. 44 | - name: Initialize CodeQL 45 | uses: github/codeql-action/init@v2 46 | with: 47 | languages: ${{ matrix.language }} 48 | # If you wish to specify custom queries, you can do so here or in a config file. 49 | # By default, queries listed here will override any specified in a config file. 50 | # Prefix the list here with "+" to use these queries and those in the config file. 51 | 52 | # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs 53 | # queries: security-extended,security-and-quality 54 | 55 | 56 | # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). 57 | # If this step fails, then you should remove it and run the build manually (see below) 58 | - name: Autobuild 59 | uses: github/codeql-action/autobuild@v2 60 | 61 | # ℹ️ Command-line programs to run using the OS shell. 62 | # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun 63 | 64 | # If the Autobuild fails above, remove it and uncomment the following three lines. 65 | # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. 66 | 67 | # - run: | 68 | # echo "Run, Build Application using script" 69 | # ./location_of_script_within_repo/buildscript.sh 70 | 71 | - name: Perform CodeQL Analysis 72 | uses: github/codeql-action/analyze@v2 73 | with: 74 | category: "/language:${{matrix.language}}" 75 | -------------------------------------------------------------------------------- /.github/workflows/maven-publish.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a package using Maven and then publish it to GitHub packages when a release is created 2 | # For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path 3 | 4 | name: Maven Package 5 | 6 | on: 7 | release: 8 | types: [created] 9 | 10 | jobs: 11 | build: 12 | 13 | runs-on: ubuntu-latest 14 | permissions: 15 | contents: read 16 | packages: write 17 | 18 | steps: 19 | - uses: actions/checkout@v3 20 | - name: Set up JDK 8 21 | uses: actions/setup-java@v3 22 | with: 23 | java-version: '8' 24 | distribution: 'temurin' 25 | server-id: github # Value of the distributionManagement/repository/id field of the pom.xml 26 | settings-path: ${{ github.workspace }} # location for the settings.xml file 27 | 28 | - name: Build with Maven 29 | run: mvn -B package --file pom.xml 30 | 31 | - name: Publish to GitHub Packages Apache Maven 32 | run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml 33 | env: 34 | GITHUB_TOKEN: ${{ secrets.BRASIL_API_TOKEN }} 35 | -------------------------------------------------------------------------------- /.github/workflows/maven.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time 2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven 3 | 4 | # This workflow uses actions that are not certified by GitHub. 5 | # They are provided by a third-party and are governed by 6 | # separate terms of service, privacy policy, and support 7 | # documentation. 8 | 9 | name: Java CI with Maven 10 | 11 | on: 12 | push: 13 | branches: [ "main" ] 14 | pull_request: 15 | branches: [ "main" ] 16 | 17 | jobs: 18 | build: 19 | 20 | runs-on: ubuntu-latest 21 | 22 | steps: 23 | - uses: actions/checkout@v3 24 | - name: Set up JDK 8 25 | uses: actions/setup-java@v3 26 | with: 27 | java-version: '8' 28 | distribution: 'temurin' 29 | cache: maven 30 | - name: Build with Maven 31 | run: mvn -B package --file pom.xml 32 | 33 | # Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive 34 | - name: Update dependency graph 35 | uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6 36 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | *.jar 15 | *.war 16 | *.nar 17 | *.ear 18 | *.zip 19 | *.tar.gz 20 | *.rar 21 | 22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 23 | hs_err_pid* 24 | 25 | target/* 26 | .project 27 | .settings/* 28 | .idea/* 29 | .classpath 30 | bin/* -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Sávio Andres 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## BrasilAPI-Java 2 | [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://github.com/SavioAndres/BrasilAPI-Java/blob/main/LICENSE) 3 | [![Java CI with Maven](https://github.com/SavioAndres/BrasilAPI-Java/actions/workflows/maven.yml/badge.svg)](https://github.com/SavioAndres/BrasilAPI-Java/actions/workflows/maven.yml) 4 | [![CodeQL](https://github.com/SavioAndres/BrasilAPI-Java/actions/workflows/codeql.yml/badge.svg)](https://github.com/SavioAndres/BrasilAPI-Java/actions/workflows/codeql.yml) 5 | [![JitPack](https://jitpack.io/v/SavioAndres/BrasilAPI-Java.svg)](https://jitpack.io/#SavioAndres/BrasilAPI-Java/v1.1.0) 6 | 7 | Biblioteca criada para facilitar o acesso à API [BrasilAPI](https://github.com/BrasilAPI/BrasilAPI) na linguagem de programação Java. 8 | 9 | ``` 10 | ____ _ _ _ ____ ___ _ 11 | | __ ) _ __ __ _ ___(_) | / \ | _ \_ _| | | __ ___ ____ _ 12 | | _ \| '__/ _` / __| | | / _ \ | |_) | |_____ _ | |/ _` \ \ / / _` | 13 | | |_) | | | (_| \__ \ | |/ ___ \| __/| |_____| |_| | (_| |\ V / (_| | 14 | |____/|_| \__,_|___/_|_/_/ \_\_| |___| \___/ \__,_| \_/ \__,_| 15 | ``` 16 | 17 | ## Informações 18 | - Suporte à Java 8 ou superior. 19 | 20 | ## Instalação 21 | ### Maven 22 | ```xml 23 | 24 | 25 | com.github.SavioAndres 26 | BrasilAPI-Java 27 | v1.1.0 28 | 29 | 30 | 31 | 32 | jitpack.io 33 | https://jitpack.io 34 | 35 | 36 | ``` 37 | ### Demais gerenciadores: 38 | Gradle, SBT e Leiningen disponíveis em: [JitPack BrasilAPI-Java](https://jitpack.io/#SavioAndres/BrasilAPI-Java/v1.1.0) 39 | 40 | ## Exemplo de utilização 41 | ```java 42 | // Obter informações do CEP 43 | CEP2 cep2 = BrasilAPI.cep2("04538133"); 44 | System.out.println(cep2.getStreet()); 45 | 46 | // Para ativar o log no console 47 | BrasilAPI.setEnableLog(true); 48 | 49 | // Para ativar cache e agilizar consultas repetidas 50 | BrasilAPI.setEnableCache(true); 51 | 52 | // Para definir o tempo de vida do cache 53 | BrasilAPI.setCacheTimeMinutes(10L); 54 | 55 | // Alguns outros métodos implementados de exemplo: 56 | Bank[] banks = BrasilAPI.banks(); 57 | Bank bank = BrasilAPI.bank("1"); 58 | CEP cep = BrasilAPI.cep("04538133"); 59 | CNPJ cnpj = BrasilAPI.cnpj("06.990.590/0001-23"); 60 | Corretora[] corretoras = BrasilAPI.corretoras(); 61 | Corretora corretora = BrasilAPI.corretora("02.332.886/0001-04"); 62 | CPTECCidade[] cptecCidades = BrasilAPI.cptecListarLocalidades(); 63 | CPTECCidade[] cptecCidade = BrasilAPI.cptecBuscarLocalidades("São Paulo"); 64 | CPTECClimaCapital[] cptecClimaCapital = BrasilAPI.cptecCondicoesAtuaisCapitais(); 65 | CPTECClimaAeroporto cptecClimaAeroporto = BrasilAPI.cptecCondicoesAtuaisAeroporto("SBAR"); 66 | CPTECClimaPrevisao cptecClimaPrevisao = BrasilAPI.cptecPrevisaoMeteorologicaCidade(442); 67 | CPTECClimaPrevisao cptecClimaPrevisaoDias = BrasilAPI.cptecPrevisaoMeteorologicaCidade(442, 4); 68 | CPTECOnda cptecOnda = BrasilAPI.cptecPrevisaoOceanica(241); 69 | CPTECOnda cptecOndaDias = BrasilAPI.cptecPrevisaoOceanica(241, 2); 70 | DDD ddd = BrasilAPI.ddd("79"); 71 | Feriados[] feriados = BrasilAPI.feriados("2023"); 72 | FipeMarca[] fipeMarcas = BrasilAPI.fipeMarcas("carros"); 73 | FipePreco[] fipePrecos = BrasilAPI.fipePrecos("031049-2"); 74 | FipeTabela[] fipeTabelas = BrasilAPI.fipeTabelas(); 75 | IBGEMunicipio[] ibgeMunicipios = BrasilAPI.ibgeMunicipios("SE"); 76 | IBGEUF[] ibgeUfs = BrasilAPI.ibgeUf(); 77 | IBGEUF ibgeUf = BrasilAPI.ibgeUf("SE"); 78 | ISBN isbn = BrasilAPI.isbn("9788567097688"); 79 | NCM[] ncms = BrasilAPI.ncm(); 80 | NCM ncm = BrasilAPI.ncm("01"); 81 | NCM[] ncmSearch = BrasilAPI.ncmSearch("Animais vivos."); 82 | PIX[] pix = BrasilAPI.pixParticipantes(); 83 | RegistroBR registroBR = BrasilAPI.registroBR("savio.pw"); 84 | Taxa[] taxas = BrasilAPI.taxas(); 85 | Taxa taxa = BrasilAPI.taxa("SELIC"); 86 | 87 | ``` 88 | 89 | Saiba mais em: [Biblioteca BrasilAPI-Java](https://savio.pw/posts/biblioteca-brasilapi-java) 90 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | br.com.brasilapi 4 | BrasilAPI-Java 5 | 1.1.0 6 | 7 | BrasilAPI 8 | 9 | Biblioteca criada para facilitar o acesso à API 10 | BrasilAPI na linguagem de programação Java. 11 | 12 | https://github.com/SavioAndres/BrasilAPI-Java 13 | 14 | 15 | 16 | MIT License 17 | https://github.com/SavioAndres/BrasilAPI-Java/blob/main/LICENSE 18 | repo 19 | 20 | 21 | 22 | 23 | Github 24 | https://github.com/SavioAndres/BrasilAPI-Java/issues 25 | 26 | 27 | 28 | 29 | Sávio Andres 30 | https://savio.pw 31 | 32 | 33 | 34 | 35 | scm:git@github.com:SavioAndres/BrasilAPI-Java.git 36 | scm:git@github.com:SavioAndres/BrasilAPI-Java.git 37 | git@github.com:SavioAndres/BrasilAPI-Java.git 38 | 39 | 40 | 41 | UTF-8 42 | 43 | 44 | 45 | 46 | github 47 | GitHub Packages 48 | https://maven.pkg.github.com/SavioAndres/BrasilAPI-Java 49 | 50 | 51 | 52 | 53 | 54 | 55 | maven-compiler-plugin 56 | 3.8.1 57 | 58 | 1.8 59 | 1.8 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | org.junit 68 | junit-bom 69 | 5.10.0 70 | pom 71 | import 72 | 73 | 74 | 75 | 76 | 77 | com.google.code.gson 78 | gson 79 | 2.10.1 80 | 81 | 82 | org.junit.jupiter 83 | junit-jupiter 84 | test 85 | 86 | 87 | -------------------------------------------------------------------------------- /src/main/java/br/com/brasilapi/BrasilAPI.java: -------------------------------------------------------------------------------- 1 | package br.com.brasilapi; 2 | 3 | import javax.net.ssl.HttpsURLConnection; 4 | 5 | import com.google.gson.Gson; 6 | 7 | import br.com.brasilapi.api.Bank; 8 | import br.com.brasilapi.api.CEP; 9 | import br.com.brasilapi.api.CEP2; 10 | import br.com.brasilapi.api.CNPJ; 11 | import br.com.brasilapi.api.CPTEC; 12 | import br.com.brasilapi.api.CPTECClimaAeroporto; 13 | import br.com.brasilapi.api.CPTECClimaCapital; 14 | import br.com.brasilapi.api.CPTECCidade; 15 | import br.com.brasilapi.api.CPTECClimaPrevisao; 16 | import br.com.brasilapi.api.CPTECOnda; 17 | import br.com.brasilapi.api.Corretora; 18 | import br.com.brasilapi.api.DDD; 19 | import br.com.brasilapi.api.Feriados; 20 | import br.com.brasilapi.api.FipeMarca; 21 | import br.com.brasilapi.api.FipePreco; 22 | import br.com.brasilapi.api.FipeTabela; 23 | import br.com.brasilapi.api.IBGEMunicipio; 24 | import br.com.brasilapi.api.IBGEUF; 25 | import br.com.brasilapi.api.ISBN; 26 | import br.com.brasilapi.api.NCM; 27 | import br.com.brasilapi.api.PIX; 28 | import br.com.brasilapi.api.RegistroBR; 29 | import br.com.brasilapi.api.Taxa; 30 | 31 | /** 32 | * Biblioteca criada para facilitar o acesso à API BrasilAPI na linguagem de 33 | * programação Java. 34 | * 35 | * Acesso programático de informações é algo fundamental na comunicação entre 36 | * sistemas, mas, para nossa surpresa, uma informação tão útil e pública quanto 37 | * um CEP não consegue ser acessada diretamente por um navegador por conta da 38 | * API dos Correios não possuir CORS habilitado. Dado a isso, este projeto 39 | * experimental tem como objetivo centralizar e disponibilizar endpoints 40 | * modernos com baixíssima latência utilizando tecnologias como Vercel Smart CDN 41 | * responsável por fazer o cache das informações em atualmente 23 regiões 42 | * distribuídas ao longo do mundo (incluindo Brasil). Então não importa o quão 43 | * devagar for a fonte dos dados, nós queremos disponibilizá-la da forma mais 44 | * rápida e moderna possível. 45 | * 46 | * @version 1.1.0 47 | * @author Sávio Andres https://savio.pw 48 | * @see https://brasilapi.com.br/docs 50 | * @see https://github.com/BrasilAPI/BrasilAPI 52 | * @see https://github.com/SavioAndres/BrasilAPI-Java 54 | */ 55 | public class BrasilAPI { 56 | private static final String BAR = "<2F>"; 57 | private static Gson gson = new Gson(); 58 | 59 | /** 60 | * Retorna a conexão relaizada ao endpoint da API, 61 | * dando total liberdade para manipular como desejar. 62 | * @return HttpsURLConnection 63 | */ 64 | public static HttpsURLConnection getHttpsURLConnection() { 65 | return Service.getHttpsURLConnection(); 66 | } 67 | 68 | /** 69 | * Habilitar ou desabilitar Log. 70 | * 71 | * @param enableLog Ativar ou desativar Log. 72 | */ 73 | public static void setEnableLog(boolean enableLog) { 74 | Log.setEnable(enableLog); 75 | } 76 | 77 | /** 78 | * Obter a situação do Log, true = habilitado, false = desabilitado. 79 | * 80 | * @return Situação do Log 81 | */ 82 | public static boolean getEnableLog() { 83 | return Log.getEnable(); 84 | } 85 | 86 | /** 87 | * Habilitar ou desabilitar Cache. Milissegundos padrão para o tempo de vida do 88 | * cache é de 600000, equivalente a 10 minutos. 89 | * 90 | * @param enableCache Ativar ou desativar Cache. 91 | */ 92 | public static void setEnableCache(boolean enableCache) { 93 | Cache.setEnableCache(enableCache); 94 | } 95 | 96 | /** 97 | * Obter a situação do Cache, true = habilitado, false = desabilitado. 98 | * 99 | * @return Situação do Cache 100 | */ 101 | public static boolean getEnableCache() { 102 | return Cache.getEnableCache(); 103 | } 104 | 105 | /** 106 | * Definir o tempo de vida do Cache em milissegundos, o tempo 107 | * padrão é de 600000 milissegundos, equivalente a 10 minutos. 108 | * 109 | * @param time Defina o tempo em milissegundos. Ex: 60000L. 110 | */ 111 | public static void setCacheTime(Long time) { 112 | Cache.setCacheTime(time); 113 | } 114 | 115 | /** 116 | * Obter o tempo de vida do Cache em milissegundos. 117 | * 118 | * @return Obtenha o tempo definido em milissegundos. 119 | */ 120 | public static Long getCacheTime() { 121 | return Cache.getCacheTime(); 122 | } 123 | 124 | /** 125 | * Definir o tempo de vida do Cache em minutos, o tempo padrão 126 | * é de 600000 milissegundos, equivalente a 10 minutos. 127 | * 128 | * @param time Defina o tempo em minutos. Ex: 10L. 129 | */ 130 | public static void setCacheTimeMinutes(Long time) { 131 | Cache.setCacheTime(time * 60000); 132 | } 133 | 134 | /** 135 | * Obter o tempo de vida do Cache em minutos. 136 | * 137 | * @return Long minutos 138 | */ 139 | public static Long getCacheTimeMinutes() { 140 | return Cache.getCacheTime() / 60000; 141 | } 142 | 143 | /** 144 | * Retorna informações de todos os bancos do Brasil. 145 | * 146 | * @return Array de {@link Bank} 147 | */ 148 | public static Bank[] banks() { 149 | Bank[] obj = (Bank[]) api(Bank[].class, "banks/v1", ""); 150 | return obj != null ? (Bank[]) obj.clone() : null; 151 | } 152 | 153 | /** 154 | * Retorna informações de um banco do Brasil de determinado código. 155 | * 156 | * @param code Código 157 | * @return {@link Bank} 158 | */ 159 | public static Bank bank(String code) { 160 | Bank obj = (Bank) api(Bank.class, "banks/v1/", code); 161 | return obj != null ? (Bank) obj.clone() : null; 162 | } 163 | 164 | /** 165 | * Adicione o código do CEP e obtenha o objeto CEP. Método da versão 1. 166 | * 167 | * O CEP (Código de Endereçamento Postal) é um sistema de códigos que visa 168 | * racionalizar o processo de encaminhamento e entrega de correspondências 169 | * através da divisão do paás em regiões postais. ... Atualmente, o CEP é 170 | * composto por oito dígitos, cinco de um lado e três de outro. Cada algarismo 171 | * do CEP possui um significado. 172 | * 173 | * @param cep Código de Endereçamento Postal. 174 | * @return {@link CEP} 175 | * @see #cep2(String) 176 | */ 177 | public static CEP cep(String cep) { 178 | CEP obj = (CEP) api(CEP.class, "cep/v1/", cep); 179 | return obj != null ? (CEP) obj.clone() : null; 180 | } 181 | 182 | /** 183 | * Adicione o código do CEP e obtenha o objeto CEP. Método da versão 2. 184 | * 185 | * O CEP (Código de Endereçamento Postal) é um sistema de códigos que visa 186 | * racionalizar o processo de encaminhamento e entrega de correspondências 187 | * através da divisão do paás em regiões postais. ... Atualmente, o CEP é 188 | * composto por oito dígitos, cinco de um lado e três de outro. Cada algarismo 189 | * do CEP possui um significado. 190 | * 191 | * @param cep Código de Endereçamento Postal. 192 | * @return {@link CEP2} 193 | */ 194 | public static CEP2 cep2(String cep) { 195 | CEP2 obj = (CEP2) api(CEP2.class, "cep/v2/", cep); 196 | return obj != null ? (CEP2) obj.clone() : null; 197 | } 198 | 199 | /** 200 | * O Cadastro Nacional da Pessoa Jurídica é um número único que identifica uma 201 | * pessoa jurídica e outros tipos de arranjo jurídico sem personalidade jurídica 202 | * junto à Receita Federal. 203 | * 204 | * @param cnpj Número do CNPJ 205 | * @return {@link CNPJ} 206 | */ 207 | public static CNPJ cnpj(String cnpj) { 208 | CNPJ obj = (CNPJ) api(CNPJ.class, "cnpj/v1/", cnpj); 209 | return obj != null ? (CNPJ) obj.clone() : null; 210 | } 211 | 212 | /** 213 | * Retorna informações referentes as Corretoras ativas listadas na CVM. 214 | * 215 | * @return Array de {@link Corretora} 216 | */ 217 | public static Corretora[] corretoras() { 218 | Corretora[] obj = (Corretora[]) api(Corretora[].class, "cvm/corretoras/v1", ""); 219 | return obj != null ? (Corretora[]) obj.clone() : null; 220 | } 221 | 222 | /** 223 | * Retorna informações referentes a determinada Corretora ativa listada na CVM. 224 | * 225 | * @param cnpj 226 | * @return {@link Corretora} 227 | */ 228 | public static Corretora corretora(String cnpj) { 229 | Corretora obj = (Corretora) api(Corretora.class, "cvm/corretoras/v1/", cnpj); 230 | return obj != null ? (Corretora) obj.clone() : null; 231 | } 232 | 233 | /** 234 | * Retorna listagem com todas as cidades junto a seus respectivos códigos presentes 235 | * nos serviços da CPTEC. O Código destas cidades será utilizado para os serviços 236 | * de meteorologia e a ondas (previsão oceânica) fornecido pelo centro. Leve em consideração 237 | * que o WebService do CPTEC as vezes é instável, então se não encontrar uma determinada 238 | * cidade na listagem completa, tente buscando por parte de seu nome no endpoint de busca. 239 | * 240 | * @return Lista de {@link CPTECCidade} 241 | */ 242 | public static CPTECCidade[] cptecListarLocalidades() { 243 | CPTEC[] obj = (CPTEC[]) api(CPTEC[].class, "cptec/v1/cidade", ""); 244 | return obj != null ? (CPTEC[]) obj.clone() : null; 245 | } 246 | 247 | /** 248 | * Retorna listagem com todas as cidades correspondentes ao termo pesquisado 249 | * junto a seus respectivos códigos presentes nos serviços da CPTEC. 250 | * O Código destas cidades será utilizado para os serviços de 251 | * meteorologia e a ondas (previsão oceânica) fornecido pelo centro. 252 | * 253 | * @param nomeCidade 254 | * @return Lista de {@link CPTECCidade} 255 | */ 256 | public static CPTECCidade[] cptecBuscarLocalidades(String nomeCidade) { 257 | CPTEC[] obj = (CPTEC[]) api(CPTEC[].class, "cptec/v1/cidade/", nomeCidade); 258 | return obj != null ? (CPTECCidade[]) obj.clone() : null; 259 | } 260 | 261 | /** 262 | * Retorna condições meteorológicas atuais nas capitais do país, 263 | * com base nas estações de solo de seu aeroporto. 264 | * 265 | * @return Lista de {@link CPTECClimaCapital} 266 | */ 267 | public static CPTECClimaCapital[] cptecCondicoesAtuaisCapitais() { 268 | CPTEC[] obj = (CPTEC[]) api(CPTEC[].class, "cptec/v1/clima/capital", ""); 269 | return obj != null ? (CPTECClimaCapital[]) obj.clone() : null; 270 | } 271 | 272 | /** 273 | * Retorna condições meteorológicas atuais no aeroporto solicitado. 274 | * Este endpoint utiliza o código ICAO (4 dígitos) do aeroporto. 275 | * 276 | * @param icaoCode Código ICAO do aeroporto 277 | * @return {@link CPTECClimaAeroporto} 278 | */ 279 | public static CPTECClimaAeroporto cptecCondicoesAtuaisAeroporto(String icaoCode) { 280 | CPTEC obj = (CPTEC) api(CPTEC.class, "cptec/v1/clima/aeroporto/", icaoCode); 281 | return obj != null ? (CPTECClimaAeroporto) obj.clone() : null; 282 | } 283 | 284 | /** 285 | * Retorna Pervisão meteorológica para 1 dia na cidade informada. 286 | * 287 | * @param codigoCidade 288 | * @return {@link CPTECClimaPrevisao} 289 | */ 290 | public static CPTECClimaPrevisao cptecPrevisaoMeteorologicaCidade(Integer codigoCidade) { 291 | CPTEC obj = (CPTEC) api(CPTEC.class, "cptec/v1/clima/previsao/", String.valueOf(codigoCidade)); 292 | return obj != null ? (CPTECClimaPrevisao) obj.clone() : null; 293 | } 294 | 295 | /** 296 | * Retorna a previsão meteorológica para a cidade informada para um período de 1 até 6 dias. 297 | * Devido a inconsistências encontradas nos retornos da CPTEC nossa API só consegue 298 | * retornar com precisão o período máximo de 6 dias. 299 | * 300 | * @param codigoCidade 301 | * @param dias Número de dias, máximo 6. 302 | * @return {@link CPTECClimaPrevisao} 303 | */ 304 | public static CPTECClimaPrevisao cptecPrevisaoMeteorologicaCidade(Integer codigoCidade, Integer dias) { 305 | CPTEC obj = (CPTEC) api(CPTEC.class, "cptec/v1/clima/previsao/", codigoCidade + BAR + dias); 306 | return obj != null ? (CPTECClimaPrevisao) obj.clone() : null; 307 | } 308 | 309 | /** 310 | * Retorna a previsão oceânica para a cidade informada para 1 dia. 311 | * 312 | * @param codigoCidade 313 | * @return {@link CPTECOnda} 314 | */ 315 | public static CPTECOnda cptecPrevisaoOceanica(Integer codigoCidade) { 316 | CPTEC obj = (CPTEC) api(CPTEC.class, "cptec/v1/ondas/", String.valueOf(codigoCidade)); 317 | return obj != null ? (CPTECOnda) obj.clone() : null; 318 | } 319 | 320 | /** 321 | * Retorna a previsão oceânica para a cidade informada para um período de, até, 6 dias. 322 | * 323 | * @param codigoCidade 324 | * @param dias Número de dias, máximo 6. 325 | * @return {@link CPTECOnda} 326 | */ 327 | public static CPTECOnda cptecPrevisaoOceanica(Integer codigoCidade, Integer dias) { 328 | CPTEC obj = (CPTEC) api(CPTEC.class, "cptec/v1/ondas/", codigoCidade + BAR + dias); 329 | return obj != null ? (CPTECOnda) obj.clone() : null; 330 | } 331 | 332 | /** 333 | * DDD significa Discagem Direta à Distância. é um sistema de ligação telefônica 334 | * automática entre diferentes áreas urbanas nacionais. O DDD é um código 335 | * constituído por 2 dígitos que identificam as principais cidades do país e 336 | * devem ser adicionados ao nº de telefone, juntamente com o código da 337 | * operadora. 338 | * 339 | * @param ddd Código do DDD. Ex: 79. 340 | * @return {@link DDD} 341 | */ 342 | public static DDD ddd(String ddd) { 343 | DDD obj = (DDD) api(DDD.class, "ddd/v1/", ddd); 344 | return obj != null ? (DDD) obj.clone() : null; 345 | } 346 | 347 | /** 348 | * Lista os feriados nacionais de determinado ano. 349 | * 350 | * @param ano Ano que deseja obter os feriados. 351 | * @return {@link Feriados} 352 | */ 353 | public static Feriados[] feriados(String ano) { 354 | Feriados[] obj = (Feriados[]) api(Feriados[].class, "feriados/v1/", ano); 355 | return obj != null ? (Feriados[]) obj.clone() : null; 356 | } 357 | 358 | /** 359 | * Os tipos suportados são caminhoes, carros e motos. 360 | * Quando o tipo não é especificado são buscada as marcas de todos os tipos de 361 | * veículos. 362 | * 363 | * @param tipoVeiculo caminhoes, carros, motos. 364 | * @return Array de {@link FipeMarca} 365 | */ 366 | public static FipeMarca[] fipeMarcas(String tipoVeiculo) { 367 | FipeMarca[] obj = (FipeMarca[]) api(FipeMarca[].class, "fipe/marcas/v1/", tipoVeiculo); 368 | return obj != null ? (FipeMarca[]) obj.clone() : null; 369 | } 370 | 371 | /** 372 | * Código da tabela fipe de referência. Por padrão é utilizado o código da 373 | * tabela fipe atual. 374 | * 375 | * @param codigoFipe Código fipe do veículo. 376 | * @return Array de {@link FipePreco} 377 | */ 378 | public static FipePreco[] fipePrecos(String codigoFipe) { 379 | FipePreco[] obj = (FipePreco[]) api(FipePreco[].class, "fipe/preco/v1/", codigoFipe); 380 | return obj != null ? (FipePreco[]) obj.clone() : null; 381 | } 382 | 383 | /** 384 | * Lista as tabelas de referência existentes. 385 | * 386 | * @return Array de {@link FipeTabela} 387 | */ 388 | public static FipeTabela[] fipeTabelas() { 389 | FipeTabela[] obj = (FipeTabela[]) api(FipeTabela[].class, "fipe/tabelas/v1", ""); 390 | return obj != null ? (FipeTabela[]) obj.clone() : null; 391 | } 392 | 393 | /** 394 | * Informações sobre municípios de determinado estados provenientes do IBGE. 395 | * 396 | * @param siglaUF Sigla da unidade federativa, por exemplo SP, RJ, SC, etc. 397 | * @return Array de {@link IBGEMunicipio} 398 | */ 399 | public static IBGEMunicipio[] ibgeMunicipios(String siglaUF) { 400 | IBGEMunicipio[] obj = (IBGEMunicipio[]) api(IBGEMunicipio[].class, "ibge/municipios/v1/", siglaUF); 401 | return obj != null ? (IBGEMunicipio[]) obj.clone() : null; 402 | } 403 | 404 | /** 405 | * Informações sobre municípios de determinado estados provenientes do IBGE. 406 | * 407 | * @param siglaUF Sigla da unidade federativa, por exemplo: SP, RJ, SC, etc. 408 | * @param providers Array de String. Provedores dos dados. Provedores 409 | * disponíves: dados-abertos-br, gov, wikipedia. 410 | * @return Array de {@link IBGEMunicipio} 411 | * @see https://brasilapi.com.br/docs#tag/IBGE 413 | */ 414 | public static IBGEMunicipio[] ibgeMunicipios(String siglaUF, String[] providers) { 415 | String providesParameter = "?providers=dados-abertos-br,gov,wikipedia"; 416 | if (providers != null) { 417 | providesParameter = "?providers="; 418 | for (String provider : providers) { 419 | providesParameter += provider + ","; 420 | } 421 | providesParameter = providesParameter.substring(0, providesParameter.length() - 1); 422 | } 423 | 424 | IBGEMunicipio[] obj = (IBGEMunicipio[]) api(IBGEMunicipio[].class, "ibge/municipios/v1/", 425 | siglaUF + providesParameter); 426 | return obj != null ? (IBGEMunicipio[]) obj.clone() : null; 427 | } 428 | 429 | /** 430 | * Retorna informações de todos estados do Brasil. 431 | * 432 | * @return Array de {@link IBGEUF} 433 | */ 434 | public static IBGEUF[] ibgeUf() { 435 | IBGEUF[] obj = (IBGEUF[]) api(IBGEUF[].class, "ibge/uf/v1", ""); 436 | return obj != null ? (IBGEUF[]) obj.clone() : null; 437 | } 438 | 439 | /** 440 | * Retorna informações de determinado estados do Brasil. 441 | * 442 | * @param sigla ou id 443 | * @return {@link IBGEUF} 444 | */ 445 | public static IBGEUF ibgeUf(String sigla) { 446 | IBGEUF obj = (IBGEUF) api(IBGEUF.class, "ibge/uf/v1/", sigla); 447 | return obj != null ? (IBGEUF) obj.clone() : null; 448 | } 449 | 450 | /** 451 | * Sistema internacional de identificação de livros. 452 | * 453 | * O código informado pode conter traços (-) e ambos os formatos são aceitos, 454 | * sendo eles o obsoleto de 10 dígitos e o atual de 13 dígitos. 455 | * 456 | * @param isbn Código isbn. 457 | * @return {@link ISBN} 458 | */ 459 | public static ISBN isbn(String isbn) { 460 | ISBN obj = (ISBN) api(ISBN.class, "isbn/v1/", isbn); 461 | return obj != null ? (ISBN) obj.clone() : null; 462 | } 463 | 464 | /** 465 | * Sistema internacional de identificação de livros. 466 | * 467 | * O código informado pode conter traços (-) e ambos os formatos são aceitos, 468 | * sendo eles o obsoleto de 10 dígitos e o atual de 13 dígitos. 469 | * 470 | * Lista de provedores separados por vírgula. Se não especificado, será 471 | * realizado uma busca em todos os provedores e o que retornar as informações 472 | * mais rapidamente será o escolhido. 473 | * 474 | * @param isbn Código isbn. 475 | * @param providers Array de String. Provedores dos dados. Provedores 476 | * disponíves: cbl, mercado-editorial, open-library, 477 | * google-books. 478 | * @return {@link ISBN} 479 | */ 480 | public static ISBN isbn(String isbn, String[] providers) { 481 | String providesParameter = ""; 482 | if (providers != null) { 483 | providesParameter = "?providers="; 484 | for (String provider : providers) { 485 | providesParameter += provider + ","; 486 | } 487 | providesParameter = providesParameter.substring(0, providesParameter.length() - 1); 488 | } 489 | 490 | ISBN obj = (ISBN) api(ISBN.class, "isbn/v1/", isbn + providesParameter); 491 | return obj != null ? (ISBN) obj.clone() : null; 492 | } 493 | 494 | /** 495 | * Retorna informações de todos os NCMs. 496 | * 497 | * @return Array de {@link NCM} 498 | */ 499 | public static NCM[] ncm() { 500 | NCM[] obj = (NCM[]) api(NCM[].class, "ncm/v1", ""); 501 | return obj != null ? (NCM[]) obj.clone() : null; 502 | } 503 | 504 | /** 505 | * Busca as informações de um NCM a partir de um código. 506 | * 507 | * @param code Código da Nomenclatura Comum do Mercosul. 508 | * @return Array de {@link NCM} 509 | */ 510 | public static NCM ncm(String code) { 511 | NCM obj = (NCM) api(NCM.class, "ncm/v1/", code); 512 | return obj != null ? (NCM) obj.clone() : null; 513 | } 514 | 515 | /** 516 | * Pesquisa por NCMs a partir de um código ou descrição. 517 | * 518 | * @param code ou descrição da Nomenclatura Comum do Mercosul. 519 | * @return Array de {@link NCM} 520 | */ 521 | public static NCM[] ncmSearch(String code) { 522 | NCM[] obj = (NCM[]) api(NCM[].class, "ncm/v1?search=", code); 523 | return obj != null ? (NCM[]) obj.clone() : null; 524 | } 525 | 526 | /** 527 | * Retorna informações de todos os participantes do PIX no dia atual ou anterior. 528 | * 529 | * @return Array de {@link PIX} 530 | */ 531 | public static PIX[] pixParticipantes() { 532 | PIX[] obj = (PIX[]) api(PIX[].class, "pix/v1/participants", ""); 533 | return obj != null ? (PIX[]) obj.clone() : null; 534 | } 535 | 536 | /** 537 | * Avalia o status de um dominio .br 538 | * 539 | * @param domain Endereço eletrônico. Ex: savio.pw 540 | * @return {@link RegistroBR} 541 | */ 542 | public static RegistroBR registroBR(String domain) { 543 | RegistroBR obj = (RegistroBR) api(RegistroBR.class, "registrobr/v1/", domain); 544 | return obj != null ? (RegistroBR) obj.clone() : null; 545 | } 546 | 547 | /** 548 | * Retorna as taxas de juros e alguns índices oficiais do Brasil. 549 | * 550 | * @return Array de {@link Taxa} 551 | */ 552 | public static Taxa[] taxas() { 553 | Taxa[] obj = (Taxa[]) api(Taxa[].class, "taxas/v1", ""); 554 | return obj != null ? (Taxa[]) obj.clone() : null; 555 | } 556 | 557 | /** 558 | * Busca as informações de uma taxa a partir do seu nome/sigla. 559 | * 560 | * @param sigla Ex: SELIC. 561 | * @return {@link Taxa} 562 | */ 563 | public static Taxa taxa(String sigla) { 564 | Taxa obj = (Taxa) api(Taxa.class, "taxas/v1/", sigla); 565 | return obj != null ? (Taxa) obj.clone() : null; 566 | } 567 | 568 | /** 569 | * Método responsável por verificar se o Cache está habilitado e fazer enviar os 570 | * dados para conexão com a WEB, após isso fazer a conversão do dado bruto em 571 | * Json para o Objeto em questão. 572 | * 573 | * @param classAPIModel Classe Objeto da qual está tratando. 574 | * @param parameter da URL. 575 | * @param code valor enviada com o parâmetro. 576 | * @return {@link Object} 577 | */ 578 | private static Object api(Class classAPIModel, String parameter, String code) { 579 | try { 580 | code = code.replaceAll("/", "").replaceAll(BAR, "/"); 581 | if (Cache.getEnableCache()) { 582 | Object obj = Cache.getCache(classAPIModel, code); 583 | 584 | if (obj == null) { 585 | String json = Service.connection(parameter + code); 586 | if (json != null) { 587 | obj = gson.fromJson(json, classAPIModel); 588 | Cache.setCache(classAPIModel, code, obj); 589 | } 590 | } 591 | 592 | return obj; 593 | } else { 594 | String json = Service.connection(parameter + code); 595 | return gson.fromJson(json, classAPIModel); 596 | } 597 | } catch (Exception e) { 598 | Log.setConsoleError(e.getMessage()); 599 | return null; 600 | } 601 | } 602 | 603 | public static void main(String[] args) { 604 | final String VERSION = "v1.1.0"; 605 | 606 | System.out.println("" 607 | + " ____ _ _ _ ____ ___ _ \r\n" 608 | + " | __ ) _ __ __ _ ___(_) | / \\ | _ \\_ _| | | __ ___ ____ _ \r\n" 609 | + " | _ \\| '__/ _` / __| | | / _ \\ | |_) | |_____ _ | |/ _` \\ \\ / / _` |\r\n" 610 | + " | |_) | | | (_| \\__ \\ | |/ ___ \\| __/| |_____| |_| | (_| |\\ V / (_| |\r\n" 611 | + " |____/|_| \\__,_|___/_|_/_/ \\_\\_| |___| \\___/ \\__,_| \\_/ \\__,_|\r\n" 612 | + "\r\n BrasilAPI-Java. Version \u001B[42m" + VERSION + "\u001B[0m" 613 | + "\r\n https://github.com/SavioAndres/BrasilAPI-Java"); 614 | } 615 | 616 | } 617 | -------------------------------------------------------------------------------- /src/main/java/br/com/brasilapi/Cache.java: -------------------------------------------------------------------------------- 1 | package br.com.brasilapi; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | class Cache { 7 | private static boolean enableCache = false; 8 | private static Long startTime = System.currentTimeMillis(); 9 | private static Long cacheTime = 600000L; 10 | private static Map, Map> mapCache = new HashMap<>(); 11 | 12 | protected Cache() { 13 | } 14 | 15 | protected static void setEnableCache(boolean enableCache) { 16 | Cache.enableCache = enableCache; 17 | } 18 | 19 | protected static boolean getEnableCache() { 20 | return Cache.enableCache; 21 | } 22 | 23 | protected static void setCacheTime(Long time) { 24 | Cache.enableCache = true; 25 | Cache.cacheTime = time; 26 | } 27 | 28 | protected static Long getCacheTime() { 29 | return Cache.cacheTime; 30 | } 31 | 32 | protected static void setCache(Class classAPIModel, String code, Object obj) { 33 | updateCache(); 34 | 35 | if (!mapCache.containsKey(classAPIModel)) { 36 | Map mapObj = new HashMap<>(); 37 | mapCache.put(classAPIModel, mapObj); 38 | Log.setConsole("Salvo em Cache."); 39 | } 40 | 41 | mapCache.get(classAPIModel).put(code, obj); 42 | } 43 | 44 | protected static Object getCache(Class classAPIModel, String code) { 45 | updateCache(); 46 | 47 | if (!mapCache.containsKey(classAPIModel)) { 48 | return null; 49 | } 50 | 51 | Object obj = mapCache.get(classAPIModel).get(code); 52 | 53 | if (obj != null) { 54 | Log.setConsole("Obtido do Cache."); 55 | return obj; 56 | } 57 | 58 | return null; 59 | } 60 | 61 | /** 62 | * Verifica e atualiza o Cache limpando e redefinido o tempo atual. 63 | */ 64 | private static void updateCache() { 65 | // Caso o tempo do Cache definido do Cache tenha excedido 66 | if (!mapCache.isEmpty() && System.currentTimeMillis() - startTime > cacheTime) { 67 | 68 | // Log do Cache a ser limpo 69 | Log.setConsole("Cache atual a ser limpo: " + mapCache.toString()); 70 | 71 | // Limpar Cache 72 | mapCache.clear(); 73 | 74 | // Atualizar tempo atual 75 | startTime = System.currentTimeMillis(); 76 | 77 | // Log do Cache atual 78 | Log.setConsole("Tempo de " + cacheTime 79 | + " milissegundos excedido.\nCache limpo. Cache atual: " 80 | + mapCache.toString()); 81 | 82 | } 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /src/main/java/br/com/brasilapi/Log.java: -------------------------------------------------------------------------------- 1 | package br.com.brasilapi; 2 | 3 | class Log { 4 | private static boolean enable = false; 5 | 6 | protected static void setEnable(boolean enable) { 7 | Log.enable = enable; 8 | } 9 | 10 | protected static boolean getEnable() { 11 | return Log.enable; 12 | } 13 | 14 | protected static void setConsole(String msg) { 15 | if (Log.enable) { 16 | System.out.println(msg); 17 | } 18 | } 19 | 20 | protected static void setConsoleError(String msg) { 21 | if (Log.enable) { 22 | System.err.println(msg); 23 | } 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/br/com/brasilapi/Service.java: -------------------------------------------------------------------------------- 1 | package br.com.brasilapi; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.IOException; 5 | import java.io.InputStreamReader; 6 | import java.net.URL; 7 | 8 | import javax.net.ssl.HttpsURLConnection; 9 | 10 | class Service { 11 | private static HttpsURLConnection connection; 12 | 13 | protected Service() { 14 | } 15 | 16 | protected static HttpsURLConnection getHttpsURLConnection() { 17 | return connection; 18 | } 19 | 20 | protected static String connection(String urlParameter) { 21 | String json = null; 22 | 23 | try { 24 | URL url = new URL("https://brasilapi.com.br/api/" + urlParameter); 25 | 26 | Log.setConsole("Acessando: " + url); 27 | 28 | connection = (HttpsURLConnection) url.openConnection(); 29 | connection.setDoOutput(true); 30 | connection.setRequestMethod("GET"); 31 | 32 | if (Log.getEnable() && connection.getResponseCode() != HttpsURLConnection.HTTP_OK) { 33 | Log.setConsoleError("ERROR. HTTP error code: " + connection.getResponseCode() + "\n"); 34 | } 35 | 36 | BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8")); 37 | 38 | String output, retorno = ""; 39 | 40 | while ((output = br.readLine()) != null) { 41 | retorno += output; 42 | } 43 | 44 | json = retorno; 45 | 46 | Log.setConsole("Json retornado: " + json); 47 | 48 | } catch (IOException e) { 49 | Log.setConsoleError(e.getMessage()); 50 | //conector.disconnect(); 51 | //e.printStackTrace(); 52 | } 53 | 54 | return json; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/br/com/brasilapi/api/API.java: -------------------------------------------------------------------------------- 1 | package br.com.brasilapi.api; 2 | 3 | class API implements Cloneable { 4 | 5 | @Override 6 | public Object clone() { 7 | try { 8 | return super.clone(); 9 | } catch (CloneNotSupportedException e) { 10 | return null; 11 | } 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/br/com/brasilapi/api/Bank.java: -------------------------------------------------------------------------------- 1 | package br.com.brasilapi.api; 2 | 3 | import java.util.Objects; 4 | 5 | /** 6 | * Retorna informações de todos os bancos do Brasil. 7 | * 8 | * @author Sávio Andres 9 | * @see https://brasilapi.com.br/docs#tag/BANKS 11 | */ 12 | public class Bank extends API { 13 | private String ispb; 14 | private String name; 15 | private String code; 16 | private String fullName; 17 | 18 | public String getIspb() { 19 | return ispb; 20 | } 21 | 22 | public void setIspb(String ispb) { 23 | this.ispb = ispb; 24 | } 25 | 26 | public String getName() { 27 | return name; 28 | } 29 | 30 | public void setName(String name) { 31 | this.name = name; 32 | } 33 | 34 | public String getCode() { 35 | return code; 36 | } 37 | 38 | public void setCode(String code) { 39 | this.code = code; 40 | } 41 | 42 | public String getFullName() { 43 | return fullName; 44 | } 45 | 46 | public void setFullName(String fullName) { 47 | this.fullName = fullName; 48 | } 49 | 50 | @Override 51 | public int hashCode() { 52 | return Objects.hash(code, fullName, ispb, name); 53 | } 54 | 55 | @Override 56 | public boolean equals(Object obj) { 57 | if (this == obj) 58 | return true; 59 | if (obj == null) 60 | return false; 61 | if (getClass() != obj.getClass()) 62 | return false; 63 | Bank other = (Bank) obj; 64 | return Objects.equals(code, other.code) && Objects.equals(fullName, other.fullName) 65 | && Objects.equals(ispb, other.ispb) && Objects.equals(name, other.name); 66 | } 67 | 68 | @Override 69 | public String toString() { 70 | return "Banks [ispb=" + ispb + ", name=" + name + ", code=" + code + ", fullName=" + fullName + "]"; 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/br/com/brasilapi/api/CEP.java: -------------------------------------------------------------------------------- 1 | package br.com.brasilapi.api; 2 | 3 | import java.util.Objects; 4 | 5 | /** 6 | * Classe CEP. Representa o CEP com seus atributos. 7 | * 8 | * O CEP (Código de Endereçamento Postal) é um sistema de códigos que visa 9 | * racionalizar o processo de encaminhamento e entrega de correspondências 10 | * através da divisão do paás em regiões postais. ... Atualmente, o CEP é 11 | * composto por oito dígitos, cinco de um lado e três de outro. Cada algarismo 12 | * do CEP possui um significado. 13 | * 14 | * @version 1 15 | * @author Sávio Andres 16 | * @see br.com.brasilapi.api.CEP2 17 | * @see https://brasilapi.com.br/docs#tag/CEP 19 | */ 20 | public class CEP extends API { 21 | private String cep; 22 | private String state; 23 | private String city; 24 | private String neighborhood; 25 | private String street; 26 | private String service; 27 | 28 | public String getCep() { 29 | return cep; 30 | } 31 | 32 | public void setCep(String cep) { 33 | this.cep = cep; 34 | } 35 | 36 | public String getState() { 37 | return state; 38 | } 39 | 40 | public void setState(String state) { 41 | this.state = state; 42 | } 43 | 44 | public String getCity() { 45 | return city; 46 | } 47 | 48 | public void setCity(String city) { 49 | this.city = city; 50 | } 51 | 52 | public String getNeighborhood() { 53 | return neighborhood; 54 | } 55 | 56 | public void setNeighborhood(String neighborhood) { 57 | this.neighborhood = neighborhood; 58 | } 59 | 60 | public String getStreet() { 61 | return street; 62 | } 63 | 64 | public void setStreet(String street) { 65 | this.street = street; 66 | } 67 | 68 | public String getService() { 69 | return service; 70 | } 71 | 72 | public void setService(String service) { 73 | this.service = service; 74 | } 75 | 76 | @Override 77 | public int hashCode() { 78 | return Objects.hash(cep, city, neighborhood, service, state, street); 79 | } 80 | 81 | @Override 82 | public boolean equals(Object obj) { 83 | if (this == obj) 84 | return true; 85 | if (obj == null) 86 | return false; 87 | if (getClass() != obj.getClass()) 88 | return false; 89 | CEP other = (CEP) obj; 90 | return Objects.equals(cep, other.cep) && Objects.equals(city, other.city) 91 | && Objects.equals(neighborhood, other.neighborhood) && Objects.equals(service, other.service) 92 | && Objects.equals(state, other.state) && Objects.equals(street, other.street); 93 | } 94 | 95 | @Override 96 | public String toString() { 97 | return "Cep [cep=" + cep + ", state=" + state + ", city=" + city + ", neighborhood=" + neighborhood 98 | + ", street=" + street + ", service=" + service + "]"; 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /src/main/java/br/com/brasilapi/api/CEP2.java: -------------------------------------------------------------------------------- 1 | package br.com.brasilapi.api; 2 | 3 | import java.util.Objects; 4 | 5 | /** 6 | * Classe CEP2. Representa o CEP com seus atributos. 7 | * 8 | * O CEP (Código de Endereçamento Postal) é um sistema de códigos que visa 9 | * racionalizar o processo de encaminhamento e entrega de correspondências 10 | * através da divisão do paás em regiões postais. ... Atualmente, o CEP é 11 | * composto por oito dígitos, cinco de um lado e três de outro. Cada algarismo 12 | * do CEP possui um significado. 13 | * 14 | * @author Sávio Andres 15 | * @version 2 16 | * @see https://brasilapi.com.br/docs#tag/CEP-V2 18 | */ 19 | public class CEP2 extends API { 20 | private String cep; 21 | private String state; 22 | private String city; 23 | private String neighborhood; 24 | private String street; 25 | private String service; 26 | private Location location; 27 | 28 | public String getCep() { 29 | return cep; 30 | } 31 | 32 | public void setCep(String cep) { 33 | this.cep = cep; 34 | } 35 | 36 | public String getState() { 37 | return state; 38 | } 39 | 40 | public void setState(String state) { 41 | this.state = state; 42 | } 43 | 44 | public String getCity() { 45 | return city; 46 | } 47 | 48 | public void setCity(String city) { 49 | this.city = city; 50 | } 51 | 52 | public String getNeighborhood() { 53 | return neighborhood; 54 | } 55 | 56 | public void setNeighborhood(String neighborhood) { 57 | this.neighborhood = neighborhood; 58 | } 59 | 60 | public String getStreet() { 61 | return street; 62 | } 63 | 64 | public void setStreet(String street) { 65 | this.street = street; 66 | } 67 | 68 | public String getService() { 69 | return service; 70 | } 71 | 72 | public void setService(String service) { 73 | this.service = service; 74 | } 75 | 76 | public Location getLocation() { 77 | return location; 78 | } 79 | 80 | public void setLocation(Location location) { 81 | this.location = location; 82 | } 83 | 84 | @Override 85 | public int hashCode() { 86 | return Objects.hash(cep, city, location, neighborhood, service, state, street); 87 | } 88 | 89 | @Override 90 | public boolean equals(Object obj) { 91 | if (this == obj) 92 | return true; 93 | if (obj == null) 94 | return false; 95 | if (getClass() != obj.getClass()) 96 | return false; 97 | CEP2 other = (CEP2) obj; 98 | return Objects.equals(cep, other.cep) && Objects.equals(city, other.city) 99 | && Objects.equals(location, other.location) && Objects.equals(neighborhood, other.neighborhood) 100 | && Objects.equals(service, other.service) && Objects.equals(state, other.state) 101 | && Objects.equals(street, other.street); 102 | } 103 | 104 | @Override 105 | public String toString() { 106 | return "Cep [cep=" + cep + ", state=" + state + ", city=" + city + ", neighborhood=" + neighborhood 107 | + ", street=" + street + ", service=" + service + ", location=" + location + "]"; 108 | } 109 | 110 | public class Location { 111 | private String type; 112 | private Coordinates coordinates; 113 | 114 | public String getType() { 115 | return type; 116 | } 117 | 118 | public void setType(String type) { 119 | this.type = type; 120 | } 121 | 122 | public Coordinates getCoordinates() { 123 | return coordinates; 124 | } 125 | 126 | public void setCoordinates(Coordinates coordinates) { 127 | this.coordinates = coordinates; 128 | } 129 | 130 | @Override 131 | public int hashCode() { 132 | final int prime = 31; 133 | int result = 1; 134 | result = prime * result + getEnclosingInstance().hashCode(); 135 | result = prime * result + Objects.hash(coordinates, type); 136 | return result; 137 | } 138 | 139 | @Override 140 | public boolean equals(Object obj) { 141 | if (this == obj) 142 | return true; 143 | if (obj == null) 144 | return false; 145 | if (getClass() != obj.getClass()) 146 | return false; 147 | Location other = (Location) obj; 148 | if (!getEnclosingInstance().equals(other.getEnclosingInstance())) 149 | return false; 150 | return Objects.equals(coordinates, other.coordinates) && Objects.equals(type, other.type); 151 | } 152 | 153 | @Override 154 | public String toString() { 155 | return "Location [type=" + type + ", coordinates=" + coordinates + "]"; 156 | } 157 | 158 | 159 | public class Coordinates { 160 | private String longitude; 161 | private String latitude; 162 | 163 | public String getLongitude() { 164 | return longitude; 165 | } 166 | 167 | public void setLongitude(String longitude) { 168 | this.longitude = longitude; 169 | } 170 | 171 | public String getLatitude() { 172 | return latitude; 173 | } 174 | 175 | public void setLatitude(String latitude) { 176 | this.latitude = latitude; 177 | } 178 | 179 | @Override 180 | public int hashCode() { 181 | final int prime = 31; 182 | int result = 1; 183 | result = prime * result + getEnclosingInstance().hashCode(); 184 | result = prime * result + Objects.hash(latitude, longitude); 185 | return result; 186 | } 187 | 188 | @Override 189 | public boolean equals(Object obj) { 190 | if (this == obj) 191 | return true; 192 | if (obj == null) 193 | return false; 194 | if (getClass() != obj.getClass()) 195 | return false; 196 | Coordinates other = (Coordinates) obj; 197 | if (!getEnclosingInstance().equals(other.getEnclosingInstance())) 198 | return false; 199 | return Objects.equals(latitude, other.latitude) && Objects.equals(longitude, other.longitude); 200 | } 201 | 202 | @Override 203 | public String toString() { 204 | return "Coordinates [longitude=" + longitude + ", latitude=" + latitude + "]"; 205 | } 206 | 207 | private Location getEnclosingInstance() { 208 | return Location.this; 209 | } 210 | 211 | } 212 | 213 | 214 | private CEP2 getEnclosingInstance() { 215 | return CEP2.this; 216 | } 217 | 218 | } 219 | 220 | } 221 | -------------------------------------------------------------------------------- /src/main/java/br/com/brasilapi/api/CNPJ.java: -------------------------------------------------------------------------------- 1 | package br.com.brasilapi.api; 2 | 3 | import java.util.Arrays; 4 | import java.util.Objects; 5 | 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | /** 9 | * O Cadastro Nacional da Pessoa Jurídica é um número único que identifica uma 10 | * pessoa jurídica e outros tipos de arranjo jurídico sem personalidade jurídica 11 | * junto à Receita Federal. 12 | * 13 | * @version 1 14 | * @author Sávio Andres 15 | * @see https://brasilapi.com.br/docs#tag/CNPJ 17 | */ 18 | public class CNPJ extends API { 19 | private String uf; 20 | private String cep; 21 | private Qsa[] qsa; 22 | private String cnpj; 23 | private String pais; 24 | private String email; 25 | private String porte; 26 | private String bairro; 27 | private String numero; 28 | @SerializedName("ddd_fax") 29 | private String dddFax; 30 | private String municipio; 31 | private String logradouro; 32 | @SerializedName("cnae_fiscal") 33 | private Integer cnaeFiscal; 34 | @SerializedName("codigo_pais") 35 | private Integer codigoPais; 36 | private String complemento; 37 | @SerializedName("codigo_porte") 38 | private Integer codigoPorte; 39 | @SerializedName("razao_social") 40 | private String razaoSocial; 41 | @SerializedName("nome_fantasia") 42 | private String nomeFantasia; 43 | @SerializedName("capital_social") 44 | private Double capitalSocial; 45 | @SerializedName("ddd_telefone_1") 46 | private String dddTelefone1; 47 | @SerializedName("ddd_telefone_2") 48 | private String dddTelefone2; 49 | @SerializedName("opcao_pelo_mei") 50 | private String opcaoPeloMei; 51 | @SerializedName("descricao_porte") 52 | private String descricaoPorte; 53 | @SerializedName("codigo_municipio") 54 | private Integer codigoMunicipio; 55 | @SerializedName("cnaes_secundarios") 56 | private CnaesSecundario[] cnaesSecundarios; 57 | @SerializedName("natureza_juridica") 58 | private String naturezaJuridica; 59 | @SerializedName("situacao_especial") 60 | private String situacaoEspecial; 61 | @SerializedName("opcao_pelo_simples") 62 | private String opcaoPeloSimples; 63 | @SerializedName("situacao_cadastral") 64 | private Integer situacaoCadastral; 65 | @SerializedName("data_opcao_pelo_mei") 66 | private String dataOpcaoPeloMei; 67 | @SerializedName("data_exclusao_do_mei") 68 | private String dataExclusaoDoMei; 69 | @SerializedName("cnae_fiscal_descricao") 70 | private String cnaeFiscalDescricao; 71 | @SerializedName("codigo_municipio_ibge") 72 | private Integer codigoMunicipioIbge; 73 | @SerializedName("data_inicio_atividade") 74 | private String dataInicioAtividade; 75 | @SerializedName("data_situacao_especial") 76 | private String dataSituacaoEspecial; 77 | @SerializedName("data_opcao_pelo_simples") 78 | private String dataOpcaoPeloSimples; 79 | @SerializedName("data_situacao_cadastral") 80 | private String dataSituacaoCadastral; 81 | @SerializedName("nome_cidade_no_exterior") 82 | private String nomeCidadeNoExterior; 83 | @SerializedName("codigo_natureza_juridica") 84 | private Integer codigoNaturezaJuridica; 85 | @SerializedName("data_exclusao_do_simples") 86 | private String dataExclusaoDoSimples; 87 | @SerializedName("motivo_situacao_cadastral") 88 | private Integer motivoSituacaoCadastral; 89 | @SerializedName("ente_federativo_responsavel") 90 | private String enteFederativoResponsavel; 91 | @SerializedName("identificador_matriz_filial") 92 | private Integer identificadorMatrizFilial; 93 | @SerializedName("qualificacao_do_responsavel") 94 | private Integer qualificacaoDoResponsavel; 95 | @SerializedName("descricao_situacao_cadastral") 96 | private String descricaoSituacaoCadastral; 97 | @SerializedName("descricao_tipo_de_logradouro") 98 | private String descricaoTipoDeLogradouro; 99 | @SerializedName("descricao_motivo_situacao_cadastral") 100 | private String descricaoMotivoSituacaoCadastral; 101 | @SerializedName("descricao_identificador_matriz_filial") 102 | private String descricaoIdentificadorMatrizFilial; 103 | 104 | public String getUf() { 105 | return uf; 106 | } 107 | 108 | public void setUf(String uf) { 109 | this.uf = uf; 110 | } 111 | 112 | public String getCep() { 113 | return cep; 114 | } 115 | 116 | public void setCep(String cep) { 117 | this.cep = cep; 118 | } 119 | 120 | public Qsa[] getQsa() { 121 | return qsa; 122 | } 123 | 124 | public void setQsa(Qsa[] qsa) { 125 | this.qsa = qsa; 126 | } 127 | 128 | public String getCnpj() { 129 | return cnpj; 130 | } 131 | 132 | public void setCnpj(String cnpj) { 133 | this.cnpj = cnpj; 134 | } 135 | 136 | public String getPais() { 137 | return pais; 138 | } 139 | 140 | public void setPais(String pais) { 141 | this.pais = pais; 142 | } 143 | 144 | public String getEmail() { 145 | return email; 146 | } 147 | 148 | public void setEmail(String email) { 149 | this.email = email; 150 | } 151 | 152 | public String getPorte() { 153 | return porte; 154 | } 155 | 156 | public void setPorte(String porte) { 157 | this.porte = porte; 158 | } 159 | 160 | public String getBairro() { 161 | return bairro; 162 | } 163 | 164 | public void setBairro(String bairro) { 165 | this.bairro = bairro; 166 | } 167 | 168 | public String getNumero() { 169 | return numero; 170 | } 171 | 172 | public void setNumero(String numero) { 173 | this.numero = numero; 174 | } 175 | 176 | public String getDddFax() { 177 | return dddFax; 178 | } 179 | 180 | public void setDddFax(String dddFax) { 181 | this.dddFax = dddFax; 182 | } 183 | 184 | public String getMunicipio() { 185 | return municipio; 186 | } 187 | 188 | public void setMunicipio(String municipio) { 189 | this.municipio = municipio; 190 | } 191 | 192 | public String getLogradouro() { 193 | return logradouro; 194 | } 195 | 196 | public void setLogradouro(String logradouro) { 197 | this.logradouro = logradouro; 198 | } 199 | 200 | public Integer getCnaeFiscal() { 201 | return cnaeFiscal; 202 | } 203 | 204 | public void setCnaeFiscal(Integer cnaeFiscal) { 205 | this.cnaeFiscal = cnaeFiscal; 206 | } 207 | 208 | public Integer getCodigoPais() { 209 | return codigoPais; 210 | } 211 | 212 | public void setCodigoPais(Integer codigoPais) { 213 | this.codigoPais = codigoPais; 214 | } 215 | 216 | public String getComplemento() { 217 | return complemento; 218 | } 219 | 220 | public void setComplemento(String complemento) { 221 | this.complemento = complemento; 222 | } 223 | 224 | public Integer getCodigoPorte() { 225 | return codigoPorte; 226 | } 227 | 228 | public void setCodigoPorte(Integer codigoPorte) { 229 | this.codigoPorte = codigoPorte; 230 | } 231 | 232 | public String getRazaoSocial() { 233 | return razaoSocial; 234 | } 235 | 236 | public void setRazaoSocial(String razaoSocial) { 237 | this.razaoSocial = razaoSocial; 238 | } 239 | 240 | public String getNomeFantasia() { 241 | return nomeFantasia; 242 | } 243 | 244 | public void setNomeFantasia(String nomeFantasia) { 245 | this.nomeFantasia = nomeFantasia; 246 | } 247 | 248 | public Double getCapitalSocial() { 249 | return capitalSocial; 250 | } 251 | 252 | public void setCapitalSocial(Double capitalSocial) { 253 | this.capitalSocial = capitalSocial; 254 | } 255 | 256 | public String getDddTelefone1() { 257 | return dddTelefone1; 258 | } 259 | 260 | public void setDddTelefone1(String dddTelefone1) { 261 | this.dddTelefone1 = dddTelefone1; 262 | } 263 | 264 | public String getDddTelefone2() { 265 | return dddTelefone2; 266 | } 267 | 268 | public void setDddTelefone2(String dddTelefone2) { 269 | this.dddTelefone2 = dddTelefone2; 270 | } 271 | 272 | public String getOpcaoPeloMei() { 273 | return opcaoPeloMei; 274 | } 275 | 276 | public void setOpcaoPeloMei(String opcaoPeloMei) { 277 | this.opcaoPeloMei = opcaoPeloMei; 278 | } 279 | 280 | public String getDescricaoPorte() { 281 | return descricaoPorte; 282 | } 283 | 284 | public void setDescricaoPorte(String descricaoPorte) { 285 | this.descricaoPorte = descricaoPorte; 286 | } 287 | 288 | public Integer getCodigoMunicipio() { 289 | return codigoMunicipio; 290 | } 291 | 292 | public void setCodigoMunicipio(Integer codigoMunicipio) { 293 | this.codigoMunicipio = codigoMunicipio; 294 | } 295 | 296 | public CnaesSecundario[] getCnaesSecundarios() { 297 | return cnaesSecundarios; 298 | } 299 | 300 | public void setCnaesSecundarios(CnaesSecundario[] cnaesSecundarios) { 301 | this.cnaesSecundarios = cnaesSecundarios; 302 | } 303 | 304 | public String getNaturezaJuridica() { 305 | return naturezaJuridica; 306 | } 307 | 308 | public void setNaturezaJuridica(String naturezaJuridica) { 309 | this.naturezaJuridica = naturezaJuridica; 310 | } 311 | 312 | public String getSituacaoEspecial() { 313 | return situacaoEspecial; 314 | } 315 | 316 | public void setSituacaoEspecial(String situacaoEspecial) { 317 | this.situacaoEspecial = situacaoEspecial; 318 | } 319 | 320 | public String getOpcaoPeloSimples() { 321 | return opcaoPeloSimples; 322 | } 323 | 324 | public void setOpcaoPeloSimples(String opcaoPeloSimples) { 325 | this.opcaoPeloSimples = opcaoPeloSimples; 326 | } 327 | 328 | public Integer getSituacaoCadastral() { 329 | return situacaoCadastral; 330 | } 331 | 332 | public void setSituacaoCadastral(Integer situacaoCadastral) { 333 | this.situacaoCadastral = situacaoCadastral; 334 | } 335 | 336 | public String getDataOpcaoPeloMei() { 337 | return dataOpcaoPeloMei; 338 | } 339 | 340 | public void setDataOpcaoPeloMei(String dataOpcaoPeloMei) { 341 | this.dataOpcaoPeloMei = dataOpcaoPeloMei; 342 | } 343 | 344 | public String getDataExclusaoDoMei() { 345 | return dataExclusaoDoMei; 346 | } 347 | 348 | public void setDataExclusaoDoMei(String dataExclusaoDoMei) { 349 | this.dataExclusaoDoMei = dataExclusaoDoMei; 350 | } 351 | 352 | public String getCnaeFiscalDescricao() { 353 | return cnaeFiscalDescricao; 354 | } 355 | 356 | public void setCnaeFiscalDescricao(String cnaeFiscalDescricao) { 357 | this.cnaeFiscalDescricao = cnaeFiscalDescricao; 358 | } 359 | 360 | public Integer getCodigoMunicipioIbge() { 361 | return codigoMunicipioIbge; 362 | } 363 | 364 | public void setCodigoMunicipioIbge(Integer codigoMunicipioIbge) { 365 | this.codigoMunicipioIbge = codigoMunicipioIbge; 366 | } 367 | 368 | public String getDataInicioAtividade() { 369 | return dataInicioAtividade; 370 | } 371 | 372 | public void setDataInicioAtividade(String dataInicioAtividade) { 373 | this.dataInicioAtividade = dataInicioAtividade; 374 | } 375 | 376 | public String getDataSituacaoEspecial() { 377 | return dataSituacaoEspecial; 378 | } 379 | 380 | public void setDataSituacaoEspecial(String dataSituacaoEspecial) { 381 | this.dataSituacaoEspecial = dataSituacaoEspecial; 382 | } 383 | 384 | public String getDataOpcaoPeloSimples() { 385 | return dataOpcaoPeloSimples; 386 | } 387 | 388 | public void setDataOpcaoPeloSimples(String dataOpcaoPeloSimples) { 389 | this.dataOpcaoPeloSimples = dataOpcaoPeloSimples; 390 | } 391 | 392 | public String getDataSituacaoCadastral() { 393 | return dataSituacaoCadastral; 394 | } 395 | 396 | public void setDataSituacaoCadastral(String dataSituacaoCadastral) { 397 | this.dataSituacaoCadastral = dataSituacaoCadastral; 398 | } 399 | 400 | public String getNomeCidadeNoExterior() { 401 | return nomeCidadeNoExterior; 402 | } 403 | 404 | public void setNomeCidadeNoExterior(String nomeCidadeNoExterior) { 405 | this.nomeCidadeNoExterior = nomeCidadeNoExterior; 406 | } 407 | 408 | public Integer getCodigoNaturezaJuridica() { 409 | return codigoNaturezaJuridica; 410 | } 411 | 412 | public void setCodigoNaturezaJuridica(Integer codigoNaturezaJuridica) { 413 | this.codigoNaturezaJuridica = codigoNaturezaJuridica; 414 | } 415 | 416 | public String getDataExclusaoDoSimples() { 417 | return dataExclusaoDoSimples; 418 | } 419 | 420 | public void setDataExclusaoDoSimples(String dataExclusaoDoSimples) { 421 | this.dataExclusaoDoSimples = dataExclusaoDoSimples; 422 | } 423 | 424 | public Integer getMotivoSituacaoCadastral() { 425 | return motivoSituacaoCadastral; 426 | } 427 | 428 | public void setMotivoSituacaoCadastral(Integer motivoSituacaoCadastral) { 429 | this.motivoSituacaoCadastral = motivoSituacaoCadastral; 430 | } 431 | 432 | public String getEnteFederativoResponsavel() { 433 | return enteFederativoResponsavel; 434 | } 435 | 436 | public void setEnteFederativoResponsavel(String enteFederativoResponsavel) { 437 | this.enteFederativoResponsavel = enteFederativoResponsavel; 438 | } 439 | 440 | public Integer getIdentificadorMatrizFilial() { 441 | return identificadorMatrizFilial; 442 | } 443 | 444 | public void setIdentificadorMatrizFilial(Integer identificadorMatrizFilial) { 445 | this.identificadorMatrizFilial = identificadorMatrizFilial; 446 | } 447 | 448 | public Integer getQualificacaoDoResponsavel() { 449 | return qualificacaoDoResponsavel; 450 | } 451 | 452 | public void setQualificacaoDoResponsavel(Integer qualificacaoDoResponsavel) { 453 | this.qualificacaoDoResponsavel = qualificacaoDoResponsavel; 454 | } 455 | 456 | public String getDescricaoSituacaoCadastral() { 457 | return descricaoSituacaoCadastral; 458 | } 459 | 460 | public void setDescricaoSituacaoCadastral(String descricaoSituacaoCadastral) { 461 | this.descricaoSituacaoCadastral = descricaoSituacaoCadastral; 462 | } 463 | 464 | public String getDescricaoTipoDeLogradouro() { 465 | return descricaoTipoDeLogradouro; 466 | } 467 | 468 | public void setDescricaoTipoDeLogradouro(String descricaoTipoDeLogradouro) { 469 | this.descricaoTipoDeLogradouro = descricaoTipoDeLogradouro; 470 | } 471 | 472 | public String getDescricaoMotivoSituacaoCadastral() { 473 | return descricaoMotivoSituacaoCadastral; 474 | } 475 | 476 | public void setDescricaoMotivoSituacaoCadastral(String descricaoMotivoSituacaoCadastral) { 477 | this.descricaoMotivoSituacaoCadastral = descricaoMotivoSituacaoCadastral; 478 | } 479 | 480 | public String getDescricaoIdentificadorMatrizFilial() { 481 | return descricaoIdentificadorMatrizFilial; 482 | } 483 | 484 | public void setDescricaoIdentificadorMatrizFilial(String descricaoIdentificadorMatrizFilial) { 485 | this.descricaoIdentificadorMatrizFilial = descricaoIdentificadorMatrizFilial; 486 | } 487 | 488 | @Override 489 | public int hashCode() { 490 | final int prime = 31; 491 | int result = 1; 492 | result = prime * result + Arrays.hashCode(cnaesSecundarios); 493 | result = prime * result + Arrays.hashCode(qsa); 494 | result = prime * result + Objects.hash(bairro, capitalSocial, cep, cnaeFiscal, cnaeFiscalDescricao, cnpj, 495 | codigoMunicipio, codigoMunicipioIbge, codigoNaturezaJuridica, codigoPais, codigoPorte, complemento, 496 | dataExclusaoDoMei, dataExclusaoDoSimples, dataInicioAtividade, dataOpcaoPeloMei, dataOpcaoPeloSimples, 497 | dataSituacaoCadastral, dataSituacaoEspecial, dddFax, dddTelefone1, dddTelefone2, 498 | descricaoIdentificadorMatrizFilial, descricaoMotivoSituacaoCadastral, descricaoPorte, 499 | descricaoSituacaoCadastral, descricaoTipoDeLogradouro, email, enteFederativoResponsavel, 500 | identificadorMatrizFilial, logradouro, motivoSituacaoCadastral, municipio, naturezaJuridica, 501 | nomeCidadeNoExterior, nomeFantasia, numero, opcaoPeloMei, opcaoPeloSimples, pais, porte, 502 | qualificacaoDoResponsavel, razaoSocial, situacaoCadastral, situacaoEspecial, uf); 503 | return result; 504 | } 505 | 506 | @Override 507 | public boolean equals(Object obj) { 508 | if (this == obj) 509 | return true; 510 | if (obj == null) 511 | return false; 512 | if (getClass() != obj.getClass()) 513 | return false; 514 | CNPJ other = (CNPJ) obj; 515 | return Objects.equals(bairro, other.bairro) && Objects.equals(capitalSocial, other.capitalSocial) 516 | && Objects.equals(cep, other.cep) && Objects.equals(cnaeFiscal, other.cnaeFiscal) 517 | && Objects.equals(cnaeFiscalDescricao, other.cnaeFiscalDescricao) 518 | && Arrays.equals(cnaesSecundarios, other.cnaesSecundarios) && Objects.equals(cnpj, other.cnpj) 519 | && Objects.equals(codigoMunicipio, other.codigoMunicipio) 520 | && Objects.equals(codigoMunicipioIbge, other.codigoMunicipioIbge) 521 | && Objects.equals(codigoNaturezaJuridica, other.codigoNaturezaJuridica) 522 | && Objects.equals(codigoPais, other.codigoPais) && Objects.equals(codigoPorte, other.codigoPorte) 523 | && Objects.equals(complemento, other.complemento) 524 | && Objects.equals(dataExclusaoDoMei, other.dataExclusaoDoMei) 525 | && Objects.equals(dataExclusaoDoSimples, other.dataExclusaoDoSimples) 526 | && Objects.equals(dataInicioAtividade, other.dataInicioAtividade) 527 | && Objects.equals(dataOpcaoPeloMei, other.dataOpcaoPeloMei) 528 | && Objects.equals(dataOpcaoPeloSimples, other.dataOpcaoPeloSimples) 529 | && Objects.equals(dataSituacaoCadastral, other.dataSituacaoCadastral) 530 | && Objects.equals(dataSituacaoEspecial, other.dataSituacaoEspecial) 531 | && Objects.equals(dddFax, other.dddFax) && Objects.equals(dddTelefone1, other.dddTelefone1) 532 | && Objects.equals(dddTelefone2, other.dddTelefone2) 533 | && Objects.equals(descricaoIdentificadorMatrizFilial, other.descricaoIdentificadorMatrizFilial) 534 | && Objects.equals(descricaoMotivoSituacaoCadastral, other.descricaoMotivoSituacaoCadastral) 535 | && Objects.equals(descricaoPorte, other.descricaoPorte) 536 | && Objects.equals(descricaoSituacaoCadastral, other.descricaoSituacaoCadastral) 537 | && Objects.equals(descricaoTipoDeLogradouro, other.descricaoTipoDeLogradouro) 538 | && Objects.equals(email, other.email) 539 | && Objects.equals(enteFederativoResponsavel, other.enteFederativoResponsavel) 540 | && Objects.equals(identificadorMatrizFilial, other.identificadorMatrizFilial) 541 | && Objects.equals(logradouro, other.logradouro) 542 | && Objects.equals(motivoSituacaoCadastral, other.motivoSituacaoCadastral) 543 | && Objects.equals(municipio, other.municipio) 544 | && Objects.equals(naturezaJuridica, other.naturezaJuridica) 545 | && Objects.equals(nomeCidadeNoExterior, other.nomeCidadeNoExterior) 546 | && Objects.equals(nomeFantasia, other.nomeFantasia) && Objects.equals(numero, other.numero) 547 | && Objects.equals(opcaoPeloMei, other.opcaoPeloMei) 548 | && Objects.equals(opcaoPeloSimples, other.opcaoPeloSimples) && Objects.equals(pais, other.pais) 549 | && Objects.equals(porte, other.porte) && Arrays.equals(qsa, other.qsa) 550 | && Objects.equals(qualificacaoDoResponsavel, other.qualificacaoDoResponsavel) 551 | && Objects.equals(razaoSocial, other.razaoSocial) 552 | && Objects.equals(situacaoCadastral, other.situacaoCadastral) 553 | && Objects.equals(situacaoEspecial, other.situacaoEspecial) && Objects.equals(uf, other.uf); 554 | } 555 | 556 | @Override 557 | public String toString() { 558 | return "CNPJ [uf=" + uf + ", cep=" + cep + ", qsa=" + Arrays.toString(qsa) + ", cnpj=" + cnpj + ", pais=" + pais 559 | + ", email=" + email + ", porte=" + porte + ", bairro=" + bairro + ", numero=" + numero + ", dddFax=" 560 | + dddFax + ", municipio=" + municipio + ", logradouro=" + logradouro + ", cnaeFiscal=" + cnaeFiscal 561 | + ", codigoPais=" + codigoPais + ", complemento=" + complemento + ", codigoPorte=" + codigoPorte 562 | + ", razaoSocial=" + razaoSocial + ", nomeFantasia=" + nomeFantasia + ", capitalSocial=" + capitalSocial 563 | + ", dddTelefone1=" + dddTelefone1 + ", dddTelefone2=" + dddTelefone2 + ", opcaoPeloMei=" + opcaoPeloMei 564 | + ", descricaoPorte=" + descricaoPorte + ", codigoMunicipio=" + codigoMunicipio + ", cnaesSecundarios=" 565 | + Arrays.toString(cnaesSecundarios) + ", naturezaJuridica=" + naturezaJuridica + ", situacaoEspecial=" 566 | + situacaoEspecial + ", opcaoPeloSimples=" + opcaoPeloSimples + ", situacaoCadastral=" 567 | + situacaoCadastral + ", dataOpcaoPeloMei=" + dataOpcaoPeloMei + ", dataExclusaoDoMei=" 568 | + dataExclusaoDoMei + ", cnaeFiscalDescricao=" + cnaeFiscalDescricao + ", codigoMunicipioIbge=" 569 | + codigoMunicipioIbge + ", dataInicioAtividade=" + dataInicioAtividade + ", dataSituacaoEspecial=" 570 | + dataSituacaoEspecial + ", dataOpcaoPeloSimples=" + dataOpcaoPeloSimples + ", dataSituacaoCadastral=" 571 | + dataSituacaoCadastral + ", nomeCidadeNoExterior=" + nomeCidadeNoExterior + ", codigoNaturezaJuridica=" 572 | + codigoNaturezaJuridica + ", dataExclusaoDoSimples=" + dataExclusaoDoSimples 573 | + ", motivoSituacaoCadastral=" + motivoSituacaoCadastral + ", enteFederativoResponsavel=" 574 | + enteFederativoResponsavel + ", identificadorMatrizFilial=" + identificadorMatrizFilial 575 | + ", qualificacaoDoResponsavel=" + qualificacaoDoResponsavel + ", descricaoSituacaoCadastral=" 576 | + descricaoSituacaoCadastral + ", descricaoTipoDeLogradouro=" + descricaoTipoDeLogradouro 577 | + ", descricaoMotivoSituacaoCadastral=" + descricaoMotivoSituacaoCadastral 578 | + ", descricaoIdentificadorMatrizFilial=" + descricaoIdentificadorMatrizFilial + "]"; 579 | } 580 | 581 | public class Qsa { 582 | private String pais; 583 | @SerializedName("nome_socio") 584 | private String nomeSocio; 585 | @SerializedName("codigo_pais") 586 | private Integer codigoPais; 587 | @SerializedName("faixa_etaria") 588 | private String faixaEtaria; 589 | @SerializedName("cnpj_cpf_do_socio") 590 | private String cnpjCpfDoSocio; 591 | @SerializedName("qualificacao_socio") 592 | private String qualificacaoSocio; 593 | @SerializedName("codigo_faixa_etaria") 594 | private Integer codigoFaixaEtaria; 595 | @SerializedName("data_entrada_sociedade") 596 | private String dataEntradaSociedade; 597 | @SerializedName("identificador_de_socio") 598 | private Integer identificadorDeSocio; 599 | @SerializedName("cpf_representante_legal") 600 | private String cpfRepresentanteLegal; 601 | @SerializedName("nome_representante_legal") 602 | private String nomeRepresentanteLegal; 603 | @SerializedName("codigo_qualificacao_socio") 604 | private Integer codigoQualificacaoSocio; 605 | @SerializedName("qualificacao_representante_legal") 606 | private String qualificacaoRepresentanteLegal; 607 | @SerializedName("codigo_qualificacao_representante_legal") 608 | private Integer codigoQualificacaoRepresentanteLegal; 609 | 610 | public String getPais() { 611 | return pais; 612 | } 613 | 614 | public void setPais(String pais) { 615 | this.pais = pais; 616 | } 617 | 618 | public String getNomeSocio() { 619 | return nomeSocio; 620 | } 621 | 622 | public void setNomeSocio(String nomeSocio) { 623 | this.nomeSocio = nomeSocio; 624 | } 625 | 626 | public Integer getCodigoPais() { 627 | return codigoPais; 628 | } 629 | 630 | public void setCodigoPais(Integer codigoPais) { 631 | this.codigoPais = codigoPais; 632 | } 633 | 634 | public String getFaixaEtaria() { 635 | return faixaEtaria; 636 | } 637 | 638 | public void setFaixaEtaria(String faixaEtaria) { 639 | this.faixaEtaria = faixaEtaria; 640 | } 641 | 642 | public String getCnpjCpfDoSocio() { 643 | return cnpjCpfDoSocio; 644 | } 645 | 646 | public void setCnpjCpfDoSocio(String cnpjCpfDoSocio) { 647 | this.cnpjCpfDoSocio = cnpjCpfDoSocio; 648 | } 649 | 650 | public String getQualificacaoSocio() { 651 | return qualificacaoSocio; 652 | } 653 | 654 | public void setQualificacaoSocio(String qualificacaoSocio) { 655 | this.qualificacaoSocio = qualificacaoSocio; 656 | } 657 | 658 | public Integer getCodigoFaixaEtaria() { 659 | return codigoFaixaEtaria; 660 | } 661 | 662 | public void setCodigoFaixaEtaria(Integer codigoFaixaEtaria) { 663 | this.codigoFaixaEtaria = codigoFaixaEtaria; 664 | } 665 | 666 | public String getDataEntradaSociedade() { 667 | return dataEntradaSociedade; 668 | } 669 | 670 | public void setDataEntradaSociedade(String dataEntradaSociedade) { 671 | this.dataEntradaSociedade = dataEntradaSociedade; 672 | } 673 | 674 | public Integer getIdentificadorDeSocio() { 675 | return identificadorDeSocio; 676 | } 677 | 678 | public void setIdentificadorDeSocio(Integer identificadorDeSocio) { 679 | this.identificadorDeSocio = identificadorDeSocio; 680 | } 681 | 682 | public String getCpfRepresentanteLegal() { 683 | return cpfRepresentanteLegal; 684 | } 685 | 686 | public void setCpfRepresentanteLegal(String cpfRepresentanteLegal) { 687 | this.cpfRepresentanteLegal = cpfRepresentanteLegal; 688 | } 689 | 690 | public String getNomeRepresentanteLegal() { 691 | return nomeRepresentanteLegal; 692 | } 693 | 694 | public void setNomeRepresentanteLegal(String nomeRepresentanteLegal) { 695 | this.nomeRepresentanteLegal = nomeRepresentanteLegal; 696 | } 697 | 698 | public Integer getCodigoQualificacaoSocio() { 699 | return codigoQualificacaoSocio; 700 | } 701 | 702 | public void setCodigoQualificacaoSocio(Integer codigoQualificacaoSocio) { 703 | this.codigoQualificacaoSocio = codigoQualificacaoSocio; 704 | } 705 | 706 | public String getQualificacaoRepresentanteLegal() { 707 | return qualificacaoRepresentanteLegal; 708 | } 709 | 710 | public void setQualificacaoRepresentanteLegal(String qualificacaoRepresentanteLegal) { 711 | this.qualificacaoRepresentanteLegal = qualificacaoRepresentanteLegal; 712 | } 713 | 714 | public Integer getCodigoQualificacaoRepresentanteLegal() { 715 | return codigoQualificacaoRepresentanteLegal; 716 | } 717 | 718 | public void setCodigoQualificacaoRepresentanteLegal(Integer codigoQualificacaoRepresentanteLegal) { 719 | this.codigoQualificacaoRepresentanteLegal = codigoQualificacaoRepresentanteLegal; 720 | } 721 | 722 | @Override 723 | public int hashCode() { 724 | final int prime = 31; 725 | int result = 1; 726 | result = prime * result + getEnclosingInstance().hashCode(); 727 | result = prime * result + Objects.hash(cnpjCpfDoSocio, codigoFaixaEtaria, codigoPais, 728 | codigoQualificacaoRepresentanteLegal, codigoQualificacaoSocio, cpfRepresentanteLegal, 729 | dataEntradaSociedade, faixaEtaria, identificadorDeSocio, nomeRepresentanteLegal, nomeSocio, pais, 730 | qualificacaoRepresentanteLegal, qualificacaoSocio); 731 | return result; 732 | } 733 | 734 | @Override 735 | public boolean equals(Object obj) { 736 | if (this == obj) 737 | return true; 738 | if (obj == null) 739 | return false; 740 | if (getClass() != obj.getClass()) 741 | return false; 742 | Qsa other = (Qsa) obj; 743 | if (!getEnclosingInstance().equals(other.getEnclosingInstance())) 744 | return false; 745 | return Objects.equals(cnpjCpfDoSocio, other.cnpjCpfDoSocio) 746 | && Objects.equals(codigoFaixaEtaria, other.codigoFaixaEtaria) 747 | && Objects.equals(codigoPais, other.codigoPais) 748 | && Objects.equals(codigoQualificacaoRepresentanteLegal, other.codigoQualificacaoRepresentanteLegal) 749 | && Objects.equals(codigoQualificacaoSocio, other.codigoQualificacaoSocio) 750 | && Objects.equals(cpfRepresentanteLegal, other.cpfRepresentanteLegal) 751 | && Objects.equals(dataEntradaSociedade, other.dataEntradaSociedade) 752 | && Objects.equals(faixaEtaria, other.faixaEtaria) 753 | && Objects.equals(identificadorDeSocio, other.identificadorDeSocio) 754 | && Objects.equals(nomeRepresentanteLegal, other.nomeRepresentanteLegal) 755 | && Objects.equals(nomeSocio, other.nomeSocio) && Objects.equals(pais, other.pais) 756 | && Objects.equals(qualificacaoRepresentanteLegal, other.qualificacaoRepresentanteLegal) 757 | && Objects.equals(qualificacaoSocio, other.qualificacaoSocio); 758 | } 759 | 760 | @Override 761 | public String toString() { 762 | return "Qsa [pais=" + pais + ", nomeSocio=" + nomeSocio + ", codigoPais=" + codigoPais + ", faixaEtaria=" 763 | + faixaEtaria + ", cnpjCpfDoSocio=" + cnpjCpfDoSocio + ", qualificacaoSocio=" + qualificacaoSocio 764 | + ", codigoFaixaEtaria=" + codigoFaixaEtaria + ", dataEntradaSociedade=" + dataEntradaSociedade 765 | + ", identificadorDeSocio=" + identificadorDeSocio + ", cpfRepresentanteLegal=" + cpfRepresentanteLegal 766 | + ", nomeRepresentanteLegal=" + nomeRepresentanteLegal + ", codigoQualificacaoSocio=" 767 | + codigoQualificacaoSocio + ", qualificacaoRepresentanteLegal=" + qualificacaoRepresentanteLegal 768 | + ", codigoQualificacaoRepresentanteLegal=" + codigoQualificacaoRepresentanteLegal + "]"; 769 | } 770 | 771 | private CNPJ getEnclosingInstance() { 772 | return CNPJ.this; 773 | } 774 | 775 | } 776 | 777 | public class CnaesSecundario { 778 | private Long codigo; 779 | private String descricao; 780 | 781 | public Long getCodigo() { 782 | return codigo; 783 | } 784 | 785 | public void setCodigo(Long codigo) { 786 | this.codigo = codigo; 787 | } 788 | 789 | public String getDescricao() { 790 | return descricao; 791 | } 792 | 793 | public void setDescricao(String descricao) { 794 | this.descricao = descricao; 795 | } 796 | 797 | @Override 798 | public int hashCode() { 799 | final int prime = 31; 800 | int result = 1; 801 | result = prime * result + getEnclosingInstance().hashCode(); 802 | result = prime * result + Objects.hash(codigo, descricao); 803 | return result; 804 | } 805 | 806 | @Override 807 | public boolean equals(Object obj) { 808 | if (this == obj) 809 | return true; 810 | if (obj == null) 811 | return false; 812 | if (getClass() != obj.getClass()) 813 | return false; 814 | CnaesSecundario other = (CnaesSecundario) obj; 815 | if (!getEnclosingInstance().equals(other.getEnclosingInstance())) 816 | return false; 817 | return Objects.equals(codigo, other.codigo) && Objects.equals(descricao, other.descricao); 818 | } 819 | 820 | @Override 821 | public String toString() { 822 | return "CnaesSecundario [codigo=" + codigo + ", descricao=" + descricao + "]"; 823 | } 824 | 825 | private CNPJ getEnclosingInstance() { 826 | return CNPJ.this; 827 | } 828 | 829 | } 830 | } 831 | -------------------------------------------------------------------------------- /src/main/java/br/com/brasilapi/api/CPTEC.java: -------------------------------------------------------------------------------- 1 | package br.com.brasilapi.api; 2 | 3 | import java.sql.Timestamp; 4 | import java.util.Arrays; 5 | import java.util.Date; 6 | import java.util.Objects; 7 | 8 | import com.google.gson.annotations.SerializedName; 9 | 10 | public class CPTEC extends API implements CPTECCidade, CPTECClimaCapital, CPTECClimaAeroporto, CPTECClimaPrevisao, CPTECOnda { 11 | private String nome; 12 | private String estado; 13 | private Integer id; 14 | @SerializedName("codigo_icao") 15 | private String codigoIcao; 16 | @SerializedName("atualizado_em") 17 | private Timestamp atualizadoEm; 18 | @SerializedName("pressao_atmosferica") 19 | private Integer pressaoAtmosferica; 20 | private String visibilidade; 21 | private Integer vento; 22 | @SerializedName("direcao_vento") 23 | private Integer direcaoVento; 24 | private Integer umidade; 25 | private String condicao; 26 | @SerializedName("condicao_desc") 27 | private String condicaoDesc; 28 | private Float temp; 29 | private String cidade; 30 | private Clima[] clima; 31 | private Onda[] ondas; 32 | 33 | public String getNome() { 34 | return nome; 35 | } 36 | 37 | public void setNome(String nome) { 38 | this.nome = nome; 39 | } 40 | 41 | public String getEstado() { 42 | return estado; 43 | } 44 | 45 | public void setEstado(String estado) { 46 | this.estado = estado; 47 | } 48 | 49 | public Integer getId() { 50 | return id; 51 | } 52 | 53 | public void setId(Integer id) { 54 | this.id = id; 55 | } 56 | 57 | /** 58 | * Obtém o código ICAO do aeroporto. 59 | */ 60 | public String getCodigoIcao() { 61 | return codigoIcao; 62 | } 63 | 64 | /** 65 | * Define o código ICAO do aeroporto. 66 | */ 67 | public void setCodigoIcao(String codigoIcao) { 68 | this.codigoIcao = codigoIcao; 69 | } 70 | 71 | /** 72 | * Obtém a data de última atualização. 73 | */ 74 | public Timestamp getAtualizadoEm() { 75 | return atualizadoEm; 76 | } 77 | 78 | /** 79 | * Define a data de última atualização. 80 | */ 81 | public void setAtualizadoEm(Timestamp atualizadoEm) { 82 | this.atualizadoEm = atualizadoEm; 83 | } 84 | 85 | /** 86 | * Obtém a pressão atmosférica medida na estação meteorológica do aeroporto expressa em hPa (Hectopascal). 87 | */ 88 | public Integer getPressaoAtmosferica() { 89 | return pressaoAtmosferica; 90 | } 91 | 92 | /** 93 | * Define a pressão atmosférica medida na estação meteorológica do aeroporto expressa em hPa (Hectopascal). 94 | */ 95 | public void setPressaoAtmosferica(Integer pressaoAtmosferica) { 96 | this.pressaoAtmosferica = pressaoAtmosferica; 97 | } 98 | 99 | /** 100 | * Obtém a condição atual de visibilidade em metros. 101 | */ 102 | public String getVisibilidade() { 103 | return visibilidade; 104 | } 105 | 106 | /** 107 | * Define a condição atual de visibilidade em metros. 108 | */ 109 | public void setVisibilidade(String visibilidade) { 110 | this.visibilidade = visibilidade; 111 | } 112 | 113 | /** 114 | * Obtém a intensidade do vendo em km/h. 115 | */ 116 | public Integer getVento() { 117 | return vento; 118 | } 119 | 120 | /** 121 | * Define a intensidade do vendo em km/h. 122 | */ 123 | public void setVento(Integer vento) { 124 | this.vento = vento; 125 | } 126 | 127 | /** 128 | * Obtém a direção do vento em graus de (0° a 360°). 129 | */ 130 | public Integer getDirecaoVento() { 131 | return direcaoVento; 132 | } 133 | 134 | /** 135 | * Define a direção do vento em graus de (0° a 360°). 136 | */ 137 | public void setDirecaoVento(Integer direcaoVento) { 138 | this.direcaoVento = direcaoVento; 139 | } 140 | 141 | /** 142 | * Obtém a umidade relativa do ar em porcentagem. 143 | */ 144 | public Integer getUmidade() { 145 | return umidade; 146 | } 147 | 148 | /** 149 | * Define a umidade relativa do ar em porcentagem. 150 | */ 151 | public void setUmidade(Integer umidade) { 152 | this.umidade = umidade; 153 | } 154 | 155 | /** 156 | * Obtém o código da condição meteorológica. 157 | */ 158 | public String getCondicao() { 159 | return condicao; 160 | } 161 | 162 | /** 163 | * Define o código da condição meteorológica. 164 | */ 165 | public void setCondicao(String condicao) { 166 | this.condicao = condicao; 167 | } 168 | 169 | /** 170 | * Obtém o texto descritivo para a condição meteorológica. 171 | */ 172 | public String getCondicaoDesc() { 173 | return condicaoDesc; 174 | } 175 | 176 | /** 177 | * Define o texto descritivo para a condição meteorológica. 178 | */ 179 | public void setCondicaoDesc(String condicaoDesc) { 180 | this.condicaoDesc = condicaoDesc; 181 | } 182 | 183 | /** 184 | * Obtém a temperatura (em graus celsius). 185 | */ 186 | public Float getTemp() { 187 | return temp; 188 | } 189 | 190 | /** 191 | * Define a temperatura (em graus celsius). 192 | */ 193 | public void setTemp(Float temp) { 194 | this.temp = temp; 195 | } 196 | 197 | public String getCidade() { 198 | return cidade; 199 | } 200 | 201 | public void setCidade(String cidade) { 202 | this.cidade = cidade; 203 | } 204 | 205 | /** 206 | * Obtém a lista com condições climáticas dia a dia. 207 | */ 208 | public Clima[] getClima() { 209 | return clima; 210 | } 211 | 212 | /** 213 | * Define a lista com condições climáticas dia a dia. 214 | */ 215 | public void setClima(Clima[] clima) { 216 | this.clima = clima; 217 | } 218 | 219 | public Onda[] getOndas() { 220 | return ondas; 221 | } 222 | 223 | public void setOndas(Onda[] ondas) { 224 | this.ondas = ondas; 225 | } 226 | 227 | @Override 228 | public int hashCode() { 229 | final int prime = 31; 230 | int result = 1; 231 | result = prime * result + Arrays.hashCode(clima); 232 | result = prime * result + Arrays.hashCode(ondas); 233 | result = prime * result + Objects.hash(atualizadoEm, cidade, codigoIcao, condicao, condicaoDesc, direcaoVento, 234 | estado, id, nome, pressaoAtmosferica, temp, umidade, vento, visibilidade); 235 | return result; 236 | } 237 | 238 | @Override 239 | public boolean equals(Object obj) { 240 | if (this == obj) 241 | return true; 242 | if (obj == null) 243 | return false; 244 | if (getClass() != obj.getClass()) 245 | return false; 246 | CPTEC other = (CPTEC) obj; 247 | return Objects.equals(atualizadoEm, other.atualizadoEm) && Objects.equals(cidade, other.cidade) 248 | && Arrays.equals(clima, other.clima) && Objects.equals(codigoIcao, other.codigoIcao) 249 | && Objects.equals(condicao, other.condicao) && Objects.equals(condicaoDesc, other.condicaoDesc) 250 | && Objects.equals(direcaoVento, other.direcaoVento) && Objects.equals(estado, other.estado) 251 | && Objects.equals(id, other.id) && Objects.equals(nome, other.nome) && Arrays.equals(ondas, other.ondas) 252 | && Objects.equals(pressaoAtmosferica, other.pressaoAtmosferica) && Objects.equals(temp, other.temp) 253 | && Objects.equals(umidade, other.umidade) && Objects.equals(vento, other.vento) 254 | && Objects.equals(visibilidade, other.visibilidade); 255 | } 256 | 257 | @Override 258 | public String toString() { 259 | return "CPTEC [nome=" + nome + ", estado=" + estado + ", id=" + id + ", codigoIcao=" + codigoIcao 260 | + ", atualizadoEm=" + atualizadoEm + ", pressaoAtmosferica=" + pressaoAtmosferica + ", visibilidade=" 261 | + visibilidade + ", vento=" + vento + ", direcaoVento=" + direcaoVento + ", umidade=" + umidade 262 | + ", condicao=" + condicao + ", condicaoDesc=" + condicaoDesc + ", temp=" + temp + ", cidade=" + cidade 263 | + ", clima=" + Arrays.toString(clima) + ", ondas=" + Arrays.toString(ondas) + "]"; 264 | } 265 | 266 | 267 | public class Clima { 268 | private Date data; 269 | private String condicao; 270 | @SerializedName("condicao_desc") 271 | private String condicaoDesc; 272 | private Integer min; 273 | private Integer max; 274 | @SerializedName("indice_uv") 275 | private Integer indiceUV; 276 | 277 | public Date getData() { 278 | return data; 279 | } 280 | public void setData(Date data) { 281 | this.data = data; 282 | } 283 | public String getCondicao() { 284 | return condicao; 285 | } 286 | public void setCondicao(String condicao) { 287 | this.condicao = condicao; 288 | } 289 | public String getCondicaoDesc() { 290 | return condicaoDesc; 291 | } 292 | public void setCondicaoDesc(String condicaoDesc) { 293 | this.condicaoDesc = condicaoDesc; 294 | } 295 | public Integer getMin() { 296 | return min; 297 | } 298 | public void setMin(Integer min) { 299 | this.min = min; 300 | } 301 | public Integer getMax() { 302 | return max; 303 | } 304 | public void setMax(Integer max) { 305 | this.max = max; 306 | } 307 | public Integer getIndiceUV() { 308 | return indiceUV; 309 | } 310 | public void setIndiceUV(Integer indiceUV) { 311 | this.indiceUV = indiceUV; 312 | } 313 | 314 | @Override 315 | public int hashCode() { 316 | final int prime = 31; 317 | int result = 1; 318 | result = prime * result + getEnclosingInstance().hashCode(); 319 | result = prime * result + Objects.hash(condicao, condicaoDesc, data, indiceUV, max, min); 320 | return result; 321 | } 322 | 323 | @Override 324 | public boolean equals(Object obj) { 325 | if (this == obj) 326 | return true; 327 | if (obj == null) 328 | return false; 329 | if (getClass() != obj.getClass()) 330 | return false; 331 | Clima other = (Clima) obj; 332 | if (!getEnclosingInstance().equals(other.getEnclosingInstance())) 333 | return false; 334 | return Objects.equals(condicao, other.condicao) && Objects.equals(condicaoDesc, other.condicaoDesc) 335 | && Objects.equals(data, other.data) && Objects.equals(indiceUV, other.indiceUV) 336 | && Objects.equals(max, other.max) && Objects.equals(min, other.min); 337 | } 338 | 339 | @Override 340 | public String toString() { 341 | return "Clima [data=" + data + ", condicao=" + condicao + ", condicaoDesc=" + condicaoDesc + ", min=" + min 342 | + ", max=" + max + ", indiceUV=" + indiceUV + "]"; 343 | } 344 | 345 | private CPTEC getEnclosingInstance() { 346 | return CPTEC.this; 347 | } 348 | } 349 | 350 | public class Onda { 351 | private Date data; 352 | @SerializedName("dados_ondas") 353 | private DadoOnda[] dadosOndas; 354 | 355 | public Date getData() { 356 | return data; 357 | } 358 | public void setData(Date data) { 359 | this.data = data; 360 | } 361 | public DadoOnda[] getDadosOndas() { 362 | return dadosOndas; 363 | } 364 | public void setDadosOndas(DadoOnda[] dadosOndas) { 365 | this.dadosOndas = dadosOndas; 366 | } 367 | 368 | @Override 369 | public int hashCode() { 370 | final int prime = 31; 371 | int result = 1; 372 | result = prime * result + getEnclosingInstance().hashCode(); 373 | result = prime * result + Arrays.hashCode(dadosOndas); 374 | result = prime * result + Objects.hash(data); 375 | return result; 376 | } 377 | 378 | @Override 379 | public boolean equals(Object obj) { 380 | if (this == obj) 381 | return true; 382 | if (obj == null) 383 | return false; 384 | if (getClass() != obj.getClass()) 385 | return false; 386 | Onda other = (Onda) obj; 387 | if (!getEnclosingInstance().equals(other.getEnclosingInstance())) 388 | return false; 389 | return Arrays.equals(dadosOndas, other.dadosOndas) && Objects.equals(data, other.data); 390 | } 391 | 392 | @Override 393 | public String toString() { 394 | return "Onda [data=" + data + ", dados_ondas=" + Arrays.toString(dadosOndas) + "]"; 395 | } 396 | 397 | public class DadoOnda { 398 | private String hora; 399 | private Float vento; 400 | @SerializedName("direcao_vento") 401 | private String direcaoVento; 402 | @SerializedName("direcao_vento_desc") 403 | private String direcaoVentoDesc; 404 | @SerializedName("altura_onda") 405 | private Float alturaOnda; 406 | @SerializedName("direcao_onda") 407 | private String direcaoOnda; 408 | @SerializedName("direcao_onda_desc") 409 | private String direcaoOndaDesc; 410 | private String agitation; 411 | 412 | public String getHora() { 413 | return hora; 414 | } 415 | public void setHora(String hora) { 416 | this.hora = hora; 417 | } 418 | public Float getVento() { 419 | return vento; 420 | } 421 | public void setVento(Float vento) { 422 | this.vento = vento; 423 | } 424 | public String getDirecaoVento() { 425 | return direcaoVento; 426 | } 427 | public void setDirecaoVento(String direcaoVento) { 428 | this.direcaoVento = direcaoVento; 429 | } 430 | public String getDirecaoVentoDesc() { 431 | return direcaoVentoDesc; 432 | } 433 | public void setDirecaoVentoDesc(String direcaoVentoDesc) { 434 | this.direcaoVentoDesc = direcaoVentoDesc; 435 | } 436 | public Float getAlturaOnda() { 437 | return alturaOnda; 438 | } 439 | public void setAlturaOnda(Float alturaOnda) { 440 | this.alturaOnda = alturaOnda; 441 | } 442 | public String getDirecaoOnda() { 443 | return direcaoOnda; 444 | } 445 | public void setDirecaoOnda(String direcaoOnda) { 446 | this.direcaoOnda = direcaoOnda; 447 | } 448 | public String getDirecaoOndaDesc() { 449 | return direcaoOndaDesc; 450 | } 451 | public void setDirecaoOndaDesc(String direcaoOndaDesc) { 452 | this.direcaoOndaDesc = direcaoOndaDesc; 453 | } 454 | public String getAgitation() { 455 | return agitation; 456 | } 457 | public void setAgitation(String agitation) { 458 | this.agitation = agitation; 459 | } 460 | 461 | @Override 462 | public int hashCode() { 463 | final int prime = 31; 464 | int result = 1; 465 | result = prime * result + getEnclosingInstance().hashCode(); 466 | result = prime * result + Objects.hash(agitation, alturaOnda, direcaoOnda, direcaoOndaDesc, 467 | direcaoVento, direcaoVentoDesc, hora, vento); 468 | return result; 469 | } 470 | 471 | @Override 472 | public boolean equals(Object obj) { 473 | if (this == obj) 474 | return true; 475 | if (obj == null) 476 | return false; 477 | if (getClass() != obj.getClass()) 478 | return false; 479 | DadoOnda other = (DadoOnda) obj; 480 | if (!getEnclosingInstance().equals(other.getEnclosingInstance())) 481 | return false; 482 | return Objects.equals(agitation, other.agitation) && Objects.equals(alturaOnda, other.alturaOnda) 483 | && Objects.equals(direcaoOnda, other.direcaoOnda) 484 | && Objects.equals(direcaoOndaDesc, other.direcaoOndaDesc) 485 | && Objects.equals(direcaoVento, other.direcaoVento) 486 | && Objects.equals(direcaoVentoDesc, other.direcaoVentoDesc) && Objects.equals(hora, other.hora) 487 | && Objects.equals(vento, other.vento); 488 | } 489 | 490 | @Override 491 | public String toString() { 492 | return "DadoOnda [hora=" + hora + ", vento=" + vento + ", direcaoVento=" + direcaoVento 493 | + ", direcaoVentoDesc=" + direcaoVentoDesc + ", alturaOnda=" + alturaOnda + ", direcaoOnda=" 494 | + direcaoOnda + ", direcaoOndaDesc=" + direcaoOndaDesc + ", agitation=" + agitation + "]"; 495 | } 496 | 497 | private Onda getEnclosingInstance() { 498 | return Onda.this; 499 | } 500 | } 501 | 502 | private CPTEC getEnclosingInstance() { 503 | return CPTEC.this; 504 | } 505 | } 506 | 507 | } 508 | -------------------------------------------------------------------------------- /src/main/java/br/com/brasilapi/api/CPTECCidade.java: -------------------------------------------------------------------------------- 1 | package br.com.brasilapi.api; 2 | 3 | /** 4 | * Retorna listagem com todas as cidades junto a seus respectivos 5 | * códigos presentes nos serviços da CPTEC. O Código destas cidades 6 | * será utilizado para os serviços de meteorologia e a ondas (previsão oceânica) 7 | * fornecido pelo centro. Leve em consideração que o WebService do CPTEC 8 | * as vezes é instável, então se não encontrar uma determinada cidade na 9 | * listagem completa, tente buscando por parte de seu nome no endpoint de busca. 10 | * 11 | * @version 1 12 | * @author Sávio Andres 13 | * @see https://brasilapi.com.br/docs#tag/CPTEC 15 | */ 16 | public interface CPTECCidade { 17 | public String getNome(); 18 | public void setNome(String nome); 19 | public String getEstado(); 20 | public void setEstado(String estado); 21 | public Integer getId(); 22 | public void setId(Integer id); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/br/com/brasilapi/api/CPTECClimaAeroporto.java: -------------------------------------------------------------------------------- 1 | package br.com.brasilapi.api; 2 | 3 | import java.sql.Timestamp; 4 | 5 | public interface CPTECClimaAeroporto { 6 | /** 7 | * Obtém o código ICAO do aeroporto. 8 | */ 9 | public String getCodigoIcao(); 10 | /** 11 | * Define o código ICAO do aeroporto. 12 | */ 13 | public void setCodigoIcao(String codigoIcao); 14 | /** 15 | * Obtém a data de última atualização. 16 | */ 17 | public Timestamp getAtualizadoEm(); 18 | /** 19 | * Define a data de última atualização. 20 | */ 21 | public void setAtualizadoEm(Timestamp atualizadoEm); 22 | /** 23 | * Obtém a pressão atmosférica medida na estação meteorológica do aeroporto expressa em hPa (Hectopascal). 24 | */ 25 | public Integer getPressaoAtmosferica(); 26 | /** 27 | * Define a pressão atmosférica medida na estação meteorológica do aeroporto expressa em hPa (Hectopascal). 28 | */ 29 | public void setPressaoAtmosferica(Integer pressaoAtmosferica); 30 | /** 31 | * Obtém a condição atual de visibilidade em metros. 32 | */ 33 | public String getVisibilidade(); 34 | /** 35 | * Define a condição atual de visibilidade em metros. 36 | */ 37 | public void setVisibilidade(String visibilidade); 38 | /** 39 | * Obtém a intensidade do vendo em km/h. 40 | */ 41 | public Integer getVento(); 42 | /** 43 | * Define a intensidade do vendo em km/h. 44 | */ 45 | public void setVento(Integer vento); 46 | /** 47 | * Obtém a direção do vento em graus de (0° a 360°). 48 | */ 49 | public Integer getDirecaoVento(); 50 | /** 51 | * Define a direção do vento em graus de (0° a 360°). 52 | */ 53 | public void setDirecaoVento(Integer direcaoVento); 54 | /** 55 | * Obtém a umidade relativa do ar em porcentagem. 56 | */ 57 | public Integer getUmidade(); 58 | /** 59 | * Define a umidade relativa do ar em porcentagem. 60 | */ 61 | public void setUmidade(Integer umidade); 62 | /** 63 | * Obtém o código da condição meteorológica. 64 | */ 65 | public String getCondicao(); 66 | /** 67 | * Define o código da condição meteorológica. 68 | */ 69 | public void setCondicao(String condicao); 70 | /** 71 | * Obtém o texto descritivo para a condição meteorológica. 72 | */ 73 | public String getCondicaoDesc(); 74 | /** 75 | * Define o texto descritivo para a condição meteorológica. 76 | */ 77 | public void setCondicaoDesc(String condicaoDesc); 78 | /** 79 | * Obtém a temperatura (em graus celsius). 80 | */ 81 | public Float getTemp(); 82 | /** 83 | * Define a temperatura (em graus celsius). 84 | */ 85 | public void setTemp(Float temp); 86 | } 87 | -------------------------------------------------------------------------------- /src/main/java/br/com/brasilapi/api/CPTECClimaCapital.java: -------------------------------------------------------------------------------- 1 | package br.com.brasilapi.api; 2 | 3 | import java.sql.Timestamp; 4 | 5 | /** 6 | * Retorna condições meteorológicas atuais nas capitais do país, com base nas estações de solo de seu aeroporto. 7 | * 8 | * @version 1 9 | * @author Sávio Andres 10 | * @see https://brasilapi.com.br/docs#tag/CPTEC 12 | */ 13 | public interface CPTECClimaCapital { 14 | /** 15 | * Obtém o código ICAO do aeroporto. 16 | */ 17 | public String getCodigoIcao(); 18 | /** 19 | * Define o código ICAO do aeroporto. 20 | */ 21 | public void setCodigoIcao(String codigoIcao); 22 | /** 23 | * Obtém a data de última atualização. 24 | */ 25 | public Timestamp getAtualizadoEm(); 26 | /** 27 | * Define a data de última atualização. 28 | */ 29 | public void setAtualizadoEm(Timestamp atualizadoEm); 30 | /** 31 | * Obtém a pressão atmosférica medida na estação meteorológica do aeroporto expressa em hPa (Hectopascal). 32 | */ 33 | public Integer getPressaoAtmosferica(); 34 | /** 35 | * Define a pressão atmosférica medida na estação meteorológica do aeroporto expressa em hPa (Hectopascal). 36 | */ 37 | public void setPressaoAtmosferica(Integer pressaoAtmosferica); 38 | /** 39 | * Obtém a condição atual de visibilidade em metros. 40 | */ 41 | public String getVisibilidade(); 42 | /** 43 | * Define a condição atual de visibilidade em metros. 44 | */ 45 | public void setVisibilidade(String visibilidade); 46 | /** 47 | * Obtém a intensidade do vendo em km/h. 48 | */ 49 | public Integer getVento(); 50 | /** 51 | * Define a intensidade do vendo em km/h. 52 | */ 53 | public void setVento(Integer vento); 54 | /** 55 | * Obtém a direção do vento em graus de (0° a 360°). 56 | */ 57 | public Integer getDirecaoVento(); 58 | /** 59 | * Define a direção do vento em graus de (0° a 360°). 60 | */ 61 | public void setDirecaoVento(Integer direcaoVento); 62 | /** 63 | * Obtém a umidade relativa do ar em porcentagem. 64 | */ 65 | public Integer getUmidade(); 66 | /** 67 | * Define a umidade relativa do ar em porcentagem. 68 | */ 69 | public void setUmidade(Integer umidade); 70 | /** 71 | * Obtém o código da condição meteorológica. 72 | */ 73 | public String getCondicao(); 74 | /** 75 | * Define o código da condição meteorológica. 76 | */ 77 | public void setCondicao(String condicao); 78 | /** 79 | * Obtém o texto descritivo para a condição meteorológica. 80 | */ 81 | public String getCondicaoDesc(); 82 | /** 83 | * Define o texto descritivo para a condição meteorológica. 84 | */ 85 | public void setCondicaoDesc(String condicaoDesc); 86 | /** 87 | * Obtém a temperatura (em graus celsius). 88 | */ 89 | public Float getTemp(); 90 | /** 91 | * Define a temperatura (em graus celsius). 92 | */ 93 | public void setTemp(Float temp); 94 | } 95 | -------------------------------------------------------------------------------- /src/main/java/br/com/brasilapi/api/CPTECClimaPrevisao.java: -------------------------------------------------------------------------------- 1 | package br.com.brasilapi.api; 2 | 3 | import java.sql.Timestamp; 4 | 5 | import br.com.brasilapi.api.CPTEC.Clima; 6 | 7 | /** 8 | * Retorna a previsão meteorológica para a cidade informada para um 9 | * período de 1 até 6 dias. Devido a inconsistências encontradas 10 | * nos retornos da CPTEC nossa API só consegue retornar com 11 | * precisão o período máximo de 6 dias. 12 | * 13 | * @version 1 14 | * @author Sávio Andres 15 | * @see https://brasilapi.com.br/docs#tag/CPTEC 17 | */ 18 | public interface CPTECClimaPrevisao { 19 | public String getCidade(); 20 | public void setCidade(String cidade); 21 | public String getEstado(); 22 | public void setEstado(String estado); 23 | public Timestamp getAtualizadoEm(); 24 | public void setAtualizadoEm(Timestamp atualizadoEm); 25 | public Clima[] getClima(); 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/br/com/brasilapi/api/CPTECOnda.java: -------------------------------------------------------------------------------- 1 | package br.com.brasilapi.api; 2 | 3 | import java.sql.Timestamp; 4 | 5 | import br.com.brasilapi.api.CPTEC.Onda; 6 | 7 | /** 8 | * Retorna a previsão oceânica para a cidade informada para um período de, até, 6 dias. 9 | * 10 | * @version 1 11 | * @author Sávio Andres 12 | * @see https://brasilapi.com.br/docs#tag/CPTEC 14 | */ 15 | public interface CPTECOnda { 16 | public String getCidade(); 17 | public void setCidade(String cidade); 18 | public String getEstado(); 19 | public void setEstado(String estado); 20 | public Timestamp getAtualizadoEm(); 21 | public void setAtualizadoEm(Timestamp atualizadoEm); 22 | public Onda[] getOndas(); 23 | public void setOndas(Onda[] ondas); 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/br/com/brasilapi/api/Corretora.java: -------------------------------------------------------------------------------- 1 | package br.com.brasilapi.api; 2 | 3 | import java.util.Objects; 4 | 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | /** 8 | * Informações referentes a Corretoras ativas listadas na CVM. 9 | * 10 | * @author Sávio Andres 11 | * @see https://brasilapi.com.br/docs#tag/Corretoras 13 | */ 14 | public class Corretora extends API { 15 | private String cnpj; 16 | private String type; 17 | @SerializedName("nome_social") 18 | private String nomeSocial; 19 | @SerializedName("nome_comercial") 20 | private String nomeComercial; 21 | private String status; 22 | private String email; 23 | private String telefone; 24 | private String cep; 25 | private String pais; 26 | private String uf; 27 | private String municipio; 28 | private String bairro; 29 | private String complemento; 30 | private String logradouro; 31 | @SerializedName("data_patrimonio_liquido") 32 | private String dataPatrimonioLiquido; 33 | @SerializedName("valor_patrimonio_liquido") 34 | private String valorPatrimonioLiquido; 35 | @SerializedName("codigo_cvm") 36 | private String codigoCVM; 37 | @SerializedName("data_inicio_situacao") 38 | private String dataInicioSituacao; 39 | @SerializedName("data_registro") 40 | private String dataRegistro; 41 | 42 | public String getCnpj() { 43 | return cnpj; 44 | } 45 | public void setCnpj(String cnpj) { 46 | this.cnpj = cnpj; 47 | } 48 | public String getType() { 49 | return type; 50 | } 51 | public void setType(String type) { 52 | this.type = type; 53 | } 54 | public String getNomeSocial() { 55 | return nomeSocial; 56 | } 57 | public void setNomeSocial(String nomeSocial) { 58 | this.nomeSocial = nomeSocial; 59 | } 60 | public String getNomeComercial() { 61 | return nomeComercial; 62 | } 63 | public void setNomeComercial(String nomeComercial) { 64 | this.nomeComercial = nomeComercial; 65 | } 66 | public String getStatus() { 67 | return status; 68 | } 69 | public void setStatus(String status) { 70 | this.status = status; 71 | } 72 | public String getEmail() { 73 | return email; 74 | } 75 | public void setEmail(String email) { 76 | this.email = email; 77 | } 78 | public String getTelefone() { 79 | return telefone; 80 | } 81 | public void setTelefone(String telefone) { 82 | this.telefone = telefone; 83 | } 84 | public String getCep() { 85 | return cep; 86 | } 87 | public void setCep(String cep) { 88 | this.cep = cep; 89 | } 90 | public String getPais() { 91 | return pais; 92 | } 93 | public void setPais(String pais) { 94 | this.pais = pais; 95 | } 96 | public String getUf() { 97 | return uf; 98 | } 99 | public void setUf(String uf) { 100 | this.uf = uf; 101 | } 102 | public String getMunicipio() { 103 | return municipio; 104 | } 105 | public void setMunicipio(String municipio) { 106 | this.municipio = municipio; 107 | } 108 | public String getBairro() { 109 | return bairro; 110 | } 111 | public void setBairro(String bairro) { 112 | this.bairro = bairro; 113 | } 114 | public String getComplemento() { 115 | return complemento; 116 | } 117 | public void setComplemento(String complemento) { 118 | this.complemento = complemento; 119 | } 120 | public String getLogradouro() { 121 | return logradouro; 122 | } 123 | public void setLogradouro(String logradouro) { 124 | this.logradouro = logradouro; 125 | } 126 | public String getDataPatrimonioLiquido() { 127 | return dataPatrimonioLiquido; 128 | } 129 | public void setDataPatrimonioLiquido(String dataPatrimonioLiquido) { 130 | this.dataPatrimonioLiquido = dataPatrimonioLiquido; 131 | } 132 | public String getValorPatrimonioLiquido() { 133 | return valorPatrimonioLiquido; 134 | } 135 | public void setValorPatrimonioLiquido(String valorPatrimonioLiquido) { 136 | this.valorPatrimonioLiquido = valorPatrimonioLiquido; 137 | } 138 | public String getCodigoCVM() { 139 | return codigoCVM; 140 | } 141 | public void setCodigoCVM(String codigoCVM) { 142 | this.codigoCVM = codigoCVM; 143 | } 144 | public String getDataInicioSituacao() { 145 | return dataInicioSituacao; 146 | } 147 | public void setDataInicioSituacao(String dataInicioSituacao) { 148 | this.dataInicioSituacao = dataInicioSituacao; 149 | } 150 | public String getDataRegistro() { 151 | return dataRegistro; 152 | } 153 | public void setDataRegistro(String dataRegistro) { 154 | this.dataRegistro = dataRegistro; 155 | } 156 | 157 | @Override 158 | public int hashCode() { 159 | return Objects.hash(bairro, cep, cnpj, codigoCVM, complemento, dataInicioSituacao, dataPatrimonioLiquido, 160 | dataRegistro, email, logradouro, municipio, nomeComercial, nomeSocial, pais, status, telefone, type, uf, 161 | valorPatrimonioLiquido); 162 | } 163 | @Override 164 | public boolean equals(Object obj) { 165 | if (this == obj) 166 | return true; 167 | if (obj == null) 168 | return false; 169 | if (getClass() != obj.getClass()) 170 | return false; 171 | Corretora other = (Corretora) obj; 172 | return Objects.equals(bairro, other.bairro) && Objects.equals(cep, other.cep) 173 | && Objects.equals(cnpj, other.cnpj) && Objects.equals(codigoCVM, other.codigoCVM) 174 | && Objects.equals(complemento, other.complemento) 175 | && Objects.equals(dataInicioSituacao, other.dataInicioSituacao) 176 | && Objects.equals(dataPatrimonioLiquido, other.dataPatrimonioLiquido) 177 | && Objects.equals(dataRegistro, other.dataRegistro) && Objects.equals(email, other.email) 178 | && Objects.equals(logradouro, other.logradouro) && Objects.equals(municipio, other.municipio) 179 | && Objects.equals(nomeComercial, other.nomeComercial) && Objects.equals(nomeSocial, other.nomeSocial) 180 | && Objects.equals(pais, other.pais) && Objects.equals(status, other.status) 181 | && Objects.equals(telefone, other.telefone) && Objects.equals(type, other.type) 182 | && Objects.equals(uf, other.uf) && Objects.equals(valorPatrimonioLiquido, other.valorPatrimonioLiquido); 183 | } 184 | 185 | @Override 186 | public String toString() { 187 | return "Corretora [cnpj=" + cnpj + ", type=" + type + ", nomeSocial=" + nomeSocial + ", nomeComercial=" 188 | + nomeComercial + ", status=" + status + ", email=" + email + ", telefone=" + telefone + ", cep=" + cep 189 | + ", pais=" + pais + ", uf=" + uf + ", municipio=" + municipio + ", bairro=" + bairro + ", complemento=" 190 | + complemento + ", logradouro=" + logradouro + ", dataPatrimonioLiquido=" + dataPatrimonioLiquido 191 | + ", valorPatrimonioLiquido=" + valorPatrimonioLiquido + ", codigoCVM=" + codigoCVM 192 | + ", dataInicioSituacao=" + dataInicioSituacao + ", dataRegistro=" + dataRegistro + "]"; 193 | } 194 | 195 | } 196 | -------------------------------------------------------------------------------- /src/main/java/br/com/brasilapi/api/DDD.java: -------------------------------------------------------------------------------- 1 | package br.com.brasilapi.api; 2 | 3 | import java.util.Arrays; 4 | import java.util.Objects; 5 | 6 | /** 7 | * DDD significa Discagem Direta à Distância. é um sistema de ligação telefônica 8 | * automática entre diferentes áreas urbanas nacionais. O DDD é um código 9 | * constituído por 2 dígitos que identificam as principais cidades do país e 10 | * devem ser adicionados ao nº de telefone, juntamente com o código da 11 | * operadora. 12 | * 13 | * @author Sávio Andres 14 | * @see https://brasilapi.com.br/docs#tag/DDD 16 | */ 17 | public class DDD extends API { 18 | private String state; 19 | private String[] cities; 20 | 21 | public String getState() { 22 | return state; 23 | } 24 | 25 | public void setState(String state) { 26 | this.state = state; 27 | } 28 | 29 | public String[] getCities() { 30 | return cities; 31 | } 32 | 33 | public void setCities(String[] cities) { 34 | this.cities = cities; 35 | } 36 | 37 | @Override 38 | public int hashCode() { 39 | final int prime = 31; 40 | int result = 1; 41 | result = prime * result + Arrays.hashCode(cities); 42 | result = prime * result + Objects.hash(state); 43 | return result; 44 | } 45 | 46 | @Override 47 | public boolean equals(Object obj) { 48 | if (this == obj) 49 | return true; 50 | if (obj == null) 51 | return false; 52 | if (getClass() != obj.getClass()) 53 | return false; 54 | DDD other = (DDD) obj; 55 | return Arrays.equals(cities, other.cities) && Objects.equals(state, other.state); 56 | } 57 | 58 | @Override 59 | public String toString() { 60 | return "DDD [state=" + state + ", cities=" + Arrays.toString(cities) + "]"; 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/br/com/brasilapi/api/Feriados.java: -------------------------------------------------------------------------------- 1 | package br.com.brasilapi.api; 2 | 3 | import java.util.Objects; 4 | 5 | /** 6 | * Lista os feriados nacionais de determinado ano. 7 | * 8 | * @author Sávio Andres 9 | * @see https://brasilapi.com.br/docs#tag/Feriados-Nacionais 11 | */ 12 | public class Feriados extends API { 13 | private String date; 14 | private String name; 15 | private String type; 16 | 17 | public String getDate() { 18 | return date; 19 | } 20 | 21 | public void setDate(String date) { 22 | this.date = date; 23 | } 24 | 25 | public String getName() { 26 | return name; 27 | } 28 | 29 | public void setName(String name) { 30 | this.name = name; 31 | } 32 | 33 | public String getType() { 34 | return type; 35 | } 36 | 37 | public void setType(String type) { 38 | this.type = type; 39 | } 40 | 41 | @Override 42 | public int hashCode() { 43 | return Objects.hash(date, name, type); 44 | } 45 | 46 | @Override 47 | public boolean equals(Object obj) { 48 | if (this == obj) 49 | return true; 50 | if (obj == null) 51 | return false; 52 | if (getClass() != obj.getClass()) 53 | return false; 54 | Feriados other = (Feriados) obj; 55 | return Objects.equals(date, other.date) && Objects.equals(name, other.name) && Objects.equals(type, other.type); 56 | } 57 | 58 | @Override 59 | public String toString() { 60 | return "Feriados [date=" + date + ", name=" + name + ", type=" + type + "]"; 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/br/com/brasilapi/api/FipeMarca.java: -------------------------------------------------------------------------------- 1 | package br.com.brasilapi.api; 2 | 3 | import java.util.Objects; 4 | 5 | /** 6 | * Informações sobre Preço Médio de Veículos fornecido pela FIPE (Fundação 7 | * Instituto de Pesquisas Econômicas). 8 | * 9 | * @author Sávio Andres 10 | * @see https://brasilapi.com.br/docs#tag/FIPE 12 | */ 13 | public class FipeMarca extends API { 14 | private String nome; 15 | private String valor; 16 | 17 | public String getNome() { 18 | return nome; 19 | } 20 | 21 | public void setNome(String nome) { 22 | this.nome = nome; 23 | } 24 | 25 | public String getValor() { 26 | return valor; 27 | } 28 | 29 | public void setValor(String valor) { 30 | this.valor = valor; 31 | } 32 | 33 | @Override 34 | public int hashCode() { 35 | return Objects.hash(nome, valor); 36 | } 37 | 38 | @Override 39 | public boolean equals(Object obj) { 40 | if (this == obj) 41 | return true; 42 | if (obj == null) 43 | return false; 44 | if (getClass() != obj.getClass()) 45 | return false; 46 | FipeMarca other = (FipeMarca) obj; 47 | return Objects.equals(nome, other.nome) && Objects.equals(valor, other.valor); 48 | } 49 | 50 | @Override 51 | public String toString() { 52 | return "FipeMarcas [nome=" + nome + ", valor=" + valor + "]"; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/br/com/brasilapi/api/FipePreco.java: -------------------------------------------------------------------------------- 1 | package br.com.brasilapi.api; 2 | 3 | import java.util.Objects; 4 | 5 | /** 6 | * Informações sobre Preço Médio de Veículos fornecido pela FIPE (Fundação 7 | * Instituto de Pesquisas Econômicas). 8 | * 9 | * @author Sávio Andres 10 | * @see https://brasilapi.com.br/docs#tag/FIPE 12 | */ 13 | public class FipePreco extends API { 14 | private String valor; 15 | private String marca; 16 | private String modelo; 17 | private String anoModelo; 18 | private String combustivel; 19 | private String codigoFipe; 20 | private String mesReferencia; 21 | private String tipoVeiculo; 22 | private String siglaCombustivel; 23 | private String dataConsulta; 24 | 25 | public String getValor() { 26 | return valor; 27 | } 28 | 29 | public void setValor(String valor) { 30 | this.valor = valor; 31 | } 32 | 33 | public String getMarca() { 34 | return marca; 35 | } 36 | 37 | public void setMarca(String marca) { 38 | this.marca = marca; 39 | } 40 | 41 | public String getModelo() { 42 | return modelo; 43 | } 44 | 45 | public void setModelo(String modelo) { 46 | this.modelo = modelo; 47 | } 48 | 49 | public String getAnoModelo() { 50 | return anoModelo; 51 | } 52 | 53 | public void setAnoModelo(String anoModelo) { 54 | this.anoModelo = anoModelo; 55 | } 56 | 57 | public String getCombustivel() { 58 | return combustivel; 59 | } 60 | 61 | public void setCombustivel(String combustivel) { 62 | this.combustivel = combustivel; 63 | } 64 | 65 | public String getCodigoFipe() { 66 | return codigoFipe; 67 | } 68 | 69 | public void setCodigoFipe(String codigoFipe) { 70 | this.codigoFipe = codigoFipe; 71 | } 72 | 73 | public String getMesReferencia() { 74 | return mesReferencia; 75 | } 76 | 77 | public void setMesReferencia(String mesReferencia) { 78 | this.mesReferencia = mesReferencia; 79 | } 80 | 81 | public String getTipoVeiculo() { 82 | return tipoVeiculo; 83 | } 84 | 85 | public void setTipoVeiculo(String tipoVeiculo) { 86 | this.tipoVeiculo = tipoVeiculo; 87 | } 88 | 89 | public String getSiglaCombustivel() { 90 | return siglaCombustivel; 91 | } 92 | 93 | public void setSiglaCombustivel(String siglaCombustivel) { 94 | this.siglaCombustivel = siglaCombustivel; 95 | } 96 | 97 | public String getDataConsulta() { 98 | return dataConsulta; 99 | } 100 | 101 | public void setDataConsulta(String dataConsulta) { 102 | this.dataConsulta = dataConsulta; 103 | } 104 | 105 | @Override 106 | public int hashCode() { 107 | return Objects.hash(anoModelo, codigoFipe, combustivel, dataConsulta, marca, mesReferencia, modelo, 108 | siglaCombustivel, tipoVeiculo, valor); 109 | } 110 | 111 | @Override 112 | public boolean equals(Object obj) { 113 | if (this == obj) 114 | return true; 115 | if (obj == null) 116 | return false; 117 | if (getClass() != obj.getClass()) 118 | return false; 119 | FipePreco other = (FipePreco) obj; 120 | return Objects.equals(anoModelo, other.anoModelo) && Objects.equals(codigoFipe, other.codigoFipe) 121 | && Objects.equals(combustivel, other.combustivel) && Objects.equals(dataConsulta, other.dataConsulta) 122 | && Objects.equals(marca, other.marca) && Objects.equals(mesReferencia, other.mesReferencia) 123 | && Objects.equals(modelo, other.modelo) && Objects.equals(siglaCombustivel, other.siglaCombustivel) 124 | && Objects.equals(tipoVeiculo, other.tipoVeiculo) && Objects.equals(valor, other.valor); 125 | } 126 | 127 | @Override 128 | public String toString() { 129 | return "FipePreco [valor=" + valor + ", marca=" + marca + ", modelo=" + modelo + ", anoModelo=" + anoModelo 130 | + ", combustivel=" + combustivel + ", codigoFipe=" + codigoFipe + ", mesReferencia=" + mesReferencia 131 | + ", tipoVeiculo=" + tipoVeiculo + ", siglaCombustivel=" + siglaCombustivel + ", dataConsulta=" 132 | + dataConsulta + "]"; 133 | } 134 | 135 | } 136 | -------------------------------------------------------------------------------- /src/main/java/br/com/brasilapi/api/FipeTabela.java: -------------------------------------------------------------------------------- 1 | package br.com.brasilapi.api; 2 | 3 | import java.util.Objects; 4 | 5 | /** 6 | * Lista as tabelas de referência existentes. FIPE (Fundação 7 | * Instituto de Pesquisas Econômicas). 8 | * 9 | * @author Sávio Andres 10 | * @see https://brasilapi.com.br/docs#tag/FIPE 12 | */ 13 | public class FipeTabela extends API { 14 | private Integer codigo; 15 | private String mes; 16 | 17 | public Integer getCodigo() { 18 | return codigo; 19 | } 20 | 21 | public void setCodigo(Integer codigo) { 22 | this.codigo = codigo; 23 | } 24 | 25 | public String getMes() { 26 | return mes; 27 | } 28 | 29 | public void setMes(String mes) { 30 | this.mes = mes; 31 | } 32 | 33 | @Override 34 | public int hashCode() { 35 | return Objects.hash(codigo, mes); 36 | } 37 | 38 | @Override 39 | public boolean equals(Object obj) { 40 | if (this == obj) 41 | return true; 42 | if (obj == null) 43 | return false; 44 | if (getClass() != obj.getClass()) 45 | return false; 46 | FipeTabela other = (FipeTabela) obj; 47 | return Objects.equals(codigo, other.codigo) && Objects.equals(mes, other.mes); 48 | } 49 | 50 | @Override 51 | public String toString() { 52 | return "FipeTabelas [codigo=" + codigo + ", mes=" + mes + "]"; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/br/com/brasilapi/api/IBGEMunicipio.java: -------------------------------------------------------------------------------- 1 | package br.com.brasilapi.api; 2 | 3 | import java.util.Objects; 4 | 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | /** 8 | * Informações sobre municípios provenientes do IBGE. 9 | * 10 | * @author Sávio Andres 11 | * @see https://brasilapi.com.br/docs#tag/IBGE 13 | */ 14 | public class IBGEMunicipio extends API { 15 | private String nome; 16 | @SerializedName("codigo_ibge") 17 | private String codigoIbge; 18 | 19 | public String getNome() { 20 | return nome; 21 | } 22 | 23 | public void setNome(String nome) { 24 | this.nome = nome; 25 | } 26 | 27 | public String getCodigoIbge() { 28 | return codigoIbge; 29 | } 30 | 31 | public void setCodigoIbge(String codigoIbge) { 32 | this.codigoIbge = codigoIbge; 33 | } 34 | 35 | @Override 36 | public int hashCode() { 37 | return Objects.hash(codigoIbge, nome); 38 | } 39 | 40 | @Override 41 | public boolean equals(Object obj) { 42 | if (this == obj) 43 | return true; 44 | if (obj == null) 45 | return false; 46 | if (getClass() != obj.getClass()) 47 | return false; 48 | IBGEMunicipio other = (IBGEMunicipio) obj; 49 | return Objects.equals(codigoIbge, other.codigoIbge) && Objects.equals(nome, other.nome); 50 | } 51 | 52 | @Override 53 | public String toString() { 54 | return "IBGEMunicipios [nome=" + nome + ", codigoIbge=" + codigoIbge + "]"; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/br/com/brasilapi/api/IBGEUF.java: -------------------------------------------------------------------------------- 1 | package br.com.brasilapi.api; 2 | 3 | import java.util.Objects; 4 | 5 | /** 6 | * Informações sobre estados provenientes do IBGE. 7 | * 8 | * @author Sávio Andres 9 | * @see https://brasilapi.com.br/docs#tag/IBGE 11 | */ 12 | public class IBGEUF extends API { 13 | private Integer id; 14 | private String sigla; 15 | private String nome; 16 | private IBGEUFRegiao regiao; 17 | 18 | public Integer getId() { 19 | return id; 20 | } 21 | 22 | public void setId(Integer id) { 23 | this.id = id; 24 | } 25 | 26 | public String getSigla() { 27 | return sigla; 28 | } 29 | 30 | public void setSigla(String sigla) { 31 | this.sigla = sigla; 32 | } 33 | 34 | public String getNome() { 35 | return nome; 36 | } 37 | 38 | public void setNome(String nome) { 39 | this.nome = nome; 40 | } 41 | 42 | public IBGEUFRegiao getRegiao() { 43 | return regiao; 44 | } 45 | 46 | public void setRegiao(IBGEUFRegiao regiao) { 47 | this.regiao = regiao; 48 | } 49 | 50 | @Override 51 | public int hashCode() { 52 | return Objects.hash(id, nome, regiao, sigla); 53 | } 54 | 55 | @Override 56 | public boolean equals(Object obj) { 57 | if (this == obj) 58 | return true; 59 | if (obj == null) 60 | return false; 61 | if (getClass() != obj.getClass()) 62 | return false; 63 | IBGEUF other = (IBGEUF) obj; 64 | return Objects.equals(id, other.id) && Objects.equals(nome, other.nome) && Objects.equals(regiao, other.regiao) 65 | && Objects.equals(sigla, other.sigla); 66 | } 67 | 68 | @Override 69 | public String toString() { 70 | return "IbgeUf [id=" + id + ", sigla=" + sigla + ", nome=" + nome + ", regiao=" + regiao + "]"; 71 | } 72 | 73 | public class IBGEUFRegiao { 74 | private Integer id; 75 | private String sigla; 76 | private String nome; 77 | 78 | public Integer getId() { 79 | return id; 80 | } 81 | 82 | public void setId(Integer id) { 83 | this.id = id; 84 | } 85 | 86 | public String getSigla() { 87 | return sigla; 88 | } 89 | 90 | public void setSigla(String sigla) { 91 | this.sigla = sigla; 92 | } 93 | 94 | public String getNome() { 95 | return nome; 96 | } 97 | 98 | public void setNome(String nome) { 99 | this.nome = nome; 100 | } 101 | 102 | @Override 103 | public int hashCode() { 104 | final int prime = 31; 105 | int result = 1; 106 | result = prime * result + getEnclosingInstance().hashCode(); 107 | result = prime * result + Objects.hash(id, nome, sigla); 108 | return result; 109 | } 110 | 111 | @Override 112 | public boolean equals(Object obj) { 113 | if (this == obj) 114 | return true; 115 | if (obj == null) 116 | return false; 117 | if (getClass() != obj.getClass()) 118 | return false; 119 | IBGEUFRegiao other = (IBGEUFRegiao) obj; 120 | if (!getEnclosingInstance().equals(other.getEnclosingInstance())) 121 | return false; 122 | return Objects.equals(id, other.id) && Objects.equals(nome, other.nome) 123 | && Objects.equals(sigla, other.sigla); 124 | } 125 | 126 | @Override 127 | public String toString() { 128 | return "IbgeUfRegiao [id=" + id + ", sigla=" + sigla + ", nome=" + nome + "]"; 129 | } 130 | 131 | private IBGEUF getEnclosingInstance() { 132 | return IBGEUF.this; 133 | } 134 | 135 | } 136 | 137 | } 138 | -------------------------------------------------------------------------------- /src/main/java/br/com/brasilapi/api/ISBN.java: -------------------------------------------------------------------------------- 1 | package br.com.brasilapi.api; 2 | 3 | import java.util.Arrays; 4 | import java.util.Objects; 5 | 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | /** 9 | * Informações sobre livros publicados no Brasil (prefixo 65 ou 85) a partir do 10 | * ISBN, um sistema internacional de identificação de livros que utiliza números 11 | * para classificá-los por título, autor, país, editora e edição. 12 | * 13 | * @author Sávio Andres 14 | * @see https://brasilapi.com.br/docs#tag/ISBN 16 | */ 17 | public class ISBN extends API { 18 | private String isbn; 19 | private String title; 20 | private String subtitle; 21 | private String[] authors; 22 | private String publisher; 23 | private String synopsis; 24 | private Dimension dimensions; 25 | private Short year; 26 | private String format; 27 | @SerializedName("page_count") 28 | private Integer pageCount; 29 | private String[] subjects; 30 | private String location; 31 | @SerializedName("retail_price") 32 | private RetailPrice retailPrice; 33 | @SerializedName("cover_url") 34 | private String coverUrl; 35 | private String provider; 36 | 37 | public String getIsbn() { 38 | return isbn; 39 | } 40 | 41 | public void setIsbn(String isbn) { 42 | this.isbn = isbn; 43 | } 44 | 45 | public String getTitle() { 46 | return title; 47 | } 48 | 49 | public void setTitle(String title) { 50 | this.title = title; 51 | } 52 | 53 | public String getSubtitle() { 54 | return subtitle; 55 | } 56 | 57 | public void setSubtitle(String subtitle) { 58 | this.subtitle = subtitle; 59 | } 60 | 61 | public String[] getAuthors() { 62 | return authors; 63 | } 64 | 65 | public void setAuthors(String[] authors) { 66 | this.authors = authors; 67 | } 68 | 69 | public String getPublisher() { 70 | return publisher; 71 | } 72 | 73 | public void setPublisher(String publisher) { 74 | this.publisher = publisher; 75 | } 76 | 77 | public String getSynopsis() { 78 | return synopsis; 79 | } 80 | 81 | public void setSynopsis(String synopsis) { 82 | this.synopsis = synopsis; 83 | } 84 | 85 | public Dimension getDimensions() { 86 | return dimensions; 87 | } 88 | 89 | public void setDimensions(Dimension dimensions) { 90 | this.dimensions = dimensions; 91 | } 92 | 93 | public Short getYear() { 94 | return year; 95 | } 96 | 97 | public void setYear(Short year) { 98 | this.year = year; 99 | } 100 | 101 | public String getFormat() { 102 | return format; 103 | } 104 | 105 | public void setFormat(String format) { 106 | this.format = format; 107 | } 108 | 109 | public Integer getPageCount() { 110 | return pageCount; 111 | } 112 | 113 | public void setPageCount(Integer pageCount) { 114 | this.pageCount = pageCount; 115 | } 116 | 117 | public String[] getSubjects() { 118 | return subjects; 119 | } 120 | 121 | public void setSubjects(String[] subjects) { 122 | this.subjects = subjects; 123 | } 124 | 125 | public String getLocation() { 126 | return location; 127 | } 128 | 129 | public void setLocation(String location) { 130 | this.location = location; 131 | } 132 | 133 | public RetailPrice getRetailPrice() { 134 | return retailPrice; 135 | } 136 | 137 | public void setRetailPrice(RetailPrice retailPrice) { 138 | this.retailPrice = retailPrice; 139 | } 140 | 141 | public String getCoverUrl() { 142 | return coverUrl; 143 | } 144 | 145 | public void setCoverUrl(String coverUrl) { 146 | this.coverUrl = coverUrl; 147 | } 148 | 149 | public String getProvider() { 150 | return provider; 151 | } 152 | 153 | public void setProvider(String provider) { 154 | this.provider = provider; 155 | } 156 | 157 | @Override 158 | public int hashCode() { 159 | final int prime = 31; 160 | int result = 1; 161 | result = prime * result + Arrays.hashCode(authors); 162 | result = prime * result + Arrays.hashCode(subjects); 163 | result = prime * result + Objects.hash(coverUrl, dimensions, format, isbn, location, pageCount, provider, 164 | publisher, retailPrice, subtitle, synopsis, title, year); 165 | return result; 166 | } 167 | 168 | @Override 169 | public boolean equals(Object obj) { 170 | if (this == obj) 171 | return true; 172 | if (obj == null) 173 | return false; 174 | if (getClass() != obj.getClass()) 175 | return false; 176 | ISBN other = (ISBN) obj; 177 | return Arrays.equals(authors, other.authors) && Objects.equals(coverUrl, other.coverUrl) 178 | && Objects.equals(dimensions, other.dimensions) && Objects.equals(format, other.format) 179 | && Objects.equals(isbn, other.isbn) && Objects.equals(location, other.location) 180 | && Objects.equals(pageCount, other.pageCount) && Objects.equals(provider, other.provider) 181 | && Objects.equals(publisher, other.publisher) && Objects.equals(retailPrice, other.retailPrice) 182 | && Arrays.equals(subjects, other.subjects) && Objects.equals(subtitle, other.subtitle) 183 | && Objects.equals(synopsis, other.synopsis) && Objects.equals(title, other.title) 184 | && Objects.equals(year, other.year); 185 | } 186 | 187 | @Override 188 | public String toString() { 189 | return "ISBN [isbn=" + isbn + ", title=" + title + ", subtitle=" + subtitle + ", authors=" 190 | + Arrays.toString(authors) + ", publisher=" + publisher + ", synopsis=" + synopsis + ", dimensions=" 191 | + dimensions + ", year=" + year + ", format=" + format + ", pageCount=" + pageCount + ", subjects=" 192 | + Arrays.toString(subjects) + ", location=" + location + ", retailPrice=" + retailPrice + ", coverUrl=" 193 | + coverUrl + ", provider=" + provider + "]"; 194 | } 195 | 196 | public class Dimension { 197 | private Float width; 198 | private Float height; 199 | private String unit; 200 | 201 | public Float getWidth() { 202 | return width; 203 | } 204 | 205 | public void setWidth(Float width) { 206 | this.width = width; 207 | } 208 | 209 | public Float getHeight() { 210 | return height; 211 | } 212 | 213 | public void setHeight(Float height) { 214 | this.height = height; 215 | } 216 | 217 | public String getUnit() { 218 | return unit; 219 | } 220 | 221 | public void setUnit(String unit) { 222 | this.unit = unit; 223 | } 224 | 225 | @Override 226 | public int hashCode() { 227 | final int prime = 31; 228 | int result = 1; 229 | result = prime * result + getEnclosingInstance().hashCode(); 230 | result = prime * result + Objects.hash(height, unit, width); 231 | return result; 232 | } 233 | 234 | @Override 235 | public boolean equals(Object obj) { 236 | if (this == obj) 237 | return true; 238 | if (obj == null) 239 | return false; 240 | if (getClass() != obj.getClass()) 241 | return false; 242 | Dimension other = (Dimension) obj; 243 | if (!getEnclosingInstance().equals(other.getEnclosingInstance())) 244 | return false; 245 | return Objects.equals(height, other.height) && Objects.equals(unit, other.unit) 246 | && Objects.equals(width, other.width); 247 | } 248 | 249 | @Override 250 | public String toString() { 251 | return "Dimensions [width=" + width + ", height=" + height + ", unit=" + unit + "]"; 252 | } 253 | 254 | private ISBN getEnclosingInstance() { 255 | return ISBN.this; 256 | } 257 | 258 | } 259 | 260 | 261 | public class RetailPrice { 262 | private String currency; 263 | private Float amount; 264 | 265 | public String getCurrency() { 266 | return currency; 267 | } 268 | 269 | public void setCurrency(String currency) { 270 | this.currency = currency; 271 | } 272 | 273 | public Float getAmount() { 274 | return amount; 275 | } 276 | 277 | public void setAmount(Float amount) { 278 | this.amount = amount; 279 | } 280 | 281 | @Override 282 | public int hashCode() { 283 | final int prime = 31; 284 | int result = 1; 285 | result = prime * result + getEnclosingInstance().hashCode(); 286 | result = prime * result + Objects.hash(amount, currency); 287 | return result; 288 | } 289 | 290 | @Override 291 | public boolean equals(Object obj) { 292 | if (this == obj) 293 | return true; 294 | if (obj == null) 295 | return false; 296 | if (getClass() != obj.getClass()) 297 | return false; 298 | RetailPrice other = (RetailPrice) obj; 299 | if (!getEnclosingInstance().equals(other.getEnclosingInstance())) 300 | return false; 301 | return Objects.equals(amount, other.amount) && Objects.equals(currency, other.currency); 302 | } 303 | 304 | @Override 305 | public String toString() { 306 | return "RetailPrice [currency=" + currency + ", amount=" + amount + "]"; 307 | } 308 | 309 | private ISBN getEnclosingInstance() { 310 | return ISBN.this; 311 | } 312 | 313 | } 314 | 315 | } 316 | -------------------------------------------------------------------------------- /src/main/java/br/com/brasilapi/api/NCM.java: -------------------------------------------------------------------------------- 1 | package br.com.brasilapi.api; 2 | 3 | import java.util.Objects; 4 | 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | /** 8 | * Informações referentes a NCMs. Nomenclatura Comum do Mercosul (NCM). 9 | * 10 | * @author Sávio Andres 11 | * @see https://brasilapi.com.br/docs#tag/NCM 13 | */ 14 | public class NCM extends API { 15 | private String codigo; 16 | private String descricao; 17 | @SerializedName("data_inicio") 18 | private String dataInicio; 19 | @SerializedName("data_fim") 20 | private String dataFim; 21 | @SerializedName("tipo_ato") 22 | private String tipoAto; 23 | @SerializedName("numero_ato") 24 | private String numeroAto; 25 | @SerializedName("ano_ato") 26 | private String anoAto; 27 | 28 | public String getCodigo() { 29 | return codigo; 30 | } 31 | 32 | public void setCodigo(String codigo) { 33 | this.codigo = codigo; 34 | } 35 | 36 | public String getDescricao() { 37 | return descricao; 38 | } 39 | 40 | public void setDescricao(String descricao) { 41 | this.descricao = descricao; 42 | } 43 | 44 | public String getDataInicio() { 45 | return dataInicio; 46 | } 47 | 48 | public void setDataInicio(String dataInicio) { 49 | this.dataInicio = dataInicio; 50 | } 51 | 52 | public String getDataFim() { 53 | return dataFim; 54 | } 55 | 56 | public void setDataFim(String dataFim) { 57 | this.dataFim = dataFim; 58 | } 59 | 60 | public String getTipoAto() { 61 | return tipoAto; 62 | } 63 | 64 | public void setTipoAto(String tipoAto) { 65 | this.tipoAto = tipoAto; 66 | } 67 | 68 | public String getNumeroAto() { 69 | return numeroAto; 70 | } 71 | 72 | public void setNumeroAto(String numeroAto) { 73 | this.numeroAto = numeroAto; 74 | } 75 | 76 | public String getAnoAto() { 77 | return anoAto; 78 | } 79 | 80 | public void setAnoAto(String anoAto) { 81 | this.anoAto = anoAto; 82 | } 83 | 84 | @Override 85 | public int hashCode() { 86 | return Objects.hash(anoAto, codigo, dataFim, dataInicio, descricao, numeroAto, tipoAto); 87 | } 88 | 89 | @Override 90 | public boolean equals(Object obj) { 91 | if (this == obj) 92 | return true; 93 | if (obj == null) 94 | return false; 95 | if (getClass() != obj.getClass()) 96 | return false; 97 | NCM other = (NCM) obj; 98 | return Objects.equals(anoAto, other.anoAto) && Objects.equals(codigo, other.codigo) 99 | && Objects.equals(dataFim, other.dataFim) && Objects.equals(dataInicio, other.dataInicio) 100 | && Objects.equals(descricao, other.descricao) && Objects.equals(numeroAto, other.numeroAto) 101 | && Objects.equals(tipoAto, other.tipoAto); 102 | } 103 | 104 | @Override 105 | public String toString() { 106 | return "NCM [codigo=" + codigo + ", descricao=" + descricao + ", dataInicio=" + dataInicio + ", dataFim=" 107 | + dataFim + ", tipoAto=" + tipoAto + ", numeroAto=" + numeroAto + ", anoAto=" + anoAto + "]"; 108 | } 109 | 110 | } 111 | -------------------------------------------------------------------------------- /src/main/java/br/com/brasilapi/api/PIX.java: -------------------------------------------------------------------------------- 1 | package br.com.brasilapi.api; 2 | 3 | import java.sql.Timestamp; 4 | import java.util.Objects; 5 | 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | /** 9 | * Informações referentes ao PIX. 10 | * 11 | * @author Sávio Andres 12 | * @see https://brasilapi.com.br/docs#tag/PIX 14 | */ 15 | public class PIX extends API { 16 | private String ispb; 17 | private String nome; 18 | @SerializedName("nome_reduzido") 19 | private String nomeReduzido; 20 | @SerializedName("modalidade_participacao") 21 | private String modalidadeParticipacao; 22 | @SerializedName("tipo_participacao") 23 | private String tipoParticipacao; 24 | @SerializedName("inicio_operacao") 25 | private Timestamp inicioOperacao; 26 | 27 | public String getIspb() { 28 | return ispb; 29 | } 30 | 31 | public void setIspb(String ispb) { 32 | this.ispb = ispb; 33 | } 34 | 35 | /** 36 | * Obtém o nome do participante. 37 | */ 38 | public String getNome() { 39 | return nome; 40 | } 41 | 42 | /** 43 | * Define o nome do participante. 44 | */ 45 | public void setNome(String nome) { 46 | this.nome = nome; 47 | } 48 | 49 | /** 50 | * Obtém o nome reduzido do participante. 51 | */ 52 | public String getNomeReduzido() { 53 | return nomeReduzido; 54 | } 55 | 56 | /** 57 | * Define o nome reduzido do participante. 58 | */ 59 | public void setNomeReduzido(String nomeReduzido) { 60 | this.nomeReduzido = nomeReduzido; 61 | } 62 | 63 | /** 64 | * Obtém a modalidade de Participação. 65 | */ 66 | public String getModalidadeParticipacao() { 67 | return modalidadeParticipacao; 68 | } 69 | 70 | /** 71 | * Define a modalidade de Participação. 72 | */ 73 | public void setModalidadeParticipacao(String modalidadeParticipacao) { 74 | this.modalidadeParticipacao = modalidadeParticipacao; 75 | } 76 | 77 | /** 78 | * Obtém o tipo de participante. 79 | */ 80 | public String getTipoParticipacao() { 81 | return tipoParticipacao; 82 | } 83 | 84 | /** 85 | * Define o tipo de participante. 86 | */ 87 | public void setTipoParticipacao(String tipoParticipacao) { 88 | this.tipoParticipacao = tipoParticipacao; 89 | } 90 | 91 | /** 92 | * Obtém a data de inicio da operação 93 | */ 94 | public Timestamp getInicioOperacao() { 95 | return inicioOperacao; 96 | } 97 | 98 | /** 99 | * Define a data de inicio da operação 100 | */ 101 | public void setInicioOperacao(Timestamp inicioOperacao) { 102 | this.inicioOperacao = inicioOperacao; 103 | } 104 | 105 | @Override 106 | public int hashCode() { 107 | return Objects.hash(inicioOperacao, ispb, modalidadeParticipacao, nome, nomeReduzido, tipoParticipacao); 108 | } 109 | 110 | @Override 111 | public boolean equals(Object obj) { 112 | if (this == obj) 113 | return true; 114 | if (obj == null) 115 | return false; 116 | if (getClass() != obj.getClass()) 117 | return false; 118 | PIX other = (PIX) obj; 119 | return Objects.equals(inicioOperacao, other.inicioOperacao) && Objects.equals(ispb, other.ispb) 120 | && Objects.equals(modalidadeParticipacao, other.modalidadeParticipacao) 121 | && Objects.equals(nome, other.nome) && Objects.equals(nomeReduzido, other.nomeReduzido) 122 | && Objects.equals(tipoParticipacao, other.tipoParticipacao); 123 | } 124 | 125 | @Override 126 | public String toString() { 127 | return "PIX [ispb=" + ispb + ", nome=" + nome + ", nomeReduzido=" + nomeReduzido + ", modalidadeParticipacao=" 128 | + modalidadeParticipacao + ", tipoParticipacao=" + tipoParticipacao + ", inicioOperacao=" 129 | + inicioOperacao + "]"; 130 | } 131 | 132 | } 133 | -------------------------------------------------------------------------------- /src/main/java/br/com/brasilapi/api/RegistroBR.java: -------------------------------------------------------------------------------- 1 | package br.com.brasilapi.api; 2 | 3 | import java.util.Arrays; 4 | import java.util.Objects; 5 | 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | /** 9 | * Avalia um dominio no registro.br 10 | * 11 | * @author Sávio Andres 12 | * @see https://brasilapi.com.br/docs#tag/REGISTRO-BR 13 | */ 14 | public class RegistroBR extends API { 15 | @SerializedName("status_code") 16 | private Integer statusCode; 17 | private String status; 18 | private String fqdn; 19 | private String fqdnace; 20 | private Boolean exempt; 21 | private String[] hosts; 22 | @SerializedName("publication-status") 23 | private String publicationStatus; 24 | @SerializedName("expires-at") 25 | private String expiresAt; 26 | private String[] suggestions; 27 | 28 | public Integer getStatusCode() { 29 | return statusCode; 30 | } 31 | 32 | public void setStatusCode(Integer statusCode) { 33 | this.statusCode = statusCode; 34 | } 35 | 36 | public String getStatus() { 37 | return status; 38 | } 39 | 40 | public void setStatus(String status) { 41 | this.status = status; 42 | } 43 | 44 | public String getFqdn() { 45 | return fqdn; 46 | } 47 | 48 | public void setFqdn(String fqdn) { 49 | this.fqdn = fqdn; 50 | } 51 | 52 | public String getFqdnace() { 53 | return fqdnace; 54 | } 55 | 56 | public void setFqdnace(String fqdnace) { 57 | this.fqdnace = fqdnace; 58 | } 59 | 60 | public Boolean getExempt() { 61 | return exempt; 62 | } 63 | 64 | public void setExempt(Boolean exempt) { 65 | this.exempt = exempt; 66 | } 67 | 68 | public String[] getHosts() { 69 | return hosts; 70 | } 71 | 72 | public void setHosts(String[] hosts) { 73 | this.hosts = hosts; 74 | } 75 | 76 | public String getPublicationStatus() { 77 | return publicationStatus; 78 | } 79 | 80 | public void setPublicationStatus(String publicationStatus) { 81 | this.publicationStatus = publicationStatus; 82 | } 83 | 84 | public String getExpiresAt() { 85 | return expiresAt; 86 | } 87 | 88 | public void setExpiresAt(String expiresAt) { 89 | this.expiresAt = expiresAt; 90 | } 91 | 92 | public String[] getSuggestions() { 93 | return suggestions; 94 | } 95 | 96 | public void setSuggestions(String[] suggestions) { 97 | this.suggestions = suggestions; 98 | } 99 | 100 | @Override 101 | public int hashCode() { 102 | final int prime = 31; 103 | int result = 1; 104 | result = prime * result + Arrays.hashCode(hosts); 105 | result = prime * result + Arrays.hashCode(suggestions); 106 | result = prime * result + Objects.hash(exempt, expiresAt, fqdn, fqdnace, publicationStatus, status, statusCode); 107 | return result; 108 | } 109 | 110 | @Override 111 | public boolean equals(Object obj) { 112 | if (this == obj) 113 | return true; 114 | if (obj == null) 115 | return false; 116 | if (getClass() != obj.getClass()) 117 | return false; 118 | RegistroBR other = (RegistroBR) obj; 119 | return Objects.equals(exempt, other.exempt) && Objects.equals(expiresAt, other.expiresAt) 120 | && Objects.equals(fqdn, other.fqdn) && Objects.equals(fqdnace, other.fqdnace) 121 | && Arrays.equals(hosts, other.hosts) && Objects.equals(publicationStatus, other.publicationStatus) 122 | && Objects.equals(status, other.status) && Objects.equals(statusCode, other.statusCode) 123 | && Arrays.equals(suggestions, other.suggestions); 124 | } 125 | 126 | @Override 127 | public String toString() { 128 | return "RegistroBR [statusCode=" + statusCode + ", status=" + status + ", fqdn=" + fqdn + ", fqdnace=" + fqdnace 129 | + ", exempt=" + exempt + ", hosts=" + Arrays.toString(hosts) + ", publicationStatus=" 130 | + publicationStatus + ", expiresAt=" + expiresAt + ", suggestions=" + Arrays.toString(suggestions) 131 | + "]"; 132 | } 133 | 134 | } 135 | -------------------------------------------------------------------------------- /src/main/java/br/com/brasilapi/api/Taxa.java: -------------------------------------------------------------------------------- 1 | package br.com.brasilapi.api; 2 | 3 | import java.util.Objects; 4 | 5 | /** 6 | * Taxas de juros e índices oficiais do Brasil. 7 | * 8 | * @author Sávio Andres 9 | * @see https://brasilapi.com.br/docs#tag/TAXAS 11 | */ 12 | public class Taxa extends API { 13 | private String nome; 14 | private Float valor; 15 | 16 | public String getNome() { 17 | return nome; 18 | } 19 | 20 | public void setNome(String nome) { 21 | this.nome = nome; 22 | } 23 | 24 | public Float getValor() { 25 | return valor; 26 | } 27 | 28 | public void setValor(Float valor) { 29 | this.valor = valor; 30 | } 31 | 32 | @Override 33 | public int hashCode() { 34 | return Objects.hash(nome, valor); 35 | } 36 | 37 | @Override 38 | public boolean equals(Object obj) { 39 | if (this == obj) 40 | return true; 41 | if (obj == null) 42 | return false; 43 | if (getClass() != obj.getClass()) 44 | return false; 45 | Taxa other = (Taxa) obj; 46 | return Objects.equals(nome, other.nome) && Objects.equals(valor, other.valor); 47 | } 48 | 49 | @Override 50 | public String toString() { 51 | return "Taxas [nome=" + nome + ", valor=" + valor + "]"; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/test/java/br/com/brasilapi/BrasilAPITest.java: -------------------------------------------------------------------------------- 1 | package br.com.brasilapi; 2 | 3 | import static org.junit.jupiter.api.Assertions.*; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | import br.com.brasilapi.api.Bank; 8 | import br.com.brasilapi.api.CEP; 9 | import br.com.brasilapi.api.CEP2; 10 | import br.com.brasilapi.api.CNPJ; 11 | import br.com.brasilapi.api.CPTECCidade; 12 | import br.com.brasilapi.api.CPTECClimaAeroporto; 13 | import br.com.brasilapi.api.CPTECClimaCapital; 14 | import br.com.brasilapi.api.CPTECClimaPrevisao; 15 | import br.com.brasilapi.api.CPTECOnda; 16 | import br.com.brasilapi.api.Corretora; 17 | import br.com.brasilapi.api.DDD; 18 | import br.com.brasilapi.api.Feriados; 19 | import br.com.brasilapi.api.FipeMarca; 20 | import br.com.brasilapi.api.FipePreco; 21 | import br.com.brasilapi.api.FipeTabela; 22 | import br.com.brasilapi.api.IBGEMunicipio; 23 | import br.com.brasilapi.api.IBGEUF; 24 | import br.com.brasilapi.api.ISBN; 25 | import br.com.brasilapi.api.NCM; 26 | import br.com.brasilapi.api.PIX; 27 | import br.com.brasilapi.api.RegistroBR; 28 | import br.com.brasilapi.api.Taxa; 29 | 30 | class BrasilAPITest { 31 | 32 | @Test 33 | void logPass() { 34 | BrasilAPI.setEnableLog(true); 35 | assertEquals(true, BrasilAPI.getEnableLog()); 36 | } 37 | 38 | @Test 39 | void cachePass() { 40 | BrasilAPI.setEnableCache(true); 41 | assertEquals(true, BrasilAPI.getEnableCache()); 42 | } 43 | 44 | @Test 45 | void banksPass() { 46 | Bank[] bank = BrasilAPI.banks(); 47 | assertNotNull(bank); 48 | } 49 | 50 | @Test 51 | void bankPass() { 52 | Bank bank = BrasilAPI.bank("1"); 53 | assertEquals("1", bank.getCode()); 54 | } 55 | 56 | @Test 57 | void cepPass() { 58 | CEP expectedCep = new CEP(); 59 | expectedCep.setCep("04538133"); 60 | expectedCep.setState("SP"); 61 | expectedCep.setCity("São Paulo"); 62 | expectedCep.setNeighborhood("Itaim Bibi"); 63 | expectedCep.setStreet("Avenida Brigadeiro Faria Lima"); 64 | expectedCep.setService("correios"); 65 | 66 | CEP actualCep = BrasilAPI.cep("04538133"); 67 | 68 | assertEquals(expectedCep.toString(), actualCep.toString()); 69 | } 70 | 71 | @Test 72 | void cep2Pass() { 73 | CEP2 cep2 = BrasilAPI.cep2("04538133"); 74 | assertEquals("04538133", cep2.getCep()); 75 | } 76 | 77 | @Test 78 | void cnpjPass() { 79 | CNPJ cnpj = BrasilAPI.cnpj("06.990.590/0001-23"); 80 | assertEquals("06990590000123", cnpj.getCnpj()); 81 | } 82 | 83 | @Test 84 | void corretorasPass() { 85 | Corretora[] corretoras = BrasilAPI.corretoras(); 86 | assertNotNull(corretoras); 87 | } 88 | 89 | @Test 90 | void corretoraPass() { 91 | Corretora corretora = BrasilAPI.corretora("02.332.886/0001-04"); 92 | assertEquals("02332886000104", corretora.getCnpj()); 93 | } 94 | 95 | @Test 96 | void cptecListarLocalidadesPass() { 97 | CPTECCidade[] cptecCidade = BrasilAPI.cptecListarLocalidades(); 98 | assertNotNull(cptecCidade); 99 | } 100 | 101 | @Test 102 | void cptecBuscarLocalidadesPass() { 103 | CPTECCidade[] cptecCidade = BrasilAPI.cptecBuscarLocalidades("São Paulo"); 104 | assertNotNull(cptecCidade); 105 | } 106 | 107 | @Test 108 | void cptecCondicoesAtuaisCapitaisPass() { 109 | CPTECClimaCapital[] cptecClimaCapital = BrasilAPI.cptecCondicoesAtuaisCapitais(); 110 | assertNotNull(cptecClimaCapital); 111 | } 112 | 113 | @Test 114 | void cptecCondicoesAtuaisAeroportoPass() { 115 | CPTECClimaAeroporto cptecClimaAeroporto = BrasilAPI.cptecCondicoesAtuaisAeroporto("SBAR"); 116 | assertEquals("SBAR", cptecClimaAeroporto.getCodigoIcao()); 117 | } 118 | 119 | @Test 120 | void cptecPrevisaoMeteorologicaCidadePass() { 121 | CPTECClimaPrevisao cptecClimaPrevisao = BrasilAPI.cptecPrevisaoMeteorologicaCidade(442); 122 | assertEquals("SP", cptecClimaPrevisao.getEstado()); 123 | } 124 | 125 | @Test 126 | void cptecPrevisaoMeteorologicaCidadeDiasPass() { 127 | CPTECClimaPrevisao cptecClimaPrevisao = BrasilAPI.cptecPrevisaoMeteorologicaCidade(442, 4); 128 | assertEquals("SP", cptecClimaPrevisao.getEstado()); 129 | } 130 | 131 | @Test 132 | void cptecPrevisaoOceanicaPass() { 133 | CPTECOnda cptecOnda = BrasilAPI.cptecPrevisaoOceanica(241); 134 | assertEquals("Rio de Janeiro", cptecOnda.getCidade()); 135 | } 136 | 137 | @Test 138 | void cptecPrevisaoOceanicaDiasPass() { 139 | CPTECOnda cptecOnda = BrasilAPI.cptecPrevisaoOceanica(241, 2); 140 | assertEquals("Rio de Janeiro", cptecOnda.getCidade()); 141 | } 142 | 143 | @Test 144 | void dddPass() { 145 | DDD ddd = BrasilAPI.ddd("79"); 146 | assertEquals("SE", ddd.getState()); 147 | } 148 | 149 | @Test 150 | void feriadosPass() { 151 | Feriados[] feriados = BrasilAPI.feriados("2023"); 152 | assertEquals("2023-01-01", feriados[0].getDate()); 153 | } 154 | 155 | @Test 156 | void fipeMarcasPass() { 157 | FipeMarca[] fipeMarcas = BrasilAPI.fipeMarcas("carros"); 158 | assertNotNull(fipeMarcas); 159 | } 160 | 161 | @Test 162 | void fipePrecosPass() { 163 | FipePreco[] fipePrecos = BrasilAPI.fipePrecos("031049-2"); 164 | assertEquals("Ferrari", fipePrecos[0].getMarca()); 165 | } 166 | 167 | @Test 168 | void fipeTabelasPass() { 169 | FipeTabela[] fipeTabelas = BrasilAPI.fipeTabelas(); 170 | assertNotNull(fipeTabelas); 171 | } 172 | 173 | @Test 174 | void ibgeMunicipiosPass() { 175 | IBGEMunicipio[] ibgeMunicipios1 = BrasilAPI.ibgeMunicipios("SE"); 176 | IBGEMunicipio[] ibgeMunicipios2 = BrasilAPI.ibgeMunicipios("SE", new String[] { "dados-abertos-br" }); 177 | assertNotNull(ibgeMunicipios1); 178 | assertNotNull(ibgeMunicipios2); 179 | } 180 | 181 | @Test 182 | void ibgeUfsPass() { 183 | IBGEUF[] ibgeUfs = BrasilAPI.ibgeUf(); 184 | assertNotNull(ibgeUfs); 185 | } 186 | 187 | @Test 188 | void ibgeUfPass() { 189 | IBGEUF ibgeUf = BrasilAPI.ibgeUf("SE"); 190 | assertEquals("SE", ibgeUf.getSigla()); 191 | } 192 | 193 | @Test 194 | void isbnPass() { 195 | ISBN isbn1 = BrasilAPI.isbn("9788567097688"); 196 | ISBN isbn2 = BrasilAPI.isbn("9788567097688", new String[] { "cbl" }); 197 | assertEquals("9788567097688", isbn1.getIsbn()); 198 | assertEquals("9788567097688", isbn2.getIsbn()); 199 | } 200 | 201 | @Test 202 | void ncmPass() { 203 | NCM[] ncm = BrasilAPI.ncm(); 204 | assertNotNull(ncm); 205 | } 206 | 207 | @Test 208 | void ncmCodePass() { 209 | NCM ncm = BrasilAPI.ncm("01"); 210 | assertEquals("01", ncm.getCodigo()); 211 | } 212 | 213 | @Test 214 | void ncmSearchPass() { 215 | NCM[] ncmSearch = BrasilAPI.ncmSearch("Animais vivos."); 216 | assertNotNull(ncmSearch); 217 | } 218 | 219 | @Test 220 | void pixParticipantesPass() { 221 | PIX[] pix = BrasilAPI.pixParticipantes(); 222 | assertNotNull(pix); 223 | } 224 | 225 | @Test 226 | void registroBRPass() { 227 | RegistroBR registroBR = BrasilAPI.registroBR("savio.pw"); 228 | assertNotNull(registroBR); 229 | } 230 | 231 | @Test 232 | void taxasPass() { 233 | Taxa[] taxas = BrasilAPI.taxas(); 234 | assertNotNull(taxas); 235 | } 236 | 237 | @Test 238 | void taxaPass() { 239 | Taxa taxa = BrasilAPI.taxa("SELIC"); 240 | assertEquals("SELIC", taxa.getNome()); 241 | } 242 | 243 | } 244 | --------------------------------------------------------------------------------