Skip to content

Commit e119b0e

Browse files
authored
Merge pull request #9 from 0xRy4n/Diablo
Help Center API , Teams API
2 parents 81445be + a5daaeb commit e119b0e

File tree

10 files changed

+1026
-0
lines changed

10 files changed

+1026
-0
lines changed

intercom_python_sdk/apis/help_center/__init__.py

Whitespace-only changes.
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
"""
2+
# Help Center API
3+
4+
`apis/help_center/api.py`
5+
6+
This module contains the HelpCenterAPI class, which defines a client for the Help Cneter API.
7+
It is used to interact with the Intercom Help Center API [1] as defined in the Intercom API Reference [2].
8+
9+
---
10+
[1] https://developers.intercom.com/intercom-api-reference/reference/help_center
11+
[2] https://github.com/intercom/Intercom-OpenAPI
12+
"""
13+
14+
# Built-ins
15+
import functools
16+
from typing import Union, cast
17+
18+
# External
19+
from uplink import (
20+
get, put, post,
21+
returns, args,
22+
error_handler, response_handler,
23+
Field, Body, json, Url, Path, Query,delete
24+
)
25+
26+
# From Current API
27+
from .schemas import (
28+
CollectionSchema,
29+
CollectionListSchema,
30+
SectionSchema,
31+
SectionListSchema,
32+
)
33+
34+
from .models import (
35+
Collection,
36+
CollectionList,
37+
38+
39+
)
40+
41+
# From Current Package
42+
from ...core.api_base import APIBase
43+
from ...core.errors import catch_api_error
44+
45+
@response_handler(catch_api_error)
46+
class HelpCenterAPI(APIBase):
47+
URI = "/help_center/"
48+
49+
@returns(CollectionSchema(many=False)) # type: ignore
50+
@get("collections/{collection_id}")
51+
def get_collection_by_id(self, collection_id: Union[str, int]):
52+
""" Get a Collection by ID.
53+
54+
Args:
55+
collection_id (Union[str, int]): The ID of the Collection.
56+
57+
Returns:
58+
Collection: The Collection with the given ID.
59+
"""
60+
61+
@returns(CollectionListSchema(many=False)) # type: ignore
62+
@get("collections")
63+
def list_all_collections(self):
64+
""" List all Collections.
65+
66+
Returns:
67+
CollectionList: A list of all Collections.
68+
"""
69+
70+
71+
@returns(SectionSchema(many=False)) # type: ignore
72+
@get("sections/{section_id}")
73+
def get_section_by_id(self, section_id: Union[str, int]):
74+
""" Get a Section by ID.
75+
76+
Args:
77+
section_id (Union[str, int]): The ID of the Section.
78+
79+
Returns:
80+
Section: The Section with the given ID.
81+
"""
82+
83+
@returns(SectionListSchema(many=False)) # type: ignore
84+
@get("sections")
85+
def list_all_sections(self):
86+
""" List all Sections.
87+
88+
Returns:
89+
SectionList: A list of all Sections.
90+
"""
91+

0 commit comments

Comments
 (0)