Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PyOTRS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Coopdevs
Som Connexió
OTRS
PyOTRS
Commits
9d44a47a
Commit
9d44a47a
authored
8 years ago
by
Robert Habermann
Browse files
Options
Downloads
Patches
Plain Diff
update FAQ implementation
parent
b6127b09
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pyotrs/lib.py
+70
-7
70 additions, 7 deletions
pyotrs/lib.py
with
70 additions
and
7 deletions
pyotrs/lib.py
+
70
−
7
View file @
9d44a47a
...
...
@@ -1424,7 +1424,7 @@ class Client(object):
if
not
self
.
session_id_store
.
value
:
raise
SessionNotCreated
(
"
Call session_create() or
"
"
session_restore_or_set_up_new() first
"
)
self
.
operation
=
"
PublicCategoryList
"
self
.
operation
=
"
PublicCategoryList
"
payload
=
{
"
SessionID
"
:
self
.
session_id_store
.
value
...
...
@@ -1435,7 +1435,14 @@ class Client(object):
return
self
.
result
def
faq_public_faq_get
(
self
,
item_ids
=
None
,
attachment_contents
=
True
):
"""
faq_public_category_list
"""
"""
faq_public_category_list
Args:
item_ids (list): list of item IDs
attachment_contents (bool): whether to retrieve content of FAQ attachments
"""
if
not
self
.
session_id_store
.
value
:
raise
SessionNotCreated
(
"
Call session_create() or
"
"
session_restore_or_set_up_new() first
"
)
...
...
@@ -1457,20 +1464,65 @@ class Client(object):
if
not
attachment_contents
:
payload
.
update
({
"
GetAttachmentContents
"
:
0
})
return
self
.
_parse_and_validate_response
(
self
.
_send_request
(
payload
))
if
self
.
_parse_and_validate_response
(
self
.
_send_request
(
payload
)):
return
self
.
result
def
faq_public_faq_search
(
self
,
what
=
None
,
number
=
None
,
title
=
None
,
search_dict
=
None
):
"""
faq_public_category_list
Args:
what (str):
number (str):
title (str):
search_dict (dict):
Returns:
**list**: of found FAQ item IDs
# Original documentation:
# perform PublicFAQSearch Operation. This will return a list of public FAQ entries.
# Number = >
'
*134*
'
, # (optional)
# Title = >
'
*some title*
'
, # (optional)
#
# # is searching in Number, Title, Keyword and Field1-6
# What = >
'
*some text*
'
, # (optional)
#
# Keyword = >
'
*webserver*
'
, # (optional)
# LanguageIDs = > [4, 5, 6], # (optional)
# CategoryIDs = > [7, 8, 9], # (optional)
"""
def
faq_public_faq_search
(
self
):
"""
faq_public_category_list
"""
if
not
self
.
session_id_store
.
value
:
raise
SessionNotCreated
(
"
Call session_create() or
"
"
session_restore_or_set_up_new() first
"
)
self
.
operation
=
"
PublicFAQSearch
"
payload
=
{
"
SessionID
"
:
self
.
session_id_store
.
value
"
SessionID
"
:
self
.
session_id_store
.
value
,
}
return
self
.
_parse_and_validate_response
(
self
.
_send_request
(
payload
))
if
what
:
payload
.
update
({
"
What
"
:
what
})
if
number
:
payload
.
update
({
"
Number
"
:
number
})
if
title
:
payload
.
update
({
"
Title
"
:
title
})
if
search_dict
:
if
not
isinstance
(
search_dict
,
dict
):
raise
ArgumentInvalidError
(
"
Expecting dict for search_dict!
"
)
payload
.
update
(
search_dict
)
if
self
.
_parse_and_validate_response
(
self
.
_send_request
(
payload
)):
if
not
self
.
result
:
return
[]
elif
len
(
self
.
result
)
==
1
:
return
[
self
.
result
]
else
:
return
self
.
result
"""
GenericInterface::Operation::Link::LinkAdd
...
...
@@ -1882,6 +1934,17 @@ class Client(object):
self
.
result
=
_link_list
return
True
# PublicFAQSearch result can be empty
if
self
.
operation
in
"
PublicFAQSearch
"
:
_public_faq_search_result_list
=
self
.
result_json
.
get
(
self
.
_result_type
,
None
)
if
not
_public_faq_search_result_list
:
if
self
.
result_json
[
"
Error
"
][
"
ErrorCode
"
]
==
"
PublicFAQSearch.NotFAQData
"
:
self
.
result
=
[]
return
True
else
:
self
.
result
=
_public_faq_search_result_list
return
True
# now handle other operations
if
self
.
result_json
.
get
(
self
.
_result_type
,
None
):
self
.
_result_error
=
False
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment