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