Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for new_user event #136

Merged
merged 1 commit into from
Aug 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## ToBeReleased

* Add support (again) for the new SCM events [#135](https://github.com/Scalingo/go-scalingo/pull/135)
* Add support for the new user event [#136](https://github.com/Scalingo/go-scalingo/pull/136)

## v3.0.2

Expand Down
3 changes: 3 additions & 0 deletions events_boilerplate.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package scalingo

func (e *EventNewUserType) TypeDataPtr() interface{} {
return &e.TypeData
}
func (e *EventNewAppType) TypeDataPtr() interface{} {
return &e.TypeData
}
Expand Down
15 changes: 15 additions & 0 deletions events_structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ type EventUser struct {
type EventTypeName string

const (
EventNewUser EventTypeName = "new_user"
EventNewApp EventTypeName = "new_app"
EventEditApp EventTypeName = "edit_app"
EventDeleteApp EventTypeName = "delete_app"
Expand Down Expand Up @@ -117,6 +118,18 @@ const (
EventUnlinkGithub EventTypeName = "unlink_github"
)

type EventNewUserType struct {
Event
TypeData EventNewUserTypeData `json:"type_data"`
}

func (ev *EventNewUserType) String() string {
return fmt.Sprintf("You joined Scalingo. Hooray!")
}

type EventNewUserTypeData struct {
}

type EventNewAppType struct {
Event
TypeData EventNewAppTypeData `json:"type_data"`
Expand Down Expand Up @@ -851,6 +864,8 @@ func (pev *Event) Specialize() DetailedEvent {
var e DetailedEvent
ev := *pev
switch ev.Type {
case EventNewUser:
e = &EventNewUserType{Event: ev}
case EventNewApp:
e = &EventNewAppType{Event: ev}
case EventEditApp:
Expand Down