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

Function GetPushRulesByScope

clientapi/routing/pushrules.go:44–57  ·  view source on GitHub ↗
(ctx context.Context, scope string, device *userapi.Device, userAPI userapi.ClientUserAPI)

Source from the content-addressed store, hash-verified

42}
43
44func GetPushRulesByScope(ctx context.Context, scope string, device *userapi.Device, userAPI userapi.ClientUserAPI) util.JSONResponse {
45 ruleSets, err := queryPushRules(ctx, device.UserID, userAPI)
46 if err != nil {
47 return errorResponse(ctx, err, "queryPushRulesJSON failed")
48 }
49 ruleSet := pushRuleSetByScope(ruleSets, pushrules.Scope(scope))
50 if ruleSet == nil {
51 return errorResponse(ctx, jsonerror.InvalidArgumentValue("invalid push rule set"), "pushRuleSetByScope failed")
52 }
53 return util.JSONResponse{
54 Code: http.StatusOK,
55 JSON: ruleSet,
56 }
57}
58
59func GetPushRulesByKind(ctx context.Context, scope, kind string, device *userapi.Device, userAPI userapi.ClientUserAPI) util.JSONResponse {
60 ruleSets, err := queryPushRules(ctx, device.UserID, userAPI)

Callers 1

SetupFunction · 0.85

Calls 3

queryPushRulesFunction · 0.85
errorResponseFunction · 0.85
pushRuleSetByScopeFunction · 0.85

Tested by

no test coverage detected