Add the carbon api (#351)

This commit is contained in:
Asim Aslam
2022-01-07 11:55:41 +00:00
committed by GitHub
parent a093abaf5e
commit f505d4b857
15 changed files with 650 additions and 2 deletions

32
carbon/proto/carbon.proto Normal file
View File

@@ -0,0 +1,32 @@
syntax = "proto3";
package carbon;
option go_package = "./proto;carbon";
service Carbon {
rpc Offset(OffsetRequest) returns (OffsetResponse) {}
}
message Project {
// name of the project
string name = 1;
// percentage that went to this
double percentage = 2;
// amount in tonnes
double tonnes = 3;
}
// Purchase 1kg (0.001 tonnes) of carbon offsets in a single request
message OffsetRequest {}
message OffsetResponse {
// number of units purchased
int32 units = 1;
// the metric used e.g KG or Tonnes
string metric = 2;
// number of tonnes
double tonnes = 3;
// projects it was allocated to
repeated Project projects = 4;
}