Documentation
¶
Index ¶
- Variables
- func ReportLogTracerError(errors ...string)
- type Date
- type Insee
- func (i *Insee) GetSiren(siren string) (resp SirenBaseResponse, err error)
- func (i *Insee) GetSirenMultiRequest(query []string) (resp SirenBaseResponses, err error)
- func (i *Insee) RefreshAuthToken() (err error)
- func (i *Insee) SetAuthToken() (err error)
- func (i *Insee) SirenExist(siren string) bool
- type InseeToken
- type SirenBaseHeader
- type SirenBaseResponse
- type SirenBaseResponses
- type SirenLegalUnit
- type SirenPeriodLegalUnit
Constants ¶
This section is empty.
Variables ¶
var ( RetryAuth = 60 Tracing = false )
Functions ¶
func ReportLogTracerError ¶ added in v0.0.7
func ReportLogTracerError(errors ...string)
Types ¶
type Date ¶ added in v0.0.3
Date return the Correct date format for the API
func (*Date) MarshalJSON ¶ added in v0.0.3
func (*Date) UnmarshalJSON ¶ added in v0.0.3
type Insee ¶
type Insee struct {
AuthKey string
AuthSecret string
AuthToken InseeToken
Authed bool
AuthLastToken time.Time
}
Insee basic object to manage the API https://api.gouv.fr/documentation/sirene_v3
func NewInseeRefreshed ¶
NewInseeRefreshed create a refreshed token Insee stuff
func (*Insee) GetSiren ¶ added in v0.0.3
func (i *Insee) GetSiren(siren string) (resp SirenBaseResponse, err error)
GetSiren return the API response
func (*Insee) GetSirenMultiRequest ¶ added in v0.0.4
func (i *Insee) GetSirenMultiRequest(query []string) (resp SirenBaseResponses, err error)
GetSirenMultiRequest return a request with multiple parameters
func (*Insee) RefreshAuthToken ¶
RefreshAuthToken automatically refresh the auth token based on expiry time
func (*Insee) SetAuthToken ¶
SetAuthToken will set Token from given Key and Secret
func (*Insee) SirenExist ¶
SirenExist return if the siren exist
type InseeToken ¶
type InseeToken struct {
Token string `json:"access_token"`
Type string `json:"token_type"`
Scope string `json:"scope"`
Expires int `json:"expires_in"`
}
InseeToken to manage token auth response
type SirenBaseHeader ¶ added in v0.0.3
SirenBaseHeader Header structure for a Sirene API Response
type SirenBaseResponse ¶ added in v0.0.3
type SirenBaseResponse struct {
Header SirenBaseHeader `json:"header"`
LegalUnit SirenLegalUnit `json:"uniteLegale"`
}
SirenBaseResponse structure for a Sirene API Response
type SirenBaseResponses ¶ added in v0.0.4
type SirenBaseResponses struct {
Header SirenBaseHeader `json:"header"`
LegalUnit []SirenLegalUnit `json:"unitesLegales"`
}
type SirenLegalUnit ¶ added in v0.0.3
type SirenLegalUnit struct {
Siren string `json:"siren"` //: "443061841",
Status string `json:"statutDiffusionUniteLegale"` //: "O",
DateCreationUniteLegale Date `json:"dateCreationUniteLegale"` //: "2002-05-16",
Sigle null.String `json:"sigleUniteLegale"` //: null,
Sexe null.String `json:"sexeUniteLegale"` //: null,
Prenom1 null.String `json:"prenom1UniteLegale"` //: null,
Prenom2 null.String `json:"prenom2UniteLegale"` //: null,
Prenom3 null.String `json:"prenom3UniteLegale"` //: null,
Prenom4 null.String `json:"prenom4UniteLegale"` //: null,
Prenom null.String `json:"prenomUsuelUniteLegale"` //: null,
Pseudo null.String `json:"pseudonymeUniteLegale"` //: null,
IdentifiantAssociation null.String `json:"identifiantAssociationUniteLegale"` //: null,
TrancheEffective null.String `json:"trancheEffectifsUniteLegale"` //: "41",
AnneeEffectifs null.String `json:"anneeEffectifsUniteLegale"` //: "2018",
DateDernier Date `json:"dateDernierTraitementUniteLegale"` //: "2021-07-09T15:09:46",
NombrePeriodes int `json:"nombrePeriodesUniteLegale"` //: 10,
CategorieEntreprise null.String `json:"categorieEntreprise"` //: "ETI",
AnneeCategorie null.String `json:"anneeCategorieEntreprise"` //: "2018",
Periods []SirenPeriodLegalUnit `json:"periodesUniteLegale"` //:
}
SirenLegalUnit return the values of the entitie of a siren API Call
type SirenPeriodLegalUnit ¶ added in v0.0.3
type SirenPeriodLegalUnit struct {
DateFin Date `json:"dateFin"` //: null,
DateDebut Date `json:"dateDebut"` //: "2019-01-24",
EtatAdministratif string `json:"etatAdministratifUniteLegale"` //: "A",
ChangementEtatAdministratif bool `json:"changementEtatAdministratifUniteLegale"` //: false,
Nom null.String `json:"nomUniteLegale"` //: null,
ChangementNom bool `json:"changementNomUniteLegale"` //: false,
NomUsage null.String `json:"nomUsageUniteLegale"` //: null,
ChangementNomUsage bool `json:"changementNomUsageUniteLegale"` //: false,
Denomination string `json:"denominationUniteLegale"` //: "GOOGLE FRANCE",
ChangementDenomination bool `json:"changementDenominationUniteLegale"` //: false,
DenominationUsuelle1 null.String `json:"denominationUsuelle1UniteLegale"` //: null,
DenominationUsuelle2 null.String `json:"denominationUsuelle2UniteLegale"` //: null,
DenominationUsuelle3 null.String `json:"denominationUsuelle3UniteLegale"` //: null,
ChangementDenominationUsuelle bool `json:"changementDenominationUsuelleUniteLegale"` //: false,
CategorieJuridique null.String `json:"categorieJuridiqueUniteLegale"` //: "5499",
ChangementCategorieJuridique bool `json:"changementCategorieJuridiqueUniteLegale"` //: false,
ActivitePrincipale null.String `json:"activitePrincipaleUniteLegale"` //: "70.10Z",
NomenclatureActivitePrincipale null.String `json:"nomenclatureActivitePrincipaleUniteLegale"` //: "NAFRev2",
ChangementActivitePrincipale bool `json:"changementActivitePrincipaleUniteLegale"` //: false,
NicSiege null.String `json:"nicSiegeUniteLegale"` //: "00047",
ChangementNicSiege bool `json:"changementNicSiegeUniteLegale"` //: false,
EconomieSocialeSolidaire null.String `json:"economieSocialeSolidaireUniteLegale"` //: "N",
ChangementEconomieSocialeSolidaire bool `json:"changementEconomieSocialeSolidaireUniteLegale"` //: true,
CaractereEmployeur null.String `json:"caractereEmployeurUniteLegale"` //: "O",
ChangementCaractereEmployeur bool `json:"changementCaractereEmployeurUniteLegale"` //: false
}
SirenPeriodLegalUnit return each periods data from the API