Documentation ¶
Index ¶
- func NewDateRange(start string, end string) *dateRange
- type Contact
- type DigitialHumani
- func (digitalhumani *DigitialHumani) GetAllProjects(ctx context.Context) ([]Project, error)
- func (digitalhumani *DigitialHumani) GetEnterprise(ctx context.Context) (*Enterprise, error)
- func (digitalhumani *DigitialHumani) GetEnterpriseMonthTreeCount(ctx context.Context, month string) (*EnterpriseTreeCount, error)
- func (digitalhumani *DigitialHumani) GetEnterpriseTreeCount(ctx context.Context, dateRange *dateRange) (*EnterpriseTreeCount, error)
- func (digitalhumani *DigitialHumani) GetProject(ctx context.Context, id string) (*ProjectDetailed, error)
- func (digitalhumani *DigitialHumani) GetTree(ctx context.Context, uuid string) (*PlantTreeRequest, error)
- func (digitalhumani *DigitialHumani) GetTreeCount(ctx context.Context, userID string) (*UserTreeCount, error)
- func (digitalhumani *DigitialHumani) PlantTree(ctx context.Context, projectID string, userID string, treeCount int) (*PlantTreeRequest, error)
- type Enterprise
- type EnterpriseTreeCount
- type PlantTreeRequest
- type Project
- type ProjectDetailed
- type UserTreeCount
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDateRange ¶
NewDateRange returns a struct holding a start and a end date. Useful for the GetEnterpriseTreeCount method.
Types ¶
type Contact ¶
type Contact struct {
Name string `json:"name"`
}
Contact represents the contact name for an enterprise.
type DigitialHumani ¶
DigitialHumani represents the DigitialHumani Client for interacting with the API.
func New ¶
func New(apiKey string, enterpriseID string, env string) *DigitialHumani
New returns a DigitalHumani client, with a default http client.
func (*DigitialHumani) GetAllProjects ¶
func (digitalhumani *DigitialHumani) GetAllProjects(ctx context.Context) ([]Project, error)
GetAllProjects method retrieves all the reforestation projects available.
func (*DigitialHumani) GetEnterprise ¶
func (digitalhumani *DigitialHumani) GetEnterprise(ctx context.Context) (*Enterprise, error)
GetEnterprise method allows you to retrieve the details of your enterprise.
func (*DigitialHumani) GetEnterpriseMonthTreeCount ¶
func (digitalhumani *DigitialHumani) GetEnterpriseMonthTreeCount(ctx context.Context, month string) (*EnterpriseTreeCount, error)
GetEnterpriseMonthTreeCount method allows you to retrieve the number of trees planted by an enterprise for a specific month.
func (*DigitialHumani) GetEnterpriseTreeCount ¶
func (digitalhumani *DigitialHumani) GetEnterpriseTreeCount(ctx context.Context, dateRange *dateRange) (*EnterpriseTreeCount, error)
GetEnterpriseTreeCount method allows you to retrieve the number of trees planted by an enterprise for any range of date.
func (*DigitialHumani) GetProject ¶
func (digitalhumani *DigitialHumani) GetProject(ctx context.Context, id string) (*ProjectDetailed, error)
GetProject method allows you to retrieve the details of a single reforestation project. Example of an id: 93333333 (Project Ids are 8 digits long).
func (*DigitialHumani) GetTree ¶
func (digitalhumani *DigitialHumani) GetTree(ctx context.Context, uuid string) (*PlantTreeRequest, error)
GetTree method allows you to retrieve the details of a single request to plant trees.
func (*DigitialHumani) GetTreeCount ¶
func (digitalhumani *DigitialHumani) GetTreeCount(ctx context.Context, userID string) (*UserTreeCount, error)
GetTreeCount method allows you to retrieve the number of trees planted by a specific user.
func (*DigitialHumani) PlantTree ¶
func (digitalhumani *DigitialHumani) PlantTree(ctx context.Context, projectID string, userID string, treeCount int) (*PlantTreeRequest, error)
PlantTree method sends the request to plant one or many trees.
type Enterprise ¶
type Enterprise struct { Created string `json:"created"` Updated string `json:"updated"` ID string `json:"id"` Name string `json:"name"` Contact Contact `json:"Contact"` }
Enterprise represents the details of DigitalHumani enterprise.
type EnterpriseTreeCount ¶
type EnterpriseTreeCount struct {
Count int `json:"count"`
}
EnterpriseTreeCount represents the number trees planted by an enterprise.
type PlantTreeRequest ¶
type PlantTreeRequest struct { UUID string `json:"uuid"` Created string `json:"created"` TreeCount int `json:"treeCount"` EnterpriseID string `json:"enterpriseId"` ProjectID string `json:"projectId"` User string `json:"user"` }
PlantTreeRequest represents a single tree planting request to the DigitalHumani Api.
type Project ¶
type Project struct { ID string `json:"id"` Name string `json:"name"` ReforestationProjectDescriptionEn string `json:"reforestationProjectDescription_en"` ReforestationProjectStateEn string `json:"reforestationProjectState_en"` ReforestationProjectCountryEn string `json:"reforestationProjectCountry_en"` ReforestationProjectWebsiteEn string `json:"reforestationProjectWebsite_en"` ReforestationCompanyNameEn string `json:"reforestationCompanyName_en"` }
Project represents reforestation project with a reduced number of attributes. For more information on a given project, User GetProject method.
type ProjectDetailed ¶
type ProjectDetailed struct { Created string `json:"created"` Updated string `json:"updated"` ID string `json:"id"` Name string `json:"name"` Description string `json:"description"` ReforestationCompanyNameEn string `json:"reforestationCompanyName_en"` ReforestationCompanyNameFr string `json:"reforestationCompanyName_fr"` ReforestationCompanyAddressEn string `json:"reforestationCompanyAddress_en"` ReforestationCompanyAddressFr string `json:"reforestationCompanyAddress_fr"` ReforestationCompanyWebsiteEn string `json:"reforestationCompanyWebsite_en"` ReforestationCompanyWebsiteFr string `json:"reforestationCompanyWebsite_fr"` ReforestationProjectCountryEn string `json:"reforestationProjectCountry_en"` ReforestationProjectCountryFr string `json:"reforestationProjectCountry_fr"` ReforestationProjectDescriptionEn string `json:"reforestationProjectDescription_en"` ReforestationProjectDescriptionFr string `json:"reforestationProjectDescription_fr"` ReforestationProjectImageURLEn string `json:"reforestationProjectImageURL_en"` ReforestationProjectImageURLFr string `json:"reforestationProjectImageURL_fr"` ReforestationProjectStateEn string `json:"reforestationProjectState_en"` ReforestationProjectStateFr string `json:"reforestationProjectState_fr"` ReforestationProjectWebsiteEn string `json:"reforestationProjectWebsite_en"` ReforestationProjectWebsiteFr string `json:"reforestationProjectWebsite_fr"` }
ProjectDetailed represents a detailed view of a DigitalHumani reforestation projects.
type UserTreeCount ¶
type UserTreeCount struct { EnterpriseID string `json:"enterpriseId"` User string `json:"user"` Count int `json:"count"` }
UserTreeCount represents the number of trees planted by a user within in a given enterprise.