capture user creation, update

pull/17/head v1.0.7
Brad Rydzewski 5 years ago
parent 8488de5295
commit a5005d5150

@ -2,5 +2,7 @@
"Login": "octocat",
"Name": "monalisa octocat",
"Email": "octocat@github.com",
"Avatar": "https://github.com/images/error/octocat_happy.gif"
"Avatar": "https://github.com/images/error/octocat_happy.gif",
"Created": "2008-01-14T04:33:35Z",
"Updated": "2008-01-14T04:33:35Z"
}

@ -7,6 +7,7 @@ package github
import (
"context"
"fmt"
"time"
"github.com/drone/go-scm/scm"
"github.com/drone/go-scm/scm/driver/internal/null"
@ -35,18 +36,22 @@ func (s *userService) FindEmail(ctx context.Context) (string, *scm.Response, err
}
type user struct {
ID int `json:"id"`
Login string `json:"login"`
Name string `json:"name"`
Email null.String `json:"email"`
Avatar string `json:"avatar_url"`
ID int `json:"id"`
Login string `json:"login"`
Name string `json:"name"`
Email null.String `json:"email"`
Avatar string `json:"avatar_url"`
Created time.Time `json:"created_at"`
Updated time.Time `json:"updated_at"`
}
func convertUser(from *user) *scm.User {
return &scm.User{
Avatar: from.Avatar,
Email: from.Email.String,
Login: from.Login,
Name: from.Name,
Avatar: from.Avatar,
Email: from.Email.String,
Login: from.Login,
Name: from.Name,
Created: from.Created,
Updated: from.Updated,
}
}

@ -4,15 +4,20 @@
package scm
import "context"
import (
"context"
"time"
)
type (
// User represents a user account.
User struct {
Login string
Name string
Email string
Avatar string
Login string
Name string
Email string
Avatar string
Created time.Time
Updated time.Time
}
// UserService provides access to user account resources.

Loading…
Cancel
Save