1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# Copyright 2010 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""All the interfaces that are exposed through the webservice.
There is a declaration in ZCML somewhere that looks like:
<webservice:register module="lp.answers.interfaces.webservice" />
which tells `lazr.restful` that it should look for webservice exports here.
"""
__all__ = [
'IQuestion',
'IQuestionSet',
'IQuestionSubscription',
]
from lazr.restful.declarations import LAZR_WEBSERVICE_EXPORTED
from lp.answers.interfaces.question import IQuestion
from lp.answers.interfaces.questioncollection import (
IQuestionSet,
ISearchableByQuestionOwner,
)
from lp.answers.interfaces.questionmessage import IQuestionMessage
from lp.answers.interfaces.questionsperson import IQuestionsPerson
from lp.answers.interfaces.questionsubscription import IQuestionSubscription
from lp.answers.interfaces.questiontarget import IQuestionTarget
from lp.services.webservice.apihelpers import (
patch_collection_return_type,
patch_entry_return_type,
patch_reference_property,
)
IQuestionSet.queryTaggedValue(
LAZR_WEBSERVICE_EXPORTED)['collection_entry_schema'] = IQuestion
patch_entry_return_type(IQuestionSet, 'get', IQuestion)
patch_collection_return_type(
IQuestionTarget, 'findSimilarQuestions', IQuestion)
patch_collection_return_type(
ISearchableByQuestionOwner, 'searchQuestions', IQuestion)
patch_reference_property(IQuestionMessage, 'question', IQuestion)
patch_reference_property(IQuestionSubscription, 'question', IQuestion)
patch_collection_return_type(
IQuestionsPerson, 'getDirectAnswerQuestionTargets', IQuestionTarget)
patch_collection_return_type(
IQuestionsPerson, 'getTeamAnswerQuestionTargets', IQuestionTarget)
patch_collection_return_type(
IQuestionsPerson, 'searchQuestions', IQuestion)
|