### Install Replyke React.js Package Source: https://github.com/replyke/docs-v5/blob/main/pages/react-and-react-native/getting-started.mdx This snippet provides commands to install the `@replyke/react-js` package, essential for integrating Replyke into standard React web applications. It includes options for npm, pnpm, and yarn. ```bash npm install @replyke/react-js ``` ```bash pnpm add @replyke/react-js ``` ```bash yarn add @replyke/react-js ``` -------------------------------- ### Install Replyke Expo Package Source: https://github.com/replyke/docs-v5/blob/main/pages/react-and-react-native/getting-started.mdx This snippet provides commands to install the `@replyke/expo` package, tailored for integrating Replyke into Expo managed projects. It includes options for npx expo, pnpm, and yarn. ```bash npx expo install @replyke/expo ``` ```bash pnpm add @replyke/expo ``` ```bash yarn add @replyke/expo ``` -------------------------------- ### Install Replyke React Native Package Source: https://github.com/replyke/docs-v5/blob/main/pages/react-and-react-native/getting-started.mdx This snippet provides commands to install the `@replyke/react-native` package, specifically designed for integrating Replyke into React Native mobile applications. It includes options for npm, pnpm, and yarn. ```bash npm install @replyke/react-native ``` ```bash pnpm add @replyke/react-native ``` ```bash yarn add @replyke/react-native ``` -------------------------------- ### Wrap Application with ReplykeProvider in JavaScript Source: https://github.com/replyke/docs-v5/blob/main/pages/react-and-react-native/getting-started.mdx This JavaScript example demonstrates how to correctly wrap your entire application with the `ReplykeProvider` component. It shows the necessary import and how to pass your unique `projectId` as a prop, enabling Replyke's features throughout your app. ```javascript import { ReplykeProvider } from "@replyke/react-js"; {/* Rest of your app */} ; ``` -------------------------------- ### Example HTTP Request for Get Root List Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/lists/fetch-root-list.mdx An example of how to make a GET request to the root list endpoint, including the `Authorization` header with a bearer token. ```http GET /proj1234/lists/root Authorization: Bearer ``` -------------------------------- ### Example Fetch User Request Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/users/fetch-user.mdx A simple shell command example demonstrating how to make a GET request to the Fetch User API endpoint with a specific project and user ID. ```sh GET /proj1234/users/67890 ``` -------------------------------- ### Example Request to Check Username Availability Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/users/check-username-availability.mdx An example HTTP GET request demonstrating how to query the username availability endpoint with a sample username. ```sh GET /proj1234/users/check-username?username=johndoe ``` -------------------------------- ### Example HTTP Request to Get Single Entity Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/entities/fetch-entity.mdx Illustrates a sample HTTP GET request to retrieve an entity, showing the typical URL structure with placeholder project and entity IDs. ```http GET /proj1234/entities/entity_abc ``` -------------------------------- ### Example Shell Request for User Suggestions Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/users/fetch-user-suggestions.mdx Illustrates a sample GET request to the user suggestions endpoint using a shell command, demonstrating how to include the 'query' parameter. ```sh GET /proj1234/users/suggestions?query=john ``` -------------------------------- ### Example Shell Request: Fetch Followers Count Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/users/fetch-followers-count.mdx Illustrates a sample HTTP GET request to the followers count endpoint using a shell command, showing the full URL path with example IDs. ```sh GET /proj1234/users/67890/followers-count ``` -------------------------------- ### Example JSON Success Response for Get Root List Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/lists/fetch-root-list.mdx A sample JSON structure returned upon a successful `GET /:projectId/lists/root` request, showing the structure of a root list object. ```json { "id": "list_abc", "projectId": "proj1234", "userId": "user_xyz", "name": "root", "isRoot": true, "parentId": null, "entityIds": [], "subLists": [], "createdAt": "2024-01-01T00:00:00.000Z", "updatedAt": "2024-01-01T00:00:00.000Z" } ``` -------------------------------- ### Example HTTP Request for Get Entity by Short ID Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/entities/fetch-entity-by-short-id.mdx An example HTTP GET request demonstrating how to query the endpoint with a specific short ID. ```http GET /proj1234/entities/by-short-id?shortId=3jh4sK ``` -------------------------------- ### Example HTTP Request for Get App Notifications Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/app-notifications/fetch-notifications.mdx Illustrates how to make a GET request to the app notifications endpoint, including the path parameters, query parameters for pagination, and the required Authorization header with a bearer token. ```http GET /proj1234/app-notifications?page=2&limit=10 Authorization: Bearer ``` -------------------------------- ### Example Request: Get or Create User by Foreign ID (Shell) Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/users/fetch-user-by-foreign-id.mdx Illustrates how to make a GET request to the user management endpoint using a shell command, including various query parameters for user identification and data submission. ```sh GET /proj1234/users/by-foreign-id?foreignId=abc123&name=Jane&username=janedoe&metadata={"lang":"en"} ``` -------------------------------- ### Fetch Entities API Request Example Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/entities/fetch-many-entities.mdx An example HTTP GET request to the /entities endpoint, demonstrating the use of sortBy, limit, page, and followedOnly query parameters, along with an Authorization header for authenticated access. ```http GET /proj1234/entities?sortBy=top&limit=10&page=1&followedOnly=true Authorization: Bearer ``` -------------------------------- ### Example Shell Request for Following Count Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/users/fetch-following-count.mdx A sample `GET` request demonstrating how to call the following count endpoint using a shell command with placeholder project and user IDs. ```sh GET /proj1234/users/67890/following-count ``` -------------------------------- ### Example HTTP Request to Get Sub-Lists Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/lists/fetch-sub-lists.mdx Illustrates how to make an HTTP GET request to the /sub-lists endpoint, including path parameters and the required Authorization Bearer token header. ```http GET /proj1234/lists/list_abc/sub-lists Authorization: Bearer ``` -------------------------------- ### Example Sign Up Success Response Body Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/auth/sign-up.mdx An example JSON response body for a successful user sign-up, including access tokens and user data. ```json { "success": true, "accessToken": "", "refreshToken": "", "user": { "id": "user_123", "email": "jane@example.com", "username": "janedoe", "name": "Jane Doe", "avatar": "https://example.com/avatar.jpg", "bio": "Tech enthusiast", "location": { "type": "Point", "coordinates": [-73.935242, 40.73061] }, "birthdate": "1995-01-01T00:00:00.000Z", "metadata": { "office": "boston" }, "suspensions": [], "reputation": 0, "createdAt": "2024-01-01T00:00:00.000Z", "updatedAt": "2024-01-01T00:00:00.000Z" } } ``` -------------------------------- ### Example Sign Up Request Body Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/auth/sign-up.mdx An example JSON payload for the user sign-up API request, demonstrating required and optional fields. ```json { "email": "jane@example.com", "password": "securePassword123", "username": "janedoe", "name": "Jane Doe", "avatar": "https://example.com/avatar.jpg", "bio": "Tech enthusiast", "location": { "longitude": -73.935242, "latitude": 40.73061 }, "metadata": { "office": "boston" }, "secureMetadata": { "internalId": "abc123" } } ``` -------------------------------- ### Example Server Error Response Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/auth/sign-up.mdx An example JSON response for a 500 Internal Server Error during user sign-up. ```json { "error": "Internal server error", "code": "auth/server-error", "details": "" } ``` -------------------------------- ### Example Missing Fields Error Response Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/auth/sign-up.mdx An example JSON response for a 400 Bad Request error due to missing required fields during sign-up. ```json { "error": "Missing required fields", "code": "auth/missing-fields" } ``` -------------------------------- ### Basic Replyke Comment Section Setup in React Native Source: https://github.com/replyke/docs-v5/blob/main/pages/react-and-react-native/comments/provider-and-hook.mdx This code snippet illustrates the basic integration of the Replyke comment system into a React Native application. It demonstrates the use of `useSocialStyle` for applying optional custom styling, and `useSocialComments` to initialize the comment section, providing components like `CommentSectionProvider`, `CommentsFeed`, and `NewCommentForm`. The example also includes handling user interaction callbacks, login requirements, and optional comment sorting with `SortByButton`. It highlights how to focus the comment form and manage `highlightedCommentId` for specific comment visibility. ```tsx import React, { useEffect, useMemo, useRef } from "react"; import { View, Text, Keyboard } from "react-native"; import { useSocialComments, useSocialStyle, UseSocialStyleProps, } from "@replyke/comments-social-react-native"; import { showMessage } from "react-native-flash-message"; const CommentsSection = ({ entityId, navigateToAccount, }: { entityId: string; navigateToAccount: (accountId: string) => void; }) => { // Custom styles (optional) const customStyles = useMemo>( () => ({ newCommentFormProps: { verticalPadding: 24, paddingLeft: 24, paddingRight: 24, }, }), [] ); const styleConfig = useSocialStyle(customStyles); // Initialize comments with useSocialComments const { CommentSectionProvider, CommentsFeed, NewCommentForm, SortByButton } = useSocialComments({ entityId, styleConfig, highlightedCommentId: "some-comment-uuid", // Should be an actual UUID if used callbacks: { currentUserClickCallback: () => { Keyboard.dismiss(); navigateToProfile(); }, otherUserClickCallback: (userId: string) => { Keyboard.dismiss(); navigateToAccount(userId); }, loginRequiredCallback: () => { showMessage({ message: "Oops! Login Required", description: "Please sign in or create an account to continue.", type: "warning", }); }, }, }); const commentFormRef = useRef<{ focus: () => void } | null>(null); // Focus the form when entityId changes useEffect(() => { if (!entityId) return; const timeout = setTimeout(() => { commentFormRef.current?.focus(); }, 1000); return () => clearTimeout(timeout); }, [entityId]); return ( Top } nonActiveView={ Top } /> New } nonActiveView={ New } /> ); }; export default CommentsSection; ``` -------------------------------- ### Example JSON Error Response (404 Not Found) Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/entities/fetch-entity-by-short-id.mdx A sample JSON object returned when no entity is found for the provided 'shortId'. ```json { "error": "Entity not found", "code": "entity/not-found" } ``` -------------------------------- ### Example JSON Success Response for Get App Notifications Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/app-notifications/fetch-notifications.mdx Provides a sample 200 OK JSON response for a successful retrieval of app notifications, detailing the structure and typical fields of a single notification object, including metadata and timestamps. ```json [ { "id": "notif123", "userId": "user_abc", "projectId": "proj1234", "type": "new-follow", "action": "open-profile", "metadata": { "initiatorId": "user_xyz", "initiatorName": "Jane", "initiatorUsername": "jane123", "initiatorAvatar": "https://example.com/avatar.jpg" }, "createdAt": "2024-07-10T10:00:00.000Z", "updatedAt": "2024-07-10T10:00:00.000Z" } ] ``` -------------------------------- ### Example JSON Request Body for Create Sub-List Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/lists/create-new-list.mdx An example of the JSON payload required for the Create Sub-List API request, showing the 'listName' field with a sample value. ```json { "listName": "Ideas" } ``` -------------------------------- ### Example JSON Success Response (200 OK) Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/entities/fetch-entity-by-short-id.mdx A sample JSON object representing a successful response when an entity is found and retrieved. ```json { "id": "entity_xyz", "shortId": "3jh4sK", "title": "Example Post", "content": "This is a sample entity.", "createdAt": "2024-01-01T00:00:00.000Z", ... } ``` -------------------------------- ### Example Request Body for Sign Out Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/auth/sign-out.mdx An example JSON payload demonstrating the structure for the sign-out request, specifically showing the `refreshToken` field. ```JSON { "refreshToken": "" } ``` -------------------------------- ### Example Request Body for Create Comment API Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/comments/create-comment.mdx A JSON example demonstrating the structure of the request body for creating a new comment. This example includes an entity ID, text content, mentions, and custom metadata, while showing how to explicitly set GIF to null and include a parent ID for replies. ```JSON { "entityId": "a1b2c3d4", "content": "Great article!", "mentions": [{ "id": "user-123", "username": "alex" }], "gif": null, "parentId": "comment-456", "attachments": [], "metadata": { "source": "web" } } ``` -------------------------------- ### API Reference: Get Root List Endpoint Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/lists/fetch-root-list.mdx Detailed documentation for the `GET /:projectId/lists/root` endpoint, including request parameters, headers, and response structures, and error handling. ```APIDOC Endpoint: URL: /:projectId/lists/root Method: GET Authentication Required: Yes Request: Headers: Authorization: Type: string Required: Yes Description: Bearer token for authentication. Path Parameters: projectId: Type: string Required: Yes Description: The ID of the project context. Query Parameters: None Response: Success Response (200 OK): id: string projectId: string userId: string name: string isRoot: boolean parentId: null | string entityIds: array subLists: array createdAt: string (ISO 8601 datetime) updatedAt: string (ISO 8601 datetime) Error Responses: Server Error (500 Internal Server Error): error: string code: string details: string ``` -------------------------------- ### Example Error Response (400 Bad Request) - Missing Parameters Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/lists/create-new-list.mdx An example of the JSON error response when required parameters are missing from the request body, resulting in an HTTP 400 Bad Request. ```json { "error": "Missing required parameters in request body", "code": "list/missing-parameters" } ``` -------------------------------- ### Include Access Token in API Request Header Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/authentication.mdx This example demonstrates the standard way to include the access token in the Authorization header for any API request that requires authentication. The token should be prefixed with 'Bearer'. ```HTTP GET /posts/{postId}/comments Host: api.replyke.com Authorization: Bearer YOUR_ACCESS_TOKEN ``` -------------------------------- ### Example HTTP Request: Mark Notification as Read Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/app-notifications/mark-notification-as-read.mdx An example HTTP request demonstrating how to call the API to mark a notification as read, including the Authorization header. ```HTTP PATCH /proj1234/app-notifications/abcd123/mark-as-read Authorization: Bearer ``` -------------------------------- ### API Documentation for Get Sub-Lists Endpoint Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/lists/fetch-sub-lists.mdx Comprehensive documentation for the /:projectId/lists/:listId/sub-lists GET endpoint, detailing its URL, method, authentication requirements, and all request parameters (headers, path, query). ```APIDOC Endpoint: URL: /:projectId/lists/:listId/sub-lists Method: GET Authentication Required: Yes Request: Headers: Authorization: Type: string Required: Yes Description: Bearer token for authentication. Path Parameters: listId: Type: string Required: Yes Description: The ID of the parent list. Query Parameters: None ``` -------------------------------- ### Example Request Body for Add Entity to List Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/lists/add-entity-to-list.mdx An example JSON payload for the 'Add Entity to List' API request. ```json { "entityId": "abc123" } ``` -------------------------------- ### Example HTTP GET Request for Get Entity by Foreign ID Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/entities/fetch-entity-by-foreign-id.mdx Illustrates how to make a GET request to retrieve an entity by its foreign ID, including the `createIfNotFound` parameter. ```http GET /proj1234/entities/by-foreign-id?foreignId=abc-123&createIfNotFound=true ``` -------------------------------- ### HTTP Example: Unfollow User Request Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/users/follows/delete-follow.mdx An example HTTP request demonstrating how to call the Unfollow User endpoint, including the DELETE method, path, and Authorization header. ```http DELETE /proj1234/users/abcd123/follow Authorization: Bearer ``` -------------------------------- ### Sign Up API Endpoint Documentation Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/auth/sign-up.mdx Comprehensive documentation for the user sign-up API, including endpoint details, request parameters, and expected responses. ```APIDOC Endpoint: /:projectId/auth/sign-up Method: POST Authentication Required: No Description: Register a new user by providing required credentials and optional profile data. Returns access and refresh tokens along with user data. Request Body Parameters: email: string (Required) - User's email address. password: string (Required) - User's password. name: string (Optional) - Full name of the user. username: string (Optional) - Unique username. Will be lowercased. avatar: string (URL) (Optional) - URL to the user's avatar image. bio: string (Optional) - Short biography. location: object (Optional) - Geolocation object with `longitude` and `latitude`. birthdate: string (ISO date) (Optional) - User's birthdate. metadata: object (Optional) - Custom public metadata. secureMetadata: object (Optional) - Custom secure metadata (not returned to client). Response: 201 Created (Success): success: boolean accessToken: string refreshToken: string user: object id: string email: string username: string name: string avatar: string bio: string location: object type: string ("Point") coordinates: array [longitude, latitude] birthdate: string (ISO date) metadata: object suspensions: array reputation: number createdAt: string (ISO date) updatedAt: string (ISO date) 400 Bad Request (Missing Required Fields): error: string ("Missing required fields") code: string ("auth/missing-fields") 500 Internal Server Error (Server Error): error: string ("Internal server error") code: string ("auth/server-error") details: string ("") Notes: - Sets an HttpOnly cookie named `replyke-refresh-jwt` with the refresh token. - Access token is returned in the response body. - Sensitive user data is excluded in the response. - A webhook is called before user creation to allow project-specific validation. ``` -------------------------------- ### Example: `newFollow` Notification Template and Data Source: https://github.com/replyke/docs-v5/blob/main/pages/react-and-react-native/app-notifications/notification-templates.mdx Illustrates the event data and template structure for a `newFollow` notification. This example shows how to create a personalized message for a new follower using their name and username. ```json { "initiatorName": "Alice", "initiatorUsername": "alice2023", "initiatorAvatar": "https://example.com/alice.jpg" } ``` ```json { "title": "$initiatorName started following you!", "content": "Check out their profile: @$initiatorUsername" } ``` -------------------------------- ### Example JSON Request Body for User Sign-In Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/auth/sign-in.mdx A sample JSON payload demonstrating the required email and password fields for the sign-in API request. ```json { "email": "jane@example.com", "password": "securePassword123" } ``` -------------------------------- ### Example Request Body for Verify External User Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/auth/verify-external-user.mdx A JSON example illustrating the structure of the request body for the external user verification endpoint, showing the `userJwt` field. ```json { "userJwt": "" } ``` -------------------------------- ### Example HTTP Request to Follow User Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/users/follows/create-follow.mdx An illustrative HTTP POST request demonstrating how to call the follow user endpoint with a placeholder project ID, user ID, and authorization token. ```http POST /proj1234/users/abcd123/follow Authorization: Bearer ``` -------------------------------- ### Example JSON Success Response for User Sign-In Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/auth/sign-in.mdx A sample JSON response body returned upon successful user authentication, including access token, refresh token, and user details. ```json { "success": true, "accessToken": "", "refreshToken": "", "user": { "id": "user_123", "email": "jane@example.com", "username": "janedoe", "name": "Jane Doe", "avatar": "https://example.com/avatar.jpg", "bio": "Tech enthusiast", "location": { "type": "Point", "coordinates": [-73.935242, 40.73061] }, "birthdate": "1995-01-01T00:00:00.000Z", "metadata": { "office": "boston" }, "suspensions": [], "reputation": 0, "createdAt": "2024-01-01T00:00:00.000Z", "updatedAt": "2024-01-01T00:00:00.000Z" } } ``` -------------------------------- ### Example HTTP Request to Check Follow Status Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/users/follows/fetch-follow.mdx An example of an HTTP GET request to the /users/:userId/follow endpoint, including the Authorization header with a Bearer token. ```http GET /proj1234/users/abcd123/follow Authorization: Bearer ``` -------------------------------- ### API Reference for User Sign-In Endpoint Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/auth/sign-in.mdx Detailed API documentation for the POST /:projectId/auth/sign-in endpoint, including request parameters, success, and error responses. ```APIDOC Endpoint: URL: /:projectId/auth/sign-in Method: POST Authentication Required: No Request: Body Parameters: email: Type: string Required: Yes Description: User's registered email. password: Type: string Required: Yes Description: User's password. Response: Success (200 OK): success: boolean accessToken: string refreshToken: string user: id: string email: string username: string name: string avatar: string bio: string location: type: string coordinates: array of numbers birthdate: string (ISO 8601) metadata: object suspensions: array reputation: number createdAt: string (ISO 8601) updatedAt: string (ISO 8601) Error Responses: Missing Fields (400 Bad Request): error: string code: string User Not Found (403 Forbidden): error: string code: string Missing Credentials (403 Forbidden): error: string code: string Incorrect Password (401 Unauthorized): error: string code: string Server Error (500 Internal Server Error): error: string code: string details: string ``` -------------------------------- ### Example HTTP Request to Count Unread App Notifications Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/app-notifications/count-unread-notification.mdx An example HTTP GET request demonstrating how to call the endpoint with a placeholder project ID and a Bearer access token. ```http GET /proj1234/app-notifications/count Authorization: Bearer ``` -------------------------------- ### Example JSON for a Basic Replyke List Object Source: https://github.com/replyke/docs-v5/blob/main/pages/data-models/list.mdx Illustrates a simple Replyke List object, demonstrating its core properties such as ID, project and user association, name, root status, and a list of contained entity IDs. This example shows a root list without a parent. ```json { "id": "list-123456", "projectId": "project-xyz", "userId": "user-789", "name": "Favorite Articles", "isRoot": true, "entityIds": ["entity-111", "entity-222"], "createdAt": "2024-02-14T12:34:56Z", "updatedAt": "2024-02-15T14:20:00Z" } ``` -------------------------------- ### Example JSON Error Response for Get Root List Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/lists/fetch-root-list.mdx A sample JSON structure returned upon a server error (500 Internal Server Error) from the root list endpoint, indicating the error code and details. ```json { "error": "Server error", "code": "list/server-error", "details": "" } ``` -------------------------------- ### JSON Example: Successful Get Comments Response (200 OK) Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/comments/fetch-many-comments.mdx Illustrates the structure of a successful HTTP 200 OK response from the 'Get Comments' endpoint. This JSON array contains one or more comment objects, each detailing properties like ID, associated entity and user IDs, content, votes, and timestamps. ```json [ { "id": "comment-001", "entityId": "entity-123", "userId": "user-456", "content": "This is a comment.", "mentions": [], "upvotes": ["user-789"], "downvotes": [], "attachments": [], "metadata": {}, "createdAt": "2025-05-11T10:00:00.000Z", "updatedAt": "2025-05-11T10:00:00.000Z" } ] ``` -------------------------------- ### Example JSON Error Response for Missing Fields Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/auth/sign-in.mdx A sample JSON response for a 400 Bad Request error when required fields like email or password are missing. ```json { "error": "Email, and password are required.", "code": "auth/missing-fields" } ``` -------------------------------- ### Successful Response for Get Sub-Lists (200 OK) Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/lists/fetch-sub-lists.mdx Example JSON response for a successful request to retrieve sub-lists, showing the structure of returned list objects with their IDs, project/user associations, names, parent IDs, and timestamps. ```json [ { "id": "list_def", "projectId": "proj1234", "userId": "user_xyz", "name": "Sub List 1", "parentId": "list_abc", "entityIds": [], "subLists": [], "createdAt": "2024-01-02T00:00:00.000Z", "updatedAt": "2024-01-02T00:00:00.000Z" }, { "id": "list_ghi", "projectId": "proj1234", "userId": "user_xyz", "name": "Sub List 2", "parentId": "list_abc", "entityIds": [], "subLists": [], "createdAt": "2024-01-02T00:00:00.000Z", "updatedAt": "2024-01-02T00:00:00.000Z" } ] ``` -------------------------------- ### Error Responses for Get Single Entity Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/entities/fetch-entity.mdx Provides examples of JSON responses for various error conditions that can occur when attempting to retrieve an entity, including invalid request parameters, entity not found, and internal server errors. ```json { "error": "Missing a valid entityId in request query.", "code": "entity/invalid-resource-id" } ``` ```json { "error": "Entity not found", "code": "entity/not-found" } ``` ```json { "error": "Internal server error.", "code": "entity/server-error", "details": "" } ``` -------------------------------- ### Successful Entity Retrieval Response (200 OK) Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/entities/fetch-entity-by-foreign-id.mdx Example JSON structure returned upon successful retrieval or creation of an entity. ```json { "id": "entity_xyz", "projectId": "proj1234", "foreignId": "abc-123", "title": null, "content": null, "keywords": [], "metadata": {}, ... } ``` -------------------------------- ### Example Success Response (201 Created) for Create Sub-List Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/lists/create-new-list.mdx An example of the JSON response returned upon successful creation of a sub-list (HTTP 201 Created), including the new list's ID, project ID, user ID, name, parent ID, and timestamps. ```json { "id": "list_456", "projectId": "proj_123", "userId": "user_abc", "name": "Ideas", "parentId": "list_123", "entityIds": [], "createdAt": "2024-01-01T00:00:00.000Z", "updatedAt": "2024-01-01T00:00:00.000Z" } ``` -------------------------------- ### Example JSON Success Response (200 OK) for Create Entity Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/entities/create-entity.mdx A sample JSON response returned upon successful creation of an entity, showing the structure of the fully populated entity object. ```JSON { "id": "entity_abc", "userId": "user_123", "shortId": "abc123", "title": "Interesting Thought", "content": "Here's something I've been thinking about...", "mentions": [ { "id": "user_789", "username": "ben_322" } ], ... } ``` -------------------------------- ### Flexible Entity Structure JSON Examples Source: https://github.com/replyke/docs-v5/blob/main/pages/data-models/entity.mdx Illustrates various use cases for a flexible 'Entity' structure, demonstrating how it can adapt to different content types like social media posts, marketplace products, static pages, and location-based listings. This structure is designed for broad integration into diverse content pipelines. ```json { "id": "550e8400-e29b-41d4-a716-446655440000", "content": "Check out this amazing sunset!", "attachments": [{ "url": "https://example.com/media/sunset.jpg", "size": "2MB" }], "keywords": ["sunset", "nature"], "user": { "id": "550e8400-e29b-41d4-a716-446655440001", "name": "John Doe" } } ``` ```json { "id": "550e8400-e29b-41d4-a716-446655440002", "title": "Wireless Earbuds", "content": "Experience high-quality sound with our new earbuds.", "attachments": [], "keywords": ["electronics", "audio"] } ``` ```json { "id": "550e8400-e29b-41d4-a716-446655440003", "foreignId": "about-page", "title": "About Us", "content": "Welcome to our platform. Here is what we do.", "attachments": [], "user": null } ``` ```json { "id": "550e8400-e29b-41d4-a716-446655440004", "title": "Cozy Beachside Hotel", "content": "Enjoy your stay at our beautiful beachside hotel.", "location": { "type": "Point", "coordinates": [34.0522, -118.2437] }, "metadata": { "rating": 4.5, "price": "199.99" }, "user": { "id": "550e8400-e29b-41d4-a716-446655440005", "name": "Sunrise Hotels" } } ``` -------------------------------- ### JSON Success Response for Following Count Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/users/fetch-following-count.mdx An example of the JSON structure returned upon a successful `GET` request to the following count endpoint, showing the 'count' field. ```json { "count": 42 } ``` -------------------------------- ### Example JSON Request Body for Create Entity Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/entities/create-entity.mdx An illustrative JSON payload demonstrating how to structure the request body when creating a new entity, including various optional fields. ```JSON { "userId": "user_123", "foreignId": "external_456", "title": "Interesting Thought", "content": "Here's something I've been thinking about...", "mentions": [{ "id": "user_789", "username": "ben_322" }], "location": { "longitude": -73.935242, "latitude": 40.73061 }, "metadata": { "mood": "reflective" } } ``` -------------------------------- ### Example HTTP Request to Check Entity Saved Status Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/lists/is-entity-saved.mdx Illustrative HTTP GET request demonstrating how to query the `is-entity-saved` endpoint with an `entityId` and `Authorization` header. ```http GET /proj1234/lists/is-entity-saved?entityId=abc123 Authorization: Bearer ``` -------------------------------- ### Example JSON Error Response (500 Internal Server Error) Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/entities/fetch-entity-by-short-id.mdx A sample JSON object returned for unexpected server-side errors during entity retrieval. ```json { "error": "Internal server error.", "code": "entity/server-error", "details": "" } ``` -------------------------------- ### Example JSON Error Response (400 Bad Request) Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/entities/fetch-entity-by-short-id.mdx A sample JSON object returned when the request is missing the required 'shortId' query parameter. ```json { "error": "Missing shortId in request query.", "code": "entity/invalid-query-params" } ``` -------------------------------- ### Error Response: Server Error (500 Internal Server Error) Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/lists/fetch-sub-lists.mdx Example JSON response for a generic server-side error, including an error code and an optional detailed message. ```json { "error": "Server error", "code": "list/server-error", "details": "" } ``` -------------------------------- ### Example JSON Error Response for User Not Found Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/auth/sign-in.mdx A sample JSON response for a 403 Forbidden error when the user associated with the provided credentials is not found. ```json { "error": "User not found.", "code": "auth/no-user-found" } ``` -------------------------------- ### API Documentation: Create Sub-List Endpoint Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/lists/create-new-list.mdx Comprehensive API documentation for creating a new sub-list, detailing the endpoint, HTTP method, authentication requirements, request parameters (path, headers, body), and important notes regarding user association and parent list validation. ```APIDOC Endpoint: URL: /:projectId/lists/:listId/sub-lists Method: POST Authentication Required: Yes Description: Creates a new sub-list (nested list) under the specified parent list. Request: Path Parameters: listId: Type: string Required: Yes Description: ID of the parent list to nest under Headers: Authorization: Type: string Required: Yes Description: Bearer token for authentication. Body Parameters: listName: Type: string Required: Yes Description: Name of the new sub-list Notes: - The authenticated user's ID is automatically associated with the new list. - Only existing parent lists can be used for sub-list creation. - The response includes the populated list details. ``` -------------------------------- ### Error Response: Missing Parameters (400 Bad Request) Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/lists/fetch-sub-lists.mdx Example JSON response when required parameters are missing from the request, indicating a bad request with a specific error code. ```json { "error": "Missing required parameters in request query", "code": "list/missing-params" } ``` -------------------------------- ### Replyke Comment Section API Reference Source: https://github.com/replyke/docs-v5/blob/main/pages/react-and-react-native/comments/provider-and-hook.mdx Comprehensive API documentation for integrating Replyke's comment section, detailing required components and the `useSocialComments` hook with its properties for configuration and customization. ```APIDOC CommentSection: Components: CommentSectionProvider (Required): Description: Wraps the entire comment section and provides the necessary context to its child components. CommentsFeed (Required): Description: Displays the list of comments for the associated entity. Supports nested replies. NewCommentForm (Required): Description: Provides the interface for users to submit new comments or replies. SortByButton (Optional): Description: Allows users to sort comments by criteria such as "new," "old," or "top." Hooks: useSocialComments: Description: Provides comment section components and ensures seamless interaction. Required Properties: entityId: string (Optional, but one of entityId, foreignId, shortId, or entity must be provided) Description: The ID of the entity in Replyke's system. foreignId: string (Optional, but one of entityId, foreignId, shortId, or entity must be provided) Description: The foreign/external ID of the entity. shortId: string (Optional, but one of entityId, foreignId, shortId, or entity must be provided) Description: The unique short ID of the entity. entity: Entity object (Optional, but one of entityId, foreignId, shortId, or entity must be provided) Description: A complete Entity object, useful for preventing redundant re-fetches. styleConfig: object (Required) Description: A configuration object created using the useSocialStyle hook for basic style customization. Optional Properties: callbacks: object Description: Functions to handle specific interactions (e.g., login, author/mention clicks). defaultSortBy: "top" | "new" | "old" Description: Sets the initial sort order of comments. Defaults to "top". limit: number Description: Controls how many comments are fetched as the user scrolls. Defaults to 15. highlightedCommentId: string Description: Highlights a specific comment, useful for directing users via notifications. createIfNotFound: boolean Description: Instructs Replyke to create an entity if one isn’t found. ``` -------------------------------- ### Error Response: Comment Not Found (404 Not Found) Source: https://github.com/replyke/docs-v5/blob/main/pages/api-endpoints/comments/fetch-comment-by-foreign-id.mdx This JSON example illustrates an error response (404 Not Found) when a comment corresponding to the provided `foreignId` could not be located. ```json { "error": "Comment not found", "code": "comment/not-found" } ```