### Install Khoros from source Source: https://github.com/jeffshurtliff/khoros/blob/master/README.md Clone the repository and run the setup script to install the package from source. ```sh git clone git://github.com/jeffshurtliff/khoros.git cd khoros/ python setup.py install ``` -------------------------------- ### Install khoros from source Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/introduction.md Clone the repository and install the package manually from the source code. ```shell git clone git://github.com/jeffshurtliff/khoros.git cd khoros/ python3 setup.py install ``` -------------------------------- ### Example LiQL Queries for Khoros Source: https://context7.com/jeffshurtliff/khoros/llms.txt Demonstrates how to construct LiQL queries for different Khoros collections, such as messages, users, and boards. These examples show basic SELECT statements with WHERE clauses and LIMITs. ```python messages_query = "SELECT id, subject FROM messages WHERE board.id = 'forum' LIMIT 10" ``` ```python users_query = "SELECT id, login, email FROM users WHERE registration_status = 'registered' LIMIT 50" ``` ```python boards_query = "SELECT id, title, conversation_style FROM boards LIMIT 100" ``` -------------------------------- ### get(query_url, relative_url=True, return_json=True, headers=None, proxy_user_object=None) Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/core-object-methods.md Performs a simple GET request using Khoros authorization headers. ```APIDOC ## get(query_url, relative_url=True, return_json=True, headers=None, proxy_user_object=None) ### Description This method performs a simple GET request that leverages the Khoros authorization headers. ### Parameters #### Query Parameters - **query_url** (str) - The URL to query. - **relative_url** (bool) - Whether the URL is relative to the community base URL. Defaults to `True`. - **return_json** (bool) - Whether to return the response as JSON. Defaults to `True`. - **headers** (dict, None) - Optional custom headers to include in the request. - **proxy_user_object** (object, None) - An object representing a proxy user, if applicable. ### Version Changed - Changed in version 4.2.0: Resolved an issue that caused errors with absolute URLs, and made general code improvements were made to avoid unnecessary `KeyError` exceptions. ``` -------------------------------- ### Performing an API Request with Retries Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/primary-modules.md Example of executing a GET request using the built-in retry mechanism. ```python json_response = khoros.api.get_request_with_retries(url, auth_dict=khoros.auth) ``` -------------------------------- ### Get Node Type Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/core-object-methods.md Retrieves the full URL of a given Node ID. This method is available starting from version 2.1.0. ```APIDOC ## GET /api/nodes/type ### Description Returns the full URL of a given Node ID. ### Method GET ### Endpoint /api/nodes/type ### Parameters #### Query Parameters - **identifier** (str) - Required - The Node ID or Node URL with which to identify the node #### Request Body None ### Response #### Success Response (200) - **node_url** (str) - The full URL of the node #### Response Example { "node_url": "https://example.khoros.com/node/12345" } ### Errors - `khoros.errors.exceptions.GETRequestError` - `khoros.errors.exceptions.InvalidFieldError` - `khoros.errors.exceptions.InvalidStructureTypeError` - `khoros.errors.exceptions.MissingRequiredDataError` ``` -------------------------------- ### Get Node Title Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/core-object-methods.md Retrieves the full and/or short title of a node. This method is available starting from version 2.1.0. ```APIDOC ## GET /api/nodes/title ### Description Retrieves the full and/or short title of the node. ### Method GET ### Endpoint /api/nodes/title ### Parameters #### Query Parameters - **identifier** (str) - Optional - The Node ID or Node URL with which to identify the node - **full_title** (bool) - Optional - Determines if the full title of the node should be returned (True by default) - **short_title** (bool) - Optional - Determines if the short title of the node should be returned (False by default) #### Request Body None ### Response #### Success Response (200) - **title** (str or tuple) - The node title(s) as a string or a tuple of strings #### Response Example { "title": "Example Node Title" } ### Errors - `khoros.errors.exceptions.GETRequestError` - `khoros.errors.exceptions.InvalidFieldError` - `khoros.errors.exceptions.InvalidStructureTypeError` - `khoros.errors.exceptions.MissingRequiredDataError` ``` -------------------------------- ### Studio Environment Methods Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/core-object-methods.md Methods to check the installation status and versions of Node.js, npm, and the Lithium SDK. ```APIDOC ## GET Studio Environment Methods ### Description Static methods to identify installed versions and check installation status for Node.js, npm, and the Lithium SDK. ### Methods - **get_node_version()**: Returns the installed Node.js version string or None. - **get_npm_version()**: Returns the installed npm version string or None. - **get_sdk_version()**: Returns the installed Lithium SDK version string or None. - **node_installed()**: Returns a boolean indicating if Node.js is installed. - **npm_installed()**: Returns a boolean indicating if npm is installed. - **sdk_installed()**: Returns a boolean indicating if the Lithium SDK is installed. ``` -------------------------------- ### Initialize Khoros with an options dictionary Source: https://github.com/jeffshurtliff/khoros/blob/master/README.md Consolidate connection settings into a single dictionary passed to the options argument. ```python my_settings = { 'community_url': 'https://community.example.com', 'community_name': 'mycommunity', 'auth_type': 'session_auth', 'session_auth': { 'username': USERNAME, 'password': PASSWD } } ``` -------------------------------- ### Get Root Category URL Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/core-object-methods.md Retrieves the root category URL for a given node. This method is available starting from version 2.1.0. ```APIDOC ## GET /api/nodes/root_url ### Description Retrieves the root category URL of a given node. ### Method GET ### Endpoint /api/nodes/root_url ### Parameters #### Query Parameters - **identifier** (str) - Required - The Node ID or Node URL with which to identify the node #### Request Body None ### Response #### Success Response (200) - **root_url** (str) - The root category URL as a string #### Response Example { "root_url": "https://example.khoros.com/category/12345" } ### Errors - `khoros.errors.exceptions.GETRequestError` - `khoros.errors.exceptions.InvalidFieldError` - `khoros.errors.exceptions.InvalidStructureTypeError` - `khoros.errors.exceptions.MissingRequiredDataError` ``` -------------------------------- ### Instantiate Khoros Object Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/embed/instantiate-object.md Instantiate the Khoros object with a helper configuration file. This is the initial setup step required before using other Khoros functionalities. ```python >>> from khoros import Khoros >>> khoros = Khoros(helper='helper.yml') ``` -------------------------------- ### Get Root Category Type Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/core-object-methods.md Retrieves the root category type for a given node. This method is available starting from version 2.1.0. ```APIDOC ## GET /api/nodes/root_type ### Description Retrieves the root category type of a given node. ### Method GET ### Endpoint /api/nodes/root_type ### Parameters #### Query Parameters - **identifier** (str) - Required - The Node ID or Node URL with which to identify the node #### Request Body None ### Response #### Success Response (200) - **root_type** (str) - The root category type as a string #### Response Example { "root_type": "forum" } ### Errors - `khoros.errors.exceptions.GETRequestError` - `khoros.errors.exceptions.InvalidFieldError` - `khoros.errors.exceptions.InvalidStructureTypeError` - `khoros.errors.exceptions.MissingRequiredDataError` ``` -------------------------------- ### Initialize Khoros using a helper file Source: https://github.com/jeffshurtliff/khoros/blob/master/README.md Reference an external configuration file path using the helper argument during initialization. ```python HELPER_FILE = "/path/to/helper.yml" khoros = Khoros(helper=HELPER_FILE) ``` -------------------------------- ### Get Root Category ID Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/core-object-methods.md Retrieves the root category ID for a given node. This method is available starting from version 2.1.0. ```APIDOC ## GET /api/nodes/root_category_id ### Description Retrieves the root category ID of a given node. ### Method GET ### Endpoint /api/nodes/root_category_id ### Parameters #### Query Parameters - **identifier** (str) - Required - The Node ID or Node URL with which to identify the node - **include_prefix** (bool) - Optional - Defines if the prefix (e.g. `category:`) should be included (False by default) #### Request Body None ### Response #### Success Response (200) - **root_category_id** (str) - The Root Category ID as a string #### Response Example { "root_category_id": "12345" } ### Errors - `khoros.errors.exceptions.GETRequestError` - `khoros.errors.exceptions.InvalidFieldError` - `khoros.errors.exceptions.InvalidStructureTypeError` - `khoros.errors.exceptions.MissingRequiredDataError` ``` -------------------------------- ### Create Board with Description Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/boards.md Add an SEO-friendly description to a new board by providing it as the fourth argument. This example creates a 'blog' style board. ```python khoros.boards.create('upcoming-events', 'Upcoming Events', 'blog', \ 'Get the details on our upcoming events and product releases.') ``` -------------------------------- ### Get Total Node Count Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/core-object-methods.md Retrieves the total number of nodes within the Khoros Community environment. This method is available starting from version 2.1.0. ```APIDOC ## GET /api/nodes/total_count ### Description Returns the total number of nodes within the Khoros Community environment. ### Method GET ### Endpoint /api/nodes/total_count ### Parameters None ### Response #### Success Response (200) - **total_node_count** (int) - The total number of nodes as an integer #### Response Example { "total_node_count": 5000 } ### Errors - `khoros.errors.exceptions.GETRequestError` ``` -------------------------------- ### GET /get_roles_count Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/core-object-methods.md Gets the count of roles applied to the user. ```APIDOC ## GET /get_roles_count ### Description This method gets the count of roles applied to the user. ### Parameters #### Query Parameters - **user_settings** (dict) - Optional - A dictionary containing all relevant user settings supplied in the parent function - **user_id** (int/str) - Optional - The User ID associated with the user - **login** (str) - Optional - The username of the user - **email** (str) - Optional - The email address of the user ### Response #### Success Response (200) - **count** (int) - The number of roles applied to the user ``` -------------------------------- ### POST boards.create() Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/boards.md Creates a new board in the Khoros system with specified configuration parameters. ```APIDOC ## POST boards.create() ### Description Creates a new board using the khoros.boards.create() function. This function supports various board types including forums, blogs, and contests. ### Parameters #### Request Body - **board_id** (string) - Required - The board ID - **board_title** (string) - Required - The board title/name - **discussion_style** (string) - Required - The type of discussion style (e.g. blog, contest, forum, idea, qanda or tkb) - **description** (string) - Optional - The description of the board - **parent_category_id** (string) - Optional - The ID of the parent category (if applicable) - **hidden** (boolean) - Optional - Defines whether or not the new board should be hidden from lists and menus - **allowed_labels** (string) - Optional - Type of labels permitted (freeform-only, predefined-only or freeform or pre-defined) - **use_freeform_labels** (boolean) - Optional - Indicates that only freeform labels should be permitted - **use_predefined_labels** (boolean) - Optional - Indicates that only predefined labels should be permitted - **predefined_labels** (list) - Optional - The list of predefined labels that are permitted - **media_type** (string) - Optional - The media type associated with a contest (image, video or story meaning text) - **blog_authors** (list) - Optional - The approved blog authors in a blog board as a list of user data dictionaries - **blog_author_ids** (list) - Optional - A list of User IDs representing the approved blog authors in a blog board - **blog_author_logins** (list) - Optional - A list of logins (i.e. usernames) representing the approved blog authors in a blog board - **blog_comments_enabled** (boolean) - Optional - Indicates that comments should be enabled on blog posts within a blog board - **blog_moderators** (list) - Optional - The designated moderators in a blog board as a list of user data dictionaries - **blog_moderator_ids** (list) - Optional - A list of User IDs representing the blog moderators in a blog board - **blog_moderator_logins** (list) - Optional - A list of logins (i.e. usernames) representing the moderators in a blog board - **one_entry_per_contest** (boolean) - Optional - Indicates whether or not a user can only submit one entry to a single contest - **one_kudo_per_contest** (boolean) - Optional - Indicates whether or not a user can vote only once per contest - **posting_date_end** (datetime) - Optional - The date/time a contest is closed to submissions - **posting_date_start** (datetime) - Optional - The date/time when the submission period for a contest begins - **voting_date_end** (datetime) - Optional - The date/time when the voting period for a contest ends - **voting_date_start** (datetime) - Optional - The date/time when the voting period for a contest begins - **winner_announced_date** (datetime) - Optional - The date/time the contest winner will be announced - **full_response** (boolean) - Optional - Indicates whether the full, raw API response should be returned - **return_id** (boolean) - Optional - Indicates whether the Board ID should be returned - **return_url** (boolean) - Optional - Indicates whether the Board URL should be returned - **return_api_url** (boolean) - Optional - Indicates whether the API URL (i.e. URI) of the board should be returned - **return_http_code** (boolean) - Optional - Indicates whether the HTTP Code of the API response should be returned - **return_status** (boolean) - Optional - Indicates whether the status of the API response should be returned - **return_error_messages** (boolean) - Optional - Indicates whether the Developer Response Message (if any) should be returned ### Request Example ```python khoros.boards.create('my-board', 'My Board', 'forum', return_status=True) ``` ### Response #### Success Response (200) - **status** (string) - Returns 'success' if return_status is set to True ``` -------------------------------- ### Init Module (khoros) Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/core-object-methods.md Provides the entry point for initializing the Khoros core object. ```APIDOC ## Init Module (khoros) ### Description This module serves as the primary entry point for the khoros package, allowing for the initialization of the main `khoros.core.Khoros` object. ### Usage ```python from khoros import Khoros ``` ### Example ```python khoros = Khoros(community_url='https://community.example.com', helper='path/to/helper_file.yml') ``` ### Class: khoros.Khoros This is the core class for the library. #### Parameters - **defined_settings** (any) - Optional - Settings to define - **community_url** (str) - Optional - The URL of the community - **tenant_id** (str) - Optional - The tenant ID - **community_name** (str) - Optional - The name of the community - **auth_type** (str) - Optional - The authentication type - **session_auth** (any) - Optional - Session authentication details - **oauth2** (any) - Optional - OAuth2 authentication details - **sso** (any) - Optional - SSO authentication details - **helper** (str) - Optional - Path to a helper file - **env_variables** (any) - Optional - Environment variables - **auto_connect** (bool) - Optional - Automatically connect to the community (default: True) - **use_community_name** (bool) - Optional - Use community name (default: False) - **prefer_json** (bool) - Optional - Prefer JSON responses (default: True) - **debug_mode** (bool) - Optional - Enable debug mode (default: False) - **skip_env_variables** (bool) - Optional - Skip environment variables (default: False) - **empty** (bool) - Optional - Initialize with empty state (default: False) - **ssl_verify** (bool) - Optional - SSL verification setting - **bulk_data_settings** (any) - Optional - Settings for bulk data operations - **logging_level** (str) - Optional - Logging level ``` -------------------------------- ### GET /get_replies_count Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/core-object-methods.md Gets the count of replies posted by the user. ```APIDOC ## GET /get_replies_count ### Description This method gets the count of replies posted by the user. ### Parameters #### Query Parameters - **user_settings** (dict) - Optional - A dictionary containing all relevant user settings supplied in the parent function - **user_id** (int/str) - Optional - The User ID associated with the user - **login** (str) - Optional - The username of the user - **email** (str) - Optional - The email address of the user ### Response #### Success Response (200) - **count** (int) - The number of replies posted by the user ``` -------------------------------- ### GET /api/users/kudos/received/count Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/core-object-methods.md Gets the count of kudos a user has received. ```APIDOC ## GET /api/users/kudos/received/count ### Description This method gets the count of kudos a user has received. ### Method GET ### Endpoint /api/users/kudos/received/count ### Parameters #### Query Parameters - **user_settings** (dict, None) - Optional - A dictionary containing all relevant user settings supplied in the parent function - **user_id** (int, str, None) - Optional - The User ID associated with the user - **login** (str, None) - Optional - The username of the user - **email** (str, None) - Optional - The email address of the user ### Response #### Success Response (200) - **kudos_received_count** (int) - The number of kudos received by the user in integer format #### Response Example ```json { "kudos_received_count": 250 } ``` ### Error Handling - `khoros.errors.exceptions.GETRequestError` ``` -------------------------------- ### Define a YAML helper configuration file Source: https://github.com/jeffshurtliff/khoros/blob/master/README.md Example structure for a YAML configuration file containing connection, authentication, and API preferences. ```yaml # Helper configuration file for the khoros package # Define how to obtain the connection information connection: community_url: https://community.example.com/ tenant_id: example12345 # Define the default authentication type to use default_auth_type: session_auth # Define the OAuth 2.0 credentials oauth2: client_id: FLFeNYob7XXXXXXXXXXXXXXXXXXXXZcWQEQHR5T6bo= client_secret: 1n0AIXXXXXXXXXXXXXXXXXXXX1udOtNaYnfJCeOszYw= redirect_url: http://redirect.community.example.com/getAccessToken # Define the session key authorization information session_auth: username: serviceaccount password: Ch@ng3ME! # Bulk Data API connection information bulk_data: community_id: example.prod client_id: ay0CXXXXXXXXXX/XXXX+XXXXXXXXXXXXX/XXXXX4KhQ= token: 2f25XXXXXXXXXXXXXXXXXXXXXXXXXa10dec04068 europe: no # Define the preferred format for API responses prefer_json: yes ``` -------------------------------- ### GET /api/users/kudos/given/count Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/core-object-methods.md Gets the count of kudos a user has given. ```APIDOC ## GET /api/users/kudos/given/count ### Description This method gets the count of kudos a user has given. ### Method GET ### Endpoint /api/users/kudos/given/count ### Parameters #### Query Parameters - **user_settings** (dict, None) - Optional - A dictionary containing all relevant user settings supplied in the parent function - **user_id** (int, str, None) - Optional - The User ID associated with the user - **login** (str, None) - Optional - The username of the user - **email** (str, None) - Optional - The email address of the user ### Response #### Success Response (200) - **kudos_given_count** (int) - The number of kudos given by the user in integer format #### Response Example ```json { "kudos_given_count": 120 } ``` ### Error Handling - `khoros.errors.exceptions.GETRequestError` ``` -------------------------------- ### Initialize Khoros object with direct parameters Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/introduction.md Pass connection details directly into the constructor or via an options dictionary. ```python khoros = Khoros( community_url='https://community.example.com', session_auth={'username': USERNAME, 'password': PASSWD} ) ``` ```python my_settings = { 'community_url': 'https://community.example.com', 'community_name': 'mycommunity', 'auth_type': 'session_auth', 'session_auth': { 'username': USERNAME, 'password': PASSWD } } ``` -------------------------------- ### GET /api/users/videos/count Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/core-object-methods.md Gets the count of videos uploaded by a specific user. ```APIDOC ## GET /api/users/videos/count ### Description Gets the count of videos uploaded by the user. The user can be identified by their ID, login name, or email address. ### Method GET ### Endpoint /api/users/videos/count ### Parameters #### Query Parameters - **user_id** (int | str | None) - Optional - The User ID associated with the user. - **login** (str | None) - Optional - The username of the user. - **email** (str | None) - Optional - The email address of the user. ### Request Example ```json { "login": "testuser" } ``` ### Response #### Success Response (200) - **video_count** (int) - The number of videos uploaded by the user in integer format. #### Response Example ```json { "video_count": 50 } ``` ### Errors - `khoros.errors.exceptions.GETRequestError` ``` -------------------------------- ### Create Khoros Boards Source: https://context7.com/jeffshurtliff/khoros/llms.txt Use the `boards.create` method to create new boards with different configurations, such as blog author settings or label options. Ensure the `khoros_object` is properly initialized. ```python boards.create( khoros_object=khoros, board_id='company-blog', board_title='Company Blog', discussion_style='blog', blog_author_logins=['author1', 'author2'], blog_comments_enabled=True ) ``` ```python boards.create( khoros_object=khoros, board_id='ideas-board', board_title='Ideas Exchange', discussion_style='idea', use_freeform_labels=True, use_predefined_labels=True, predefined_labels=[{'text': 'Feature'}, {'text': 'Bug'}] ) ``` -------------------------------- ### Initialize Khoros Logging Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/changelog.md Initializes the Khoros logging utility. This function should be called to set up logging configurations. ```python khoros.utils.log_utils.initialize_logging() ``` -------------------------------- ### GET /api/v1 Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/core-object-methods.md Makes a Community API v1 GET request. ```APIDOC ## GET /api/v1 ### Description This method makes a Community API v1 GET request. ### Method GET ### Endpoint /api/v1 ### Parameters #### Query Parameters - **endpoint** (str) - Required - The API endpoint to request. - **query_params** (dict) - Optional - Parameters to include in the query string. - **return_json** (bool) - Optional - Determines if the API response should be returned in JSON format (`True` by default). - **proxy_user_object** (object) - Optional - An object representing the user on whose behalf the API request should be performed. ``` -------------------------------- ### GET /api/users/images/count Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/core-object-methods.md Gets the count of images uploaded by a specific user. ```APIDOC ## GET /api/users/images/count ### Description This method gets the count of images uploaded by the user. ### Method GET ### Endpoint /api/users/images/count ### Parameters #### Query Parameters - **user_settings** (dict, None) - Optional - A dictionary containing all relevant user settings supplied in the parent function - **user_id** (int, str, None) - Optional - The User ID associated with the user - **login** (str, None) - Optional - The username of the user - **email** (str, None) - Optional - The email address of the user ### Response #### Success Response (200) - **image_count** (int) - The number of images uploaded by the user in integer format #### Response Example ```json { "image_count": 50 } ``` ### Error Handling - `khoros.errors.exceptions.GETRequestError` ``` -------------------------------- ### Instantiate the Khoros object Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/messages.md Methods for initializing the core Khoros object using environment variables or a helper configuration file. ```python from khoros import Khoros khoros = Khoros() ``` ```python from khoros import Khoros khoros = Khoros(helper='path/to/helper.yml') ``` -------------------------------- ### Perform a Generic GET Request Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/community-api-calls.md Execute a generic GET request to a custom endpoint. Query parameters must be included in the URI. Set `return_json=False` to get a requests.Response object. ```python >>> khoros.get('/plugins/custom/example/example/hello_world') {'response': 'Hello World!'} ``` ```python >>> khoros.get('/plugins/custom/example/example/say_hello?name=John', ... return_json=False).text 'Hello, John!' ``` -------------------------------- ### Initialize Khoros with direct credentials Source: https://github.com/jeffshurtliff/khoros/blob/master/README.md Pass community URL and authentication details directly to the Khoros constructor. Supports session key and LithiumSSO token authentication. ```python # Using Session Key authentication khoros = Khoros( community_url='https://community.example.com', session_auth={'username': USERNAME, 'password': PASSWD} ) # Using LithiumSSO Token authentication khoros = Khoros( community_url='https://community.example.com', sso={'sso.authentication_token': LITHIUM_SSO_TOKEN} ) ``` -------------------------------- ### Create a New Blog Board with User Logins Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/boards.md Create a blog board by specifying authors and moderators using their usernames via `blog_author_logins` and `blog_moderator_logins`. ```python >>> authors = ['Ron Weasley', 'Neville Longbottom'] >>> mods = ['Hermione Granger'] >>> board_id, board_title, discussion_style = 'my-first-blog', 'My First Blog', 'blog' >>> khoros.boards.create(board_id, board_title, discussion_style, \ ... blog_author_logins=authors, blog_moderator_logins=mods) ``` -------------------------------- ### GET /api/users/messages/count Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/core-object-methods.md Gets the count of messages (topics and replies) posted by a user. ```APIDOC ## GET /api/users/messages/count ### Description This method gets the count of messages (topics and replies) posted by the user. ### Method GET ### Endpoint /api/users/messages/count ### Parameters #### Query Parameters - **user_settings** (dict, None) - Optional - A dictionary containing all relevant user settings supplied in the parent function - **user_id** (int, str, None) - Optional - The User ID associated with the user - **login** (str, None) - Optional - The username of the user - **email** (str, None) - Optional - The email address of the user ### Response #### Success Response (200) - **messages_count** (int) - The number of messages (topics and replies) posted by the user in integer format #### Response Example ```json { "messages_count": 300 } ``` ### Error Handling - `khoros.errors.exceptions.GETRequestError` ``` -------------------------------- ### Create an Album Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/primary-modules.md Example usage for creating a new image album using the albums module. ```python response = albums.create_album(khoros_obj, title='My Album', hidden=True) ``` -------------------------------- ### GET /users/following-count Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/core-object-methods.md Gets the count of community members the user has added as a friend. ```APIDOC ## GET /users/following-count ### Description This method gets the count of community members the user has added as a friend in the community. ### Parameters #### Query Parameters - **user_settings** (dict) - Optional - A dictionary containing all relevant user settings - **user_id** (int/str) - Optional - The User ID associated with the user - **login** (str) - Optional - The username of the user - **email** (str) - Optional - The email address of the user ``` -------------------------------- ### Initialize the Khoros Object Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/core-object-methods.md Use this import and initialization pattern to start interacting with the Khoros API. ```python from khoros import Khoros ``` ```python khoros = Khoros(community_url='https://community.example.com', helper='path/to/helper_file.yml') ``` -------------------------------- ### GET /users/followers-count Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/core-object-methods.md Gets the count of community members who have added the user as a friend. ```APIDOC ## GET /users/followers-count ### Description This method gets the count of community members who have added the user as a friend in the community. ### Parameters #### Query Parameters - **user_settings** (dict) - Optional - A dictionary containing all relevant user settings - **user_id** (int/str) - Optional - The User ID associated with the user - **login** (str) - Optional - The username of the user - **email** (str) - Optional - The email address of the user ``` -------------------------------- ### GET khoros.objects.users.get_messages_count Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/primary-modules.md Gets the count of messages (topics and replies) posted by the user. ```APIDOC ## GET khoros.objects.users.get_messages_count ### Description Gets the count of messages (topics and replies) posted by the user. ### Parameters #### Request Body - **khoros_object** (class) - Required - The core khoros.Khoros object - **user_settings** (dict) - Optional - A dictionary containing all relevant user settings - **user_id** (int/str) - Optional - The User ID associated with the user - **login** (str) - Optional - The username of the user - **email** (str) - Optional - The email address of the user ### Response - **Returns** (int) - The number of messages posted by the user ### Errors - **Raises** (GETRequestError) - If the request fails ``` -------------------------------- ### Create Q&A Board Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/boards.md Use 'qanda' for the discussion_style to create a Q&A board. This example returns the status of the creation operation. ```python khoros.boards.create('product-questions', 'Product Questions', \ 'qanda', return_status=True) ``` -------------------------------- ### GET /request Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/core-object-methods.md Performs a GET request to the Khoros API using authorized headers. ```APIDOC ## get(query_url, relative_url, return_json, headers, proxy_user_object) ### Description Performs a simple GET request that leverages the Khoros authorization headers. ### Parameters - **query_url** (str) - Required - The URL to query. - **relative_url** (bool) - Optional - Whether the URL is relative (default: True). - **return_json** (bool) - Optional - Whether to return the response as JSON (default: True). - **headers** (dict) - Optional - Custom headers for the request. - **proxy_user_object** (object) - Optional - Proxy user object for the request. ``` -------------------------------- ### Initialize Khoros with Environment Variables Source: https://github.com/jeffshurtliff/khoros/blob/master/README.md Instantiate the Khoros class without arguments by relying on environment variables for configuration. Ensure all necessary environment variables are set before calling this. ```python from khoros import Khoros khoros = Khoros() ``` -------------------------------- ### Studio Environment Utilities Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/primary-modules.md Functions to retrieve versions and check installation status of development tools. ```APIDOC ## Studio Environment Utilities ### Functions - **khoros.studio.base.get_node_version()**: Returns the installed Node.js version string or None. - **khoros.studio.base.get_npm_version()**: Returns the installed npm version string or None. - **khoros.studio.base.get_sdk_version()**: Returns the installed Lithium SDK version string or None. - **khoros.studio.base.node_installed()**: Returns boolean indicating if Node.js is installed. - **khoros.studio.base.npm_installed()**: Returns boolean indicating if npm is installed. - **khoros.studio.base.sdk_installed()**: Returns boolean indicating if the Lithium SDK is installed. ``` -------------------------------- ### Khoros Client Initialization Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/core-object-methods.md Initialize the Khoros client with various configuration options for connecting to your community instance. ```APIDOC ## Khoros Client Initialization ### Description Initializes the Khoros client with predefined settings, community details, and authentication configurations. ### Parameters #### Request Body - **defined_settings** (dict, None) - Predefined settings that the object should use - **community_url** (str, None) - The base URL of the Khoros community instance (e.g. `community.khoros.com`) - **tenant_id** (str, None) - The tenant ID for the Khoros community instance (e.g. `lithosphere`) - **community_name** (str, None) - The community name (e.g. `community-name`) for the Khoros community instance - **auth_type** (str, None) - The authentication type to use when connecting to the instance (`session_auth` by default) - **session_auth** (dict, None) - The `username` and `password` values for session key authentication - **oauth2** (dict, None) - The `client_id`, `client_secret` and `redirect_url` values for OAuth 2.0 authentication - **sso** (dict, None) - The values for single sign-on (SSO) authentication - **helper** (str, tuple, list, dict, None) - The path (and optional file type) to the YAML or JSON helper configuration file - **env_variables** (dict, str, None) - A dictionary (or file path to a YAML or JSON file) that maps environment variable names - **auto_connect** (bool) - Determines if a connection should be established when initialized (`True` by default) - **use_community_name** (bool) - Defines if the community name should be used in the API URLs (`False` by default) - **prefer_json** (bool) - Defines preference that API responses be returned in JSON format (`True` by default) - **debug_mode** (bool) - Determines if Debug Mode should be enabled for development purposes (`False` by default) - **skip_env_variables** (bool) - Explicitly ignores any valid environment variables (`False` by default) - **empty** (bool) - Instantiates an empty object to act as a placeholder with default values (`False` by default) - **ssl_verify** (bool, None) - Determines whether to verify the server’s TLS certificate (`True` by default) - **bulk_data** (dict, None) - The values for utilizing the Bulk Data API ### Raises - `khoros.errors.exceptions.MissingAuthDataError` - `khoros.errors.exceptions.CurrentlyUnsupportedError` - `khoros.errors.exceptions.SessionAuthenticationError` ### Version Changed - Changed in version 3.3.0: Changed `settings` to `defined_settings` and `_settings` to `_core_settings`. ``` -------------------------------- ### GET khoros.api.get_request_with_retries Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/primary-modules.md Performs a GET request with a total of 5 retries in case of timeouts or connection issues. ```APIDOC ## GET khoros.api.get_request_with_retries ### Description This function performs a GET request with a total of 5 retries in case of timeouts or connection issues. ### Parameters #### Query Parameters - **query_url** (str) - Required - The URI to be queried - **return_json** (bool) - Optional - Determines whether the response should be returned in JSON format (Default: True) - **khoros_object** (class) - Optional - The core Khoros object (Required if the auth_dict parameter is not supplied) - **auth_dict** (dict) - Optional - The auth dictionary within the khoros.Khoros class object - **headers** (dict) - Optional - Any header values (in dictionary format) to pass in the API call - **verify** (bool) - Optional - Determines whether to verify the server’s TLS certificate (True by default) - **proxy_user_object** (class) - Optional - Instantiated khoros.objects.users.ImpersonatedUser object to perform the API request on behalf of a secondary user. ### Response - **Returns** (Any) - The API response from the GET request (optionally in JSON format) ### Errors - Raises ValueError, TypeError, khoros.errors.exceptions.APIConnectionError, khoros.errors.exceptions.GETRequestError ``` -------------------------------- ### Create a New Blog Board with Formatted Authors/Moderators Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/boards.md Create a blog board by providing pre-formatted author and moderator data as lists of dictionaries using `blog_authors` and `blog_moderators`. ```python >>> authors = [{"id": "45"}, {"id": "57"}] >>> mods = [{"id": "12"}] >>> board_id, board_title, discussion_style = 'my-first-blog', 'My First Blog', 'blog' >>> khoros.boards.create(board_id, board_title, discussion_style, \ ... blog_authors=authors, blog_moderators=mods) ``` -------------------------------- ### Install Khoros via pip Source: https://github.com/jeffshurtliff/khoros/blob/master/README.md Use this command to install or upgrade the khoros package in your Python environment. ```sh pip install khoros --upgrade ``` -------------------------------- ### Configure Helper File Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/bulk-data-api.md YAML configuration structure for providing Bulk Data API credentials. ```yaml # Define how to obtain the connection information connection: # Bulk Data API connection information bulk_data: community_id: example.prod client_id: ay0CXXXXXXXXXX/XXXX+XXXXXXXXXXXXX/XXXXX4KhQ= token: 2f25XXXXXXXXXXXXXXXXXXXXXXXXXa10dec04068 europe: no ``` -------------------------------- ### GET Community API v2 Request Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/core-object-methods.md Performs a Community API v2 GET request using Khoros authorization headers. ```APIDOC ## GET Community API v2 ### Description Performs a Community API v2 GET request that leverages the Khoros authorization headers. ### Method GET ### Parameters #### Query Parameters - **endpoint** (str) - Required - The API v2 endpoint against which to query - **return_json** (bool) - Optional - Determines if the API response should be converted into JSON format (True by default) - **headers** (dict) - Optional - Allows the API call headers to be manually defined - **proxy_user_object** (ImpersonatedUser) - Optional - Object to perform the API request on behalf of a secondary user ### Response - The API response from the GET request ``` -------------------------------- ### Studio - SDK and Plugin Management Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/core-object-methods.md Methods for managing Khoros SDK and Studio Plugin, including checking installed versions and presence of Node.js and npm. ```APIDOC ## Studio Class This class includes methods relating to the Lithium SDK and Studio Plugin. ### `__init__(khoros_object)` This method initializes the [`khoros.core.Khoros.Studio`](#khoros.core.Khoros.Studio) inner class object. * **Parameters:** * **khoros_object** (class [*[*khoros.Khoros*](#khoros.Khoros)*]) – The core [`khoros.Khoros`](#khoros.Khoros) object ### `static get_node_version()` This method identifies and returns the installed Node.js version. #### Versionadded Added in version 2.5.1. * **Returns:** The version as a string or `None` if not installed ### `static get_npm_version()` This method identifies and returns the installed npm version. #### Versionadded Added in version 2.5.1. * **Returns:** The version as a string or `None` if not installed ### `static get_sdk_version()` This method identifies the currently installed version of the Lithium SDK. #### Versionadded Added in version 2.5.1. * **Returns:** The SDK version in string format or `None` if not installed ### `static node_installed()` This method checks whether Node.js is installed. #### Versionadded Added in version 2.5.1. * **Returns:** Boolean value indicating whether Node.js is installed ### `static npm_installed()` This method checks whether npm is installed. #### Versionadded Added in version 2.5.1. * **Returns:** Boolean value indicating whether npm is installed ### `static sdk_installed()` This method checks to see if the Lithium SDK is installed. #### Versionadded Added in version 2.5.1. * **Returns:** Boolean value indicating whether the Lithium SDK is installed ``` -------------------------------- ### Community API v1 GET Request Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/core-object-methods.md Makes a Community API v1 GET request with optional query parameters and user impersonation. ```APIDOC ## GET /api/v1/{endpoint} ### Description This method makes a Community API v1 GET request. ### Method GET ### Endpoint /api/v1/{endpoint} ### Parameters #### Path Parameters - **endpoint** (str) - Required - The API endpoint to be queried. #### Query Parameters - **query_params** (dict) - Optional - The field and associated values to be leveraged in the query string. - **return_json** (bool) - Optional - Determines if the response should be returned in JSON format rather than the default (`True` by default). - **proxy_user_object** (object) - Optional - Instantiated `ImpersonatedUser` object to perform the API request on behalf of a secondary user. ### Response #### Success Response (200) - **api_response** (any) - The API response. #### Response Example ```json { "api_response": "..." } ``` ### Errors - `ValueError` - `TypeError` - `khoros.errors.exceptions.GETRequestError` - `khoros.errors.exceptions.APIConnectionError` - `khoros.errors.exceptions.CurrentlyUnsupportedError` - `khoros.errors.exceptions.InvalidRequestTypeError` ``` -------------------------------- ### Connect via Instantiation Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/bulk-data-api.md Supplies Bulk Data API credentials directly during the instantiation of the Khoros object. ```python >>> bulk_data_settings = { 'community_id': 'example.prod', 'client_id': 'ay0CXXXXXXXXXX/XXXX+XXXXXXXXXXXXX/XXXXX4KhQ=', 'token': '2f25XXXXXXXXXXXXXXXXXXXXXXXXXa10dec04068', } >>> khoros = Khoros(defined_settings=settings, bulk_data_settings=bulk_data_settings, auto_connect=False) ``` -------------------------------- ### Perform a v1 GET Request Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/community-api-calls.md Execute GET requests against the Community API v1. Responses are returned as dictionaries by default, or as raw XML when return_json is set to False. ```python >>> khoros.v1.get('/users/online/count') {'response': {'status': 'success', 'value': {'type': 'int', '$': 544}}} ``` ```python >>> response = khoros.v1.get('/users/online/count', return_json=False) >>> type(response) >>> response >>> response.text '\n 551\n\n' ``` -------------------------------- ### Initialize Khoros SDK Object Source: https://context7.com/jeffshurtliff/khoros/llms.txt Initialize the main SDK object to interact with the Khoros Community API. Can be initialized with a community URL and helper file, or with explicit credentials. ```python from khoros import Khoros # Initialize with community URL and helper file khoros = Khoros( community_url='https://community.example.com', helper='path/to/helper_file.yml' ) # Or initialize with explicit credentials khoros = Khoros( community_url='https://community.example.com', session_auth={ 'username': 'admin_user', 'password': 'admin_password' } ) ``` -------------------------------- ### Khoros Studio Module Source: https://github.com/jeffshurtliff/khoros/blob/master/docs/index.md Methods for checking environment and SDK versioning within Studio. ```APIDOC ## Studio Module ### Description Utility methods to verify installations and versions of Node, NPM, and the SDK. ### Methods - get_node_version() - get_npm_version() - get_sdk_version() - node_installed() - npm_installed() - sdk_installed() ```