blob: 7a7b1ec82d71427ecb06ee1a9639facd1cdeada7 [file] [log] [blame]
Adrià Vilanova Martínezf19ea432024-01-23 20:20:52 +01001# Copyright 2016 The Chromium Authors
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
Copybara854996b2021-09-07 19:36:02 +00004
5# This file implements a pRPC API for Monorail.
6#
7# See the pRPC spec here: https://godoc.org/github.com/luci/luci-go/grpc/prpc
8#
9# Each Servicer corresponds to a service defined in a .proto file in this
10# directory. Each method on that Servicer corresponds to one of the rpcs
11# defined on the service.
12#
13# All APIs are served under the /prpc/* path space. Each service gets its own
14# namespace under that, and each method is an individual endpoints. For example,
15# POST https://bugs.chromium.org/prpc/monorail.Users/GetUser
16# would be a call to the api.users_servicer.UsersServicer.GetUser method.
17#
18# Note that this is not a RESTful API, although it is CRUDy. All requests are
19# POSTs, all methods take exactly one input, and all methods return exactly
20# one output.
21#
22# TODO(http://crbug.com/monorail/1703): Actually integrate the rpcexplorer.
23# You can use the API Explorer here: https://bugs.chromium.org/rpcexplorer
24
25from __future__ import print_function
26from __future__ import division
27from __future__ import absolute_import
28
29from api import features_servicer
30from api import issues_servicer
31from api import projects_servicer
32from api import sitewide_servicer
33from api import users_servicer
34
35
36def RegisterApiHandlers(prpc_server, services):
37 """Registers pRPC API services. And makes their routes
38 available in prpc_server.get_routes().
39 """
40
41 prpc_server.add_service(features_servicer.FeaturesServicer(services))
42 prpc_server.add_service(issues_servicer.IssuesServicer(services))
43 prpc_server.add_service(projects_servicer.ProjectsServicer(services))
44 prpc_server.add_service(sitewide_servicer.SitewideServicer(services))
45 prpc_server.add_service(users_servicer.UsersServicer(services))