server

package
v0.0.0-...-42c6bbb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2020 License: GPL-2.0, GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NazcaURL = "https://nazcaapiprod.howoco.com/handlers/countrystakeholders.ashx?countryid="

Functions

func AddAsset

func AddAsset()

URL parameters: N/A Response body (all strings): - name - companyID (not required) - location - type

func AddPledge

func AddPledge()

func CheckGetAuth

func CheckGetAuth(w http.ResponseWriter, r *http.Request) (database.User, error)

func CheckPostAdmin

func CheckPostAdmin(w http.ResponseWriter, r *http.Request) (database.User, error)

func CheckPostAuth

func CheckPostAuth(w http.ResponseWriter, r *http.Request) (database.User, error)

func CommitPledge

func CommitPledge()

func RetrieveAllFromIpfs

func RetrieveAllFromIpfs()

Retrieve all data related to a given actor that has been committed to IPFS. This includes both emissions, mitigation, and adaptation data.

func RetrieveFromIpfs

func RetrieveFromIpfs()

Request & retrieve data for a specific actor that has been committed to IPFS. HTTP request to our API will provide the actor type and actor id; then RetrieveFromIpfs() will look at the smart contract to retrieve all IPFS hashes related to that type/ID pair. It then queries IPFS for that data using the hashes and then makes that data available on the openclimate API.

URL parameters:

  • "report_type": the type of climate action data that was reported. can be either emissions, mitigation, or adaptation.
  • "actor_type": either city, country, region, state, company, etc.
  • "actor_id": the ID assigned to the actor in the database.

func StartServer

func StartServer(portx int, insecure bool)

func UpdateAsset

func UpdateAsset()

URL parameters: - Asset ID

Response body data (all strings): - companyID (not necessary) - name - location - type

func UpdateMRV

func UpdateMRV()

func UpdatePledge

func UpdatePledge()

func VerifyUser

func VerifyUser()

Function allows admins of a particular entity to "verify" other users who claim to be part of the same entity.

URL parameters: - "candidate_id": the ID of the user who is being considered for verification

func ViewCompanyEarth

func ViewCompanyEarth()

func WorldBankMonthlyTempByCountry

func WorldBankMonthlyTempByCountry(iso3 string, startdate string, enddate string) (interface{}, error)

Types

type CarbonDataFinal

type CarbonDataFinal struct {
	FossilFuelAndIndustry  float64 `json:"Fossil-Fuel-And-Industry"`
	LandUseChangeEmissions float64 `json:"Land-Use-Change-Emissions"`
	AtmosphericGrowth      float64 `json:"Atmospheric-Growth"`
	OceanSink              float64 `json:"Ocean-Sink"`
	LandSink               float64 `json:"Land-Sink"`
	BudgetImbalance        float64 `json:"Budget-Imbalance"`
}

type CarbonDataPrelim

type CarbonDataPrelim struct {
	Year                   int     `json:"Year"`
	FossilFuelAndIndustry  float64 `json:"Fossil-Fuel-And-Industry"`
	LandUseChangeEmissions float64 `json:"Land-Use-Change-Emissions"`
	AtmosphericGrowth      float64 `json:"Atmospheric-Growth"`
	OceanSink              float64 `json:"Ocean-Sink"`
	LandSink               float64 `json:"Land-Sink"`
	BudgetImbalance        float64 `json:"Budget-Imbalance"`
}

type CountriesEmissionsFinal

type CountriesEmissionsFinal struct {
	Year       int
	Total      int
	SolidFuel  float64
	LiquidFuel float64
	GasFuel    float64
	Cement     int
	GasFlaring float64
	PerCapita  float64
	Bunkers    int
}

type CountriesEmissionsPrelim

type CountriesEmissionsPrelim struct {
	Nation     string
	Year       int
	Total      int
	SolidFuel  float64
	LiquidFuel float64
	GasFuel    float64
	Cement     int
	GasFlaring float64
	PerCapita  float64
	Bunkers    int
}

type CountryIdResponse

type CountryIdResponse struct {
	CountryIds map[int]string
}

type EarthStatusReturn

type EarthStatusReturn struct {
	Warminginc               string `json:"warming_in_c"`
	Gtco2left                string `json:"gt_co2_left"`
	Atmosphericco2ppm        string `json:"atmospheric_co2_ppm"`
	Annualglobalemission     string `json:"annual_global_emission"`
	Estimatedbudgetdepletion string `json:"estimated_budget_depletion"`
}

type GetAccessTokenData

type GetAccessTokenData struct {
	Data []getAccessTokenDataHelper `json:"data"`
}

type GetAssetStruct

type GetAssetStruct struct {
	Data []gA2 `json:"data"`
}

type GetEnergyAttributionData

type GetEnergyAttributionData struct {
	Data []getEnergyAttributionHelper `json:"data"`
}

type GetEnergyStruct

type GetEnergyStruct struct {
	Data []getEnergyHelper `json:"data"`
}

type GetSwytchUserStruct

type GetSwytchUserStruct struct {
	Data []getSwytchUserStructHelper `json:"data"`
}

type NationState

type NationState struct {
	Name        string
	Pledges     []database.Pledge
	Subnational []Subnational
}

type NazcaResponse

type NazcaResponse struct {
	EntityID       string `json:"entityID"`
	EntityName     string `json:"entityName"`
	CountryName    string `json:"countryName"`
	EntityTypeName string `json:"entityTypeName"`
	Actions        []struct {
		ActionType  string `json:"actionType"`
		Name        string `json:"name"`
		Description string `json:"description"`
		Adhoc       string `json:"adhoc"`
	}
}

type OceanDataFinal

type OceanDataFinal struct {
	OceanSink         float64 `json:"Ocean-Sink"`
	CCSMBEC           float64 `json:"CCSM-BEC"`
	MITgcmREcoM2      float64 `json:"MITgcm-REcoM2"`
	MPIOMHAMOCC       float64 `json:"MPIOM-HAMOCC"`
	NEMO36PISCESv2gas float64 `json:"NEMO3.6-PISCESv2-gas (CNRM)"`
	NEMOPISCESIPSL    float64 `json:"NEMO-PISCES (IPSL)"`
	NEMOPlankTOM5     float64 `json:"NEMO-PlankTOM5"`
	NorESMOC          float64 `json:"NorESM-OC"`
	Landschutzer      float64 `json:"Landschützer"`
	Rodenbeck         float64 `json:"Rödenbeck"`
}

type OceanDataPrelim

type OceanDataPrelim struct {
	Year              int     `json:"year"`
	OceanSink         float64 `json:"Ocean-Sink"`
	CCSMBEC           float64 `json:"CCSM-BEC"`
	MITgcmREcoM2      float64 `json:"MITgcm-REcoM2"`
	MPIOMHAMOCC       float64 `json:"MPIOM-HAMOCC"`
	NEMO36PISCESv2gas float64 `json:"NEMO3.6-PISCESv2-gas (CNRM)"`
	NEMOPISCESIPSL    float64 `json:"NEMO-PISCES (IPSL)"`
	NEMOPlankTOM5     float64 `json:"NEMO-PlankTOM5"`
	NorESMOC          float64 `json:"NorESM-OC"`
	Landschutzer      float64 `json:"Landschützer"`
	Rodenbeck         float64 `json:"Rödenbeck"`
}

type ParisAgreementReturn

type ParisAgreementReturn struct {
	Code         string  `json:"Code"`
	Name         string  `json:"Name"`
	Signature    string  `json:"Signature"`
	Ratification string  `json:"Ratification"`
	Kind         string  `json:"Kind"`
	DateOfEffect string  `json:"Date-Of-Effect"`
	Emissions    float64 `json:"Emissions"`
	Percentage   float64 `json:"Percentage"`
	Year         float64 `json:"Year"`
}

type ParisAgreementReturnFinal

type ParisAgreementReturnFinal struct {
	Name         string  `json:"Name"`
	Signature    string  `json:"Signature"`
	Ratification string  `json:"Ratification"`
	Kind         string  `json:"Kind"`
	DateOfEffect string  `json:"Date-Of-Effect"`
	Emissions    float64 `json:"Emissions"`
	Percentage   float64 `json:"Percentage"`
	Year         float64 `json:"Year"`
}

type PostLoginResponse

type PostLoginResponse struct {
	Token string
}

type ReportIpcc

type ReportIpcc struct {
}

type Subnational

type Subnational struct {
	Name    string
	Pledges []database.Pledge
	Assets  []database.Asset
}

type USStateCountiesReturn

type USStateCountiesReturn struct {
	Counties map[string][]string
}

type USStatesReturn

type USStatesReturn struct {
	States []string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL