Skip to content

Commit

Permalink
GetName on struct
Browse files Browse the repository at this point in the history
  • Loading branch information
sdfsdhgjkbmnmxc committed Oct 5, 2020
1 parent b85e4ba commit d874493
Show file tree
Hide file tree
Showing 55 changed files with 157 additions and 47 deletions.
4 changes: 3 additions & 1 deletion client_activity.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package tdproto

func NewClientActivity(afk bool) (r ClientActivity) {
r.Name = "client.activity"
r.Name = r.GetName()
r.Params.Afk = afk
return r
}
Expand All @@ -11,6 +11,8 @@ type ClientActivity struct {
Params clientActivityParams `json:"params"`
}

func (p ClientActivity) GetName() string { return "client.activity" }

type clientActivityParams struct {
Afk bool `json:"afk"`
}
2 changes: 2 additions & 0 deletions client_call_buzz.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ type ClientCallBuzz struct {
Params clientCallBuzzParams `json:"params"`
}

func (p ClientCallBuzz) GetName() string { return "client.call.buzz" }

type clientCallBuzzParams struct {
Jid JID `json:"jid"`
Members []JID `json:"members"`
Expand Down
2 changes: 2 additions & 0 deletions client_call_buzzcancel.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ type ClientCallBuzzCancel struct {
Params clientCallBuzzCancelParams `json:"params"`
}

func (p ClientCallBuzzCancel) GetName() string { return "client.call.buzzcancel" }

type clientCallBuzzCancelParams struct {
Jid JID `json:"jid"`
}
2 changes: 2 additions & 0 deletions client_call_leave.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ type ClientCallLeave struct {
Params clientCallLeaveParams `json:"params"`
}

func (p ClientCallLeave) GetName() string { return "client.call.leave" }

type clientCallLeaveParams struct {
Jid JID `json:"jid"`
Reason string `json:"reason"`
Expand Down
2 changes: 2 additions & 0 deletions client_call_muteall.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ type ClientCallMuteAll struct {
Params clientCallMuteAllParams `json:"params"`
}

func (p ClientCallMuteAll) GetName() string { return "client.call.muteall" }

type clientCallMuteAllParams struct {
Jid JID `json:"jid"`
}
2 changes: 2 additions & 0 deletions client_call_offer.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ type ClientCallOffer struct {
Params clientCallOfferParams `json:"params"`
}

func (p ClientCallOffer) GetName() string { return "client.call.offer" }

type clientCallOfferParams struct {
Jid JID `json:"jid"`
Muted bool `json:"muted"`
Expand Down
2 changes: 2 additions & 0 deletions client_call_reject.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ type ClientCallReject struct {
Params clientCallRejectParams `json:"params"`
}

func (p ClientCallReject) GetName() string { return "client.call.reject" }

type clientCallRejectParams struct {
Jid JID `json:"jid"`
Reason string `json:"reason"`
Expand Down
2 changes: 2 additions & 0 deletions client_call_sound.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ type ClientCallSound struct {
Params clientCallSoundParams `json:"params"`
}

func (p ClientCallSound) GetName() string { return "client.call.sound" }

type clientCallSoundParams struct {
Jid JID `json:"jid"`
Muted bool `json:"muted"`
Expand Down
2 changes: 2 additions & 0 deletions client_call_trickle.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ type ClientCallTrickle struct {
Params clientCallTrickleParams `json:"params"`
}

func (p ClientCallTrickle) GetName() string { return "client.call.trickle" }

type clientCallTrickleParams struct {
Jid JID `json:"jid"`
Candidate string `json:"candidate"`
Expand Down
4 changes: 3 additions & 1 deletion client_chat_composing.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package tdproto

func NewClientChatComposing(jid JID, composing bool, draft *string) (r ClientChatComposing) {
r.Name = "client.chat.composing"
r.Name = r.GetName()
r.Params.Jid = jid
r.Params.Composing = composing
r.Params.Draft = draft
Expand All @@ -13,6 +13,8 @@ type ClientChatComposing struct {
Params clientChatComposingParams `json:"params"`
}

func (p ClientChatComposing) GetName() string { return "client.chat.composing" }

type clientChatComposingParams struct {
Jid JID `json:"jid"`
IsAudio bool `json:"is_audio,omitempty"`
Expand Down
4 changes: 3 additions & 1 deletion client_chat_lastread.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package tdproto

func NewClientChatLastread(jid JID, messageId *string) (r ClientChatLastread) {
r.Name = "client.chat.lastread"
r.Name = r.GetName()
r.ConfirmId = ConfirmId()
r.Params.Jid = jid
r.Params.LastReadMessageId = messageId
Expand All @@ -13,6 +13,8 @@ type ClientChatLastread struct {
Params clientChatLastreadParams `json:"params"`
}

func (p ClientChatLastread) GetName() string { return "client.chat.lastread" }

type clientChatLastreadParams struct {
Jid JID `json:"jid"`
LastReadMessageId *string `json:"last_read_message_id,omitempty"`
Expand Down
4 changes: 3 additions & 1 deletion client_confirm.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package tdproto

func NewClientConfirm(confirmId string) (r ClientConfirm) {
r.Name = "client.confirm"
r.Name = r.GetName()
r.Params.ConfirmId = confirmId
return r
}
Expand All @@ -11,6 +11,8 @@ type ClientConfirm struct {
Params clientConfirmParams `json:"params"`
}

func (p ClientConfirm) GetName() string { return "client.confirm" }

type clientConfirmParams struct {
ConfirmId string `json:"confirm_id"`
}
4 changes: 3 additions & 1 deletion client_message_deleted.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package tdproto

func NewClientMessageDeleted(messageId string) (r ClientMessageDeleted) {
r.Name = "client.message.deleted"
r.Name = r.GetName()
r.ConfirmId = ConfirmId()
r.Params.MessageId = messageId
return r
Expand All @@ -12,6 +12,8 @@ type ClientMessageDeleted struct {
Params clientMessageDeletedParams `json:"params"`
}

func (p ClientMessageDeleted) GetName() string { return "client.message.deleted" }

type clientMessageDeletedParams struct {
MessageId string `json:"message_id,omitempty"`
}
4 changes: 3 additions & 1 deletion client_message_updated.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package tdproto

func NewClientMessageUpdated(p ClientMessageUpdatedParams) (r ClientMessageUpdated) {
r.Name = "client.message.updated"
r.Name = r.GetName()
r.ConfirmId = ConfirmId()
r.Params = p
return r
Expand All @@ -12,6 +12,8 @@ type ClientMessageUpdated struct {
Params ClientMessageUpdatedParams `json:"params"`
}

func (p ClientMessageUpdated) GetName() string { return "client.message.updated" }

type ClientMessageUpdatedParams struct {
// chat, task or contact jid. Required.
To JID `json:"to"`
Expand Down
4 changes: 3 additions & 1 deletion client_ping.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package tdproto

func NewClientPing() (r ClientPing) {
r.Name = "client.ping"
r.Name = r.GetName()
r.ConfirmId = ConfirmId()
return r
}

type ClientPing struct {
BaseEvent
}

func (p ClientPing) GetName() string { return "client.ping" }
4 changes: 3 additions & 1 deletion server_call_answer.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package tdproto

func NewServerCallAnswer(jid JID, sdp string, onliners []CallOnliner, uid string) (r ServerCallAnswer) {
r.Name = "server.call.answer"
r.Name = r.GetName()
r.Params.Jid = jid
r.Params.JSEP.Type = "answer"
r.Params.JSEP.SDP = sdp
Expand All @@ -15,6 +15,8 @@ type ServerCallAnswer struct {
Params serverCallAnswerParams `json:"params"`
}

func (p ServerCallAnswer) GetName() string { return "server.call.answer" }

type serverCallAnswerParams struct {
Jid JID `json:"jid"`
Candidates []serverCallAnswerCandidate `json:"candidates"`
Expand Down
4 changes: 3 additions & 1 deletion server_call_buzz.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
)

func NewServerCallBuzz(teamShort TeamShort, chatShort ChatShort, actorShort ContactShort, uid string, timeout time.Duration) (r ServerCallBuzz) {
r.BaseEvent.Name = "server.call.buzz"
r.Name = r.GetName()
r.Params.TeamShort = teamShort
r.Params.ChatShort = chatShort
r.Params.ActorShort = actorShort
Expand All @@ -26,6 +26,8 @@ type ServerCallBuzz struct {
Params serverCallBuzzParams `json:"params"`
}

func (p ServerCallBuzz) GetName() string { return "server.call.buzz" }

type serverCallBuzzParams struct {
TeamShort TeamShort `json:"teaminfo"`
ChatShort ChatShort `json:"chat"`
Expand Down
4 changes: 3 additions & 1 deletion server_call_buzzcancel.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package tdproto

func NewServerCallBuzzcancel(chat *JID, teamUid string, uid string) (r ServerCallBuzzcancel) {
r.BaseEvent.Name = "server.call.buzzcancel"
r.Name = r.GetName()
r.Params.Jid = *chat
r.Params.Team = teamUid
r.Params.Uid = uid
Expand All @@ -13,6 +13,8 @@ type ServerCallBuzzcancel struct {
Params serverCallBuzzcancelParams `json:"params"`
}

func (p ServerCallBuzzcancel) GetName() string { return "server.call.buzzcancel" }

type serverCallBuzzcancelParams struct {
Jid JID `json:"jid"`
Team string `json:"team"`
Expand Down
4 changes: 3 additions & 1 deletion server_call_checkfingerprint.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package tdproto

func NewServerCallCheckFingerprint(fingerprint string) (r ServerCallCheckFingerprint) {
r.BaseEvent.Name = "server.call.checkfingerprint"
r.Name = r.GetName()
r.Params.Fingerprint = fingerprint
return r
}
Expand All @@ -11,6 +11,8 @@ type ServerCallCheckFingerprint struct {
Params serverCallCheckFingerprintParams `json:"params"`
}

func (p ServerCallCheckFingerprint) GetName() string { return "server.call.checkfingerprint" }

type serverCallCheckFingerprintParams struct {
Fingerprint string `json:"fingerprint"`
}
4 changes: 3 additions & 1 deletion server_call_leave.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package tdproto

func NewServerCallLeave(jid JID, uid string) (r ServerCallLeave) {
r.BaseEvent.Name = "server.call.leave"
r.Name = r.GetName()
r.Params.Jid = jid
r.Params.Uid = uid
return r
Expand All @@ -12,6 +12,8 @@ type ServerCallLeave struct {
Params serverCallLeaveParams `json:"params"`
}

func (p ServerCallLeave) GetName() string { return "server.call.leave" }

type serverCallLeaveParams struct {
Jid JID `json:"jid"`
Uid string `json:"uid"`
Expand Down
4 changes: 3 additions & 1 deletion server_call_muteall.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package tdproto

func NewServerCallMuteall(jid JID, muted bool, error string) (r ServerCallMuteall) {
r.BaseEvent.Name = "server.call.muteall"
r.Name = r.GetName()
r.Params.Jid = jid
r.Params.Muted = muted
r.Params.Error = error
Expand All @@ -13,6 +13,8 @@ type ServerCallMuteall struct {
Params serverCallMuteallParams `json:"params"`
}

func (p ServerCallMuteall) GetName() string { return "server.call.muteall" }

type serverCallMuteallParams struct {
Jid JID `json:"jid"`
Muted bool `json:"muted"`
Expand Down
4 changes: 3 additions & 1 deletion server_call_reject.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package tdproto

func NewServerCallReject(jid JID, reason string, uid string) (r ServerCallReject) {
r.BaseEvent.Name = "server.call.reject"
r.Name = r.GetName()
r.Params.Jid = jid
r.Params.Reason = reason
r.Params.Uid = uid
Expand All @@ -13,6 +13,8 @@ type ServerCallReject struct {
Params serverCallRejectParams `json:"params"`
}

func (p ServerCallReject) GetName() string { return "server.call.reject" }

type serverCallRejectParams struct {
Jid JID `json:"jid"`
Reason string `json:"reason"`
Expand Down
4 changes: 3 additions & 1 deletion server_call_restart.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package tdproto

func NewServerCallRestart(chat *JID, teamUid string, uid string) (r ServerCallRestart) {
r.BaseEvent.Name = "server.call.restart"
r.Name = r.GetName()
r.Params.Jid = *chat
r.Params.Team = teamUid
r.Params.Uid = uid
Expand All @@ -13,6 +13,8 @@ type ServerCallRestart struct {
Params serverCallRestartParams `json:"params"`
}

func (p ServerCallRestart) GetName() string { return "server.call.restart" }

type serverCallRestartParams struct {
Jid JID `json:"jid"`
Team string `json:"team"`
Expand Down
4 changes: 3 additions & 1 deletion server_call_sound.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package tdproto

func NewServerCallSound(jid JID, muted bool) (r ServerCallSound) {
r.BaseEvent.Name = "server.call.sound"
r.Name = r.GetName()
r.Params.Jid = jid
r.Params.Muted = muted
return r
Expand All @@ -12,6 +12,8 @@ type ServerCallSound struct {
Params serverCallSoundParams `json:"params"`
}

func (p ServerCallSound) GetName() string { return "server.call.sound" }

type serverCallSoundParams struct {
Jid JID `json:"jid"`
Muted bool `json:"muted"`
Expand Down
4 changes: 3 additions & 1 deletion server_call_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package tdproto
import "time"

func NewServerCallState(chat HasJid, startCall, finishCall *time.Time, onliners []CallOnliner, audiorecord, buzz bool, uid string, timestamp int64) (r ServerCallState) {
r.BaseEvent.Name = "server.call.state"
r.Name = r.GetName()
r.Params.Jid = *chat.JID()
r.Params.Onliners = onliners
r.Params.Buzz = buzz
Expand All @@ -29,6 +29,8 @@ type ServerCallState struct {
Params serverCallStateParams `json:"params"`
}

func (p ServerCallState) GetName() string { return "server.call.state" }

type serverCallStateParams struct {
Jid JID `json:"jid"`
Onliners []CallOnliner `json:"onliners"`
Expand Down
4 changes: 3 additions & 1 deletion server_call_talking.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package tdproto

func NewServerCallTalking(talking bool, chat, actor *JID) (r ServerCallTalking) {
r.BaseEvent.Name = "server.call.talking"
r.Name = r.GetName()
r.Params.Jid = *chat
r.Params.Actor = *actor
r.Params.Talking = talking
Expand All @@ -13,6 +13,8 @@ type ServerCallTalking struct {
Params serverCallTalkingParams `json:"params"`
}

func (p ServerCallTalking) GetName() string { return "server.call.talking" }

type serverCallTalkingParams struct {
Jid JID `json:"jid"`
Actor JID `json:"actor"`
Expand Down
Loading

0 comments on commit d874493

Please sign in to comment.