Skip to content

Commit

Permalink
Adjust module with language news and bug in the api server
Browse files Browse the repository at this point in the history
  • Loading branch information
Ddiidev committed Jan 7, 2024
1 parent 963b7c1 commit a6e0b31
Show file tree
Hide file tree
Showing 19 changed files with 45 additions and 37 deletions.
2 changes: 1 addition & 1 deletion banks/v1/bank_entities.v
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ pub:
ispb string
name string
code int
full_name string [json: 'fullName']
full_name string @[json: 'fullName']
}
4 changes: 2 additions & 2 deletions cnpj/type_cnpj_Code.v
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module cnpj
pub type CNPJ = string

// remove_format_cnpj Remove caracteres especiais do CNPJ
pub fn (cnpj CNPJ) remove_format_cnpj() string {
mut cnpj_code := cnpj
pub fn (c CNPJ) remove_format_cnpj() string {
mut cnpj_code := c

for chr in ['.', '/', '-', ' '] {
cnpj_code = cnpj_code.replace(chr, '')
Expand Down
4 changes: 4 additions & 0 deletions corretora/v1/corretoras.v
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ pub fn get_all() ![]Corretora {
message: err.msg()
} }

if resp.status_code == 500 {
return error_with_code(resp.status_msg, resp.status_code)
}

mut js := json.decode([]Corretora_temp, resp.body) or {
return CorretoraError{
message: err.msg()
Expand Down
2 changes: 1 addition & 1 deletion cptec/v1/capital_entities.v
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ pub:
direcao_vento int
umidade int
condicao string
condicao_desc string [json: 'condicao_Desc']
condicao_desc string @[json: 'condicao_Desc']
temp int
}
4 changes: 2 additions & 2 deletions cptec/v1/cptec.v
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ const uri_previsao_cidade = 'https://brasilapi.com.br/api/cptec/v1/clima/previsa

const uri_previsao_oceanica_cidade = 'https://brasilapi.com.br/api/cptec/v1/ondas/'

[params]
@[params]
pub struct ParamCidades {
pub:
city_name ?string
}

[params]
@[params]
pub struct ParamPrevisaoCidade {
pub:
city_code int
Expand Down
2 changes: 1 addition & 1 deletion feriados_nacionais/v1/feriados_nacionais_entities.v
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module v1
import time

pub struct FeriadoNacional {
date_str string [json: 'date']
date_str string @[json: 'date']
pub:
date time.Time
name string
Expand Down
12 changes: 6 additions & 6 deletions fipe/v1/fipe.v
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ const uri_precos = 'https://brasilapi.com.br/api/fipe/preco/v1'
const uri_tabelas_referencia = 'https://brasilapi.com.br/api/fipe/tabelas/v1'

// Parâmetros para a função get_marcas
[params]
@[params]
pub struct ParamMarcas {
pub:
tipo_veiculo TiposVeiculo [required]
tabela_referencia ?i32
tipo_veiculo TiposVeiculo @[required]
tabela_referencia ?int
}

// Parâmetros para a função get_precos
[params]
@[params]
pub struct ParamPrecos {
pub:
codigo_fipe string [required]
tabela_referencia ?i32
codigo_fipe string @[required]
tabela_referencia ?int
}

// get_marcas Lista as marcas de veículos referente ao tipo de veículo
Expand Down
12 changes: 6 additions & 6 deletions fipe/v1/fipe_veiculo_entities.v
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ pub:
valor string
marca string
modelo string
ano_modelo string [json: 'anoModelo']
ano_modelo string @[json: 'anoModelo']
combustivel string
codigo_fipe string [json: 'codigoFipe']
mes_referencia string [json: 'mesReferencia']
tipo_veiculo string [json: 'tipoVeiculo']
sigla_combustivel string [json: 'siglaCombustivel']
data_consulta string [json: 'dataConsulta']
codigo_fipe string @[json: 'codigoFipe']
mes_referencia string @[json: 'mesReferencia']
tipo_veiculo string @[json: 'tipoVeiculo']
sigla_combustivel string @[json: 'siglaCombustivel']
data_consulta string @[json: 'dataConsulta']
}
2 changes: 1 addition & 1 deletion ibge/v1/enum_providers.v
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module v1

[flag]
@[flag]
pub enum Providers {
dados_abertos_br
gov
Expand Down
6 changes: 3 additions & 3 deletions ibge/v1/ibge.v
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ const uri_municipios = 'https://brasilapi.com.br/api/ibge/municipios/v1'
// Para referência https://brasilapi.com.br/docs#tag/IBGE/paths/~1ibge~1uf~1v1/get
const uri_uf = 'https://brasilapi.com.br/api/ibge/uf/v1'

[params]
@[params]
pub struct ParamsGet {
pub:
uf string [required]
providers Providers [required]
uf string @[required]
providers Providers @[required]
}

// get_municipios Retorna os municípios da unidade federativa
Expand Down
4 changes: 2 additions & 2 deletions ibge/v1/ibge_estados_entities.v
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ module v1

pub struct Estado {
pub:
id i32
id int
sigla string
nome string
regiao ?Regiao
}

pub struct Regiao {
pub:
id i32
id int
sigla string
nome string
}
2 changes: 1 addition & 1 deletion isbn/v1/enum_provider.v
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module v1

import utils

[flag]
@[flag]
pub enum Provider {
cbl
mercado_editorial
Expand Down
4 changes: 2 additions & 2 deletions isbn/v1/isbn.v
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import isbn.errors { IsbnError }
// Para referência https://brasilapi.com.br/docs#tag/ISBN/paths/~1isbn~1v1~1{isbn}/get
const uri_isbn = 'https://brasilapi.com.br/api/isbn/v1'

[params]
@[params]
pub struct ParamGet {
pub:
isbn string [required]
isbn string @[required]
provider Provider = Provider.google_books | .cbl | .open_library | .mercado_editorial
}

Expand Down
2 changes: 1 addition & 1 deletion isbn/v1/isbn_entities.v
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub:
provider Provider
}

[noinit]
@[noinit]
struct ISBN_ {
pub:
isbn string
Expand Down
2 changes: 1 addition & 1 deletion ncm/v1/ncm.v
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import net.urllib
// https://brasilapi.com.br/docs#tag/NCM
const uri_ncm = 'https://brasilapi.com.br/api/ncm/v1'

[params]
@[params]
pub struct ParamGet {
// search Busca pelo código NCM ou descrição.
search ?string
Expand Down
4 changes: 2 additions & 2 deletions registro_br/v1/registro_br_entities.v
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub:
status string
fqdn string
hosts []string
publication_status string [json: 'publication-status']
expires_at string [json: 'expires-at']
publication_status string @[json: 'publication-status']
expires_at string @[json: 'expires-at']
suggestions []string
}
8 changes: 6 additions & 2 deletions tests/corretoras_v1_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ fn test_get_all_corretoras() {
assert corretoras.len > 0
} else {
if err is errors.CorretoraError {
assert false
assert false, err.msg()
} else if err.code() == 500 {
assert true
} else {
assert false, err.msg()
}
}
}
Expand All @@ -21,7 +25,7 @@ fn test_get_corretora_by_cnpj() {
&& corretora.valor_patrimonio_liquido > 0
} else {
if err is errors.CorretoraError {
assert false
assert false, 'Corretora não encontrada'
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/methods_utils_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module tests

import utils

[flag]
@[flag]
enum EnumTest {
name_x
name_y
Expand Down
4 changes: 2 additions & 2 deletions utils/list_names_enum.v
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module utils

[params]
@[params]
pub struct ParamGet_names_enum_setad[T] {
pub:
type_enum T [required]
type_enum T @[required]
source_data map[T]string
}

Expand Down

0 comments on commit a6e0b31

Please sign in to comment.