feat: refactor project structure and decoding process

- Add a new function `GetRrojectResponse` to cast project into structure
- Use `mapstructure.Decode` to decode values into the `Project` structure

Signed-off-by: appleboy <appleboy.tw@gmail.com>
This commit is contained in:
appleboy 2023-12-16 16:03:35 +08:00
parent 6e30c5760c
commit 3d99df2520
No known key found for this signature in database

View File

@ -602,6 +602,13 @@ func GetRepositoriesResponse(r *APIResponse) ([]Repository, error) {
return m, err
}
// GetRepositoryResponse cast project into structure
func GetRrojectResponse(r *APIResponse) (Project, error) {
var m Project
err := mapstructure.Decode(r.Values, &m)
return m, err
}
// GetRepositoryResponse cast Repositories into structure
func GetRepositoryResponse(r *APIResponse) (Repository, error) {
var m Repository