MCPcopy Create free account
hub / github.com/daodst/chat / InsertRelationInvite

Function InsertRelationInvite

clientapi/routing/profile.go:66–91  ·  view source on GitHub ↗

InsertRelationInvite implements POST /local/insert/relationInvite

(
	req *http.Request, profileAPI userapi.ClientUserAPI,
)

Source from the content-addressed store, hash-verified

64
65// InsertRelationInvite implements POST /local/insert/relationInvite
66func InsertRelationInvite(
67 req *http.Request, profileAPI userapi.ClientUserAPI,
68) util.JSONResponse {
69 var r types.RelationInvite
70 if resErr := httputil.UnmarshalJSONRequest(req, &r); resErr != nil {
71 return *resErr
72 }
73 if r.Inviter == "" || r.Invitee == "" {
74 return util.JSONResponse{
75 Code: http.StatusBadRequest,
76 JSON: jsonerror.BadJSON("'inviter' and 'invitee' must be supplied."),
77 }
78 }
79 // TODO ,
80 err := profileAPI.InsertRelationInvite(req.Context(), r.Inviter, r.Invitee, r.PresentFee)
81 if err != nil {
82 return util.JSONResponse{
83 Code: http.StatusBadRequest,
84 JSON: jsonerror.BadJSON("InsertRelationInvite err."),
85 }
86 }
87 return util.JSONResponse{
88 Code: http.StatusOK,
89 JSON: struct{}{},
90 }
91}
92
93// InsertAddressBook implements POST /local/insert/addressBook
94func InsertAddressBook(

Callers 1

SetupFunction · 0.85

Calls 2

ContextMethod · 0.80
InsertRelationInviteMethod · 0.65

Tested by

no test coverage detected