diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 00000000..b2d6de30 --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1,20 @@ +# Dependencies +/node_modules + +# Production +/build + +# Generated files +.docusaurus +.cache-loader + +# Misc +.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 00000000..0c6c2c27 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,41 @@ +# Website + +This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator. + +### Installation + +``` +$ yarn +``` + +### Local Development + +``` +$ yarn start +``` + +This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server. + +### Build + +``` +$ yarn build +``` + +This command generates static content into the `build` directory and can be served using any static contents hosting service. + +### Deployment + +Using SSH: + +``` +$ USE_SSH=true yarn deploy +``` + +Not using SSH: + +``` +$ GIT_USER= yarn deploy +``` + +If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch. diff --git a/docs/babel.config.js b/docs/babel.config.js new file mode 100644 index 00000000..e00595da --- /dev/null +++ b/docs/babel.config.js @@ -0,0 +1,3 @@ +module.exports = { + presets: [require.resolve('@docusaurus/core/lib/babel/preset')], +}; diff --git a/docs/docs/client-sdk/_category_.json b/docs/docs/client-sdk/_category_.json new file mode 100644 index 00000000..144d6f39 --- /dev/null +++ b/docs/docs/client-sdk/_category_.json @@ -0,0 +1,7 @@ +{ + "label": "Client SDK", + "position": 2, + "link": { + "type": "generated-index" + } +} diff --git a/docs/docs/client-sdk/getting-started.md b/docs/docs/client-sdk/getting-started.md new file mode 100644 index 00000000..a736f04d --- /dev/null +++ b/docs/docs/client-sdk/getting-started.md @@ -0,0 +1,6 @@ +--- +sidebar_position: 1 +--- + +# Getting Started +Me pica el splungus \ No newline at end of file diff --git a/docs/docs/comty-cli/_category_.json b/docs/docs/comty-cli/_category_.json new file mode 100644 index 00000000..f275b2a1 --- /dev/null +++ b/docs/docs/comty-cli/_category_.json @@ -0,0 +1,7 @@ +{ + "label": "Comty™ CLI", + "position": 3, + "link": { + "type": "generated-index" + } +} diff --git a/docs/docs/comty-cli/getting-started.md b/docs/docs/comty-cli/getting-started.md new file mode 100644 index 00000000..a736f04d --- /dev/null +++ b/docs/docs/comty-cli/getting-started.md @@ -0,0 +1,6 @@ +--- +sidebar_position: 1 +--- + +# Getting Started +Me pica el splungus \ No newline at end of file diff --git a/docs/docs/comty-js/_category_.json b/docs/docs/comty-js/_category_.json new file mode 100644 index 00000000..5576be2b --- /dev/null +++ b/docs/docs/comty-js/_category_.json @@ -0,0 +1,7 @@ +{ + "label": "Comty.JS", + "position": 1, + "link": { + "type": "generated-index" + } +} diff --git a/docs/docs/comty-js/authentication.md b/docs/docs/comty-js/authentication.md new file mode 100644 index 00000000..51167dfb --- /dev/null +++ b/docs/docs/comty-js/authentication.md @@ -0,0 +1,9 @@ +--- +sidebar_position: 3 +--- + +# Authenticating + +## Server Keys + +## User Token \ No newline at end of file diff --git a/docs/docs/comty-js/definitions/_category_.json b/docs/docs/comty-js/definitions/_category_.json new file mode 100644 index 00000000..33898a33 --- /dev/null +++ b/docs/docs/comty-js/definitions/_category_.json @@ -0,0 +1,7 @@ +{ + "label": "Definitions", + "position": 6, + "link": { + "type": "generated-index" + } +} diff --git a/docs/docs/comty-js/definitions/like-status-object.md b/docs/docs/comty-js/definitions/like-status-object.md new file mode 100644 index 00000000..d6b6fa1f --- /dev/null +++ b/docs/docs/comty-js/definitions/like-status-object.md @@ -0,0 +1,6 @@ +# Like Status Object +| Parameter | Type | Content | +| --- | --- | --- | +| post_id | string | | +| liked | Boolean | | +| count | Number | Current like count | \ No newline at end of file diff --git a/docs/docs/comty-js/definitions/post-object.md b/docs/docs/comty-js/definitions/post-object.md new file mode 100644 index 00000000..2fa92991 --- /dev/null +++ b/docs/docs/comty-js/definitions/post-object.md @@ -0,0 +1,8 @@ +# Post Object +| Parameter | Type | Content | +| --- | --- | --- | +| _id | string | | +| user_id | string | | +| message | string | | +| created_at | string | | +| updated_at | string | | diff --git a/docs/docs/comty-js/definitions/save-status-object.md b/docs/docs/comty-js/definitions/save-status-object.md new file mode 100644 index 00000000..41c0376a --- /dev/null +++ b/docs/docs/comty-js/definitions/save-status-object.md @@ -0,0 +1,6 @@ +# Save Status Object +| Parameter | Type | Content | +| --- | --- | --- | +| post_id | string | | +| saved | Boolean | | +| count | Number | Current global save count | \ No newline at end of file diff --git a/docs/docs/comty-js/getting-started.md b/docs/docs/comty-js/getting-started.md new file mode 100644 index 00000000..a736f04d --- /dev/null +++ b/docs/docs/comty-js/getting-started.md @@ -0,0 +1,6 @@ +--- +sidebar_position: 1 +--- + +# Getting Started +Me pica el splungus \ No newline at end of file diff --git a/docs/docs/comty-js/installing.md b/docs/docs/comty-js/installing.md new file mode 100644 index 00000000..85592d8b --- /dev/null +++ b/docs/docs/comty-js/installing.md @@ -0,0 +1,5 @@ +--- +sidebar_position: 2 +--- + +# Installing \ No newline at end of file diff --git a/docs/docs/comty-js/models/_category_.json b/docs/docs/comty-js/models/_category_.json new file mode 100644 index 00000000..bb3e21f0 --- /dev/null +++ b/docs/docs/comty-js/models/_category_.json @@ -0,0 +1,7 @@ +{ + "label": "Models", + "position": 4, + "link": { + "type": "generated-index" + } +} diff --git a/docs/docs/comty-js/models/auth/_category_.json b/docs/docs/comty-js/models/auth/_category_.json new file mode 100644 index 00000000..b50e4c7a --- /dev/null +++ b/docs/docs/comty-js/models/auth/_category_.json @@ -0,0 +1,7 @@ +{ + "label": "Auth", + "position": 1, + "link": { + "type": "generated-index" + } +} diff --git a/docs/docs/comty-js/models/auth/availability.md b/docs/docs/comty-js/models/auth/availability.md new file mode 100644 index 00000000..4059a6d8 --- /dev/null +++ b/docs/docs/comty-js/models/auth/availability.md @@ -0,0 +1,5 @@ +--- +sidebar_position: 5 +--- + +# Check if username or email is available \ No newline at end of file diff --git a/docs/docs/comty-js/models/auth/change-password.md b/docs/docs/comty-js/models/auth/change-password.md new file mode 100644 index 00000000..4b8ab475 --- /dev/null +++ b/docs/docs/comty-js/models/auth/change-password.md @@ -0,0 +1,5 @@ +--- +sidebar_position: 6 +--- + +# Update password \ No newline at end of file diff --git a/docs/docs/comty-js/models/auth/login.md b/docs/docs/comty-js/models/auth/login.md new file mode 100644 index 00000000..efb4b1cd --- /dev/null +++ b/docs/docs/comty-js/models/auth/login.md @@ -0,0 +1,79 @@ +--- +sidebar_position: 1 +--- + +# Login (Credentials) +This method allows you to create a auth session with a username and password. + +:::info +Use of [**server keys**](/docs/comty-js/authentication#server-keys) is recommended instead using credentials. +::: + +
+ +### Parameters +| Parameter | Type | Optional | Default | Description | +| --- | --- | --- | --- | --- | +| [payload](#object-payload) | Object | true | | | +| [callback](#function-callback) | Function | false | | | + +#### [Object] Payload +| Parameter | Type | Optional | Default | Description | +| --- | --- | --- | --- | --- | +| username | String | true | | | +| password | String | true | | | +| mfa_code | String | false | | Required if MFA is enabled for this user | + +#### [Function] Callback +Executed on successful login + +| Parameter | Type | Content | +| --- | --- | --- | +| data | Object | [Successful Auth](#successful-auth) | + +#### [Object] Successful Auth +Contains the token and refresh token + +| Parameter | Type | Content | +| --- | --- | --- | +| token | String | | +| refreshToken | String | | +| expires_in | String | | + + +
+ +### Examples +Basic usage + +```js +const auth = await AuthModel.login({ + username: "testuser", + password: "testpassword", +}) + +console.log(auth) + +// returns +// { +// token: "xxxx", +// refreshToken: "xxxx", +// } +``` + +Using Callback + +```js +AuthModel.login({ + username: "testuser", + password: "testpassword", +}, (data) => { + console.log(data) + + // returns + // { + // token: "xxxx", + // refreshToken: "xxxx", + // } +}) +``` \ No newline at end of file diff --git a/docs/docs/comty-js/models/auth/logout.md b/docs/docs/comty-js/models/auth/logout.md new file mode 100644 index 00000000..01f405a4 --- /dev/null +++ b/docs/docs/comty-js/models/auth/logout.md @@ -0,0 +1,5 @@ +--- +sidebar_position: 2 +--- + +# Logout \ No newline at end of file diff --git a/docs/docs/comty-js/models/auth/register.md b/docs/docs/comty-js/models/auth/register.md new file mode 100644 index 00000000..b07263fb --- /dev/null +++ b/docs/docs/comty-js/models/auth/register.md @@ -0,0 +1,5 @@ +--- +sidebar_position: 3 +--- + +# Create a new Account \ No newline at end of file diff --git a/docs/docs/comty-js/models/auth/user-validation.md b/docs/docs/comty-js/models/auth/user-validation.md new file mode 100644 index 00000000..fe9296b8 --- /dev/null +++ b/docs/docs/comty-js/models/auth/user-validation.md @@ -0,0 +1,5 @@ +--- +sidebar_position: 4 +--- + +# Check if exist a username \ No newline at end of file diff --git a/docs/docs/comty-js/models/chats.md b/docs/docs/comty-js/models/chats.md new file mode 100644 index 00000000..f1a63201 --- /dev/null +++ b/docs/docs/comty-js/models/chats.md @@ -0,0 +1 @@ +# Chats \ No newline at end of file diff --git a/docs/docs/comty-js/models/feed.md b/docs/docs/comty-js/models/feed.md new file mode 100644 index 00000000..c53658a2 --- /dev/null +++ b/docs/docs/comty-js/models/feed.md @@ -0,0 +1 @@ +# Feed \ No newline at end of file diff --git a/docs/docs/comty-js/models/follows/_category_.json b/docs/docs/comty-js/models/follows/_category_.json new file mode 100644 index 00000000..8e5b2759 --- /dev/null +++ b/docs/docs/comty-js/models/follows/_category_.json @@ -0,0 +1,7 @@ +{ + "label": "Follows", + "position": 3, + "link": { + "type": "generated-index" + } +} diff --git a/docs/docs/comty-js/models/follows/im-following.md b/docs/docs/comty-js/models/follows/im-following.md new file mode 100644 index 00000000..23f95cd2 --- /dev/null +++ b/docs/docs/comty-js/models/follows/im-following.md @@ -0,0 +1,62 @@ +--- +sidebar_position: 1 +--- + +# Get followers +Retrieves the list of followers for a given user. + +
+
+```js +async function FollowsModel.getFollowers(user_id, fetchData) +``` + +### Arguments +| Parameter | Type | Optional | Default | Description | +| --- | --- | --- | --- | --- | +| user_id | String | false | | | +| fetchData | Boolean | true | false | If true, the response will contain an array of users data| +| limit | Number | true | 10 | Only if fetchData is true. Limit the number of followers to fetch | +| offset | Number | true | 0 | Only if fetchData is true. Offset the list of followers to fetch | + +
+ +### Success Response +| Parameter | Type | Content | +| --- | --- | --- | + +
+ +## Examples +### Basic usage +```js +const followers = await FollowsModel.getFollowers("0000") + +console.log(followers) + +// result: { +// count: 10 +// } +``` + +### Retrieve user data +```js +const followers = await FollowsModel.getFollowers("0000", true, 50, 0) + +console.log(followers) + +// result: { +// count: 10 +// list: [ +// { +// _id_: "0000", +// username: "comty", +// }, +// { +// _id_: "0001", +// username: "john", +// }, +// ... +// ] +// } +``` \ No newline at end of file diff --git a/docs/docs/comty-js/models/music.md b/docs/docs/comty-js/models/music.md new file mode 100644 index 00000000..3689238e --- /dev/null +++ b/docs/docs/comty-js/models/music.md @@ -0,0 +1 @@ +# Music \ No newline at end of file diff --git a/docs/docs/comty-js/models/nfc.md b/docs/docs/comty-js/models/nfc.md new file mode 100644 index 00000000..5db8200c --- /dev/null +++ b/docs/docs/comty-js/models/nfc.md @@ -0,0 +1 @@ +# NFC \ No newline at end of file diff --git a/docs/docs/comty-js/models/post/_category_.json b/docs/docs/comty-js/models/post/_category_.json new file mode 100644 index 00000000..a0ebfd79 --- /dev/null +++ b/docs/docs/comty-js/models/post/_category_.json @@ -0,0 +1,7 @@ +{ + "label": "Post", + "position": 2, + "link": { + "type": "generated-index" + } +} diff --git a/docs/docs/comty-js/models/post/create-post.md b/docs/docs/comty-js/models/post/create-post.md new file mode 100644 index 00000000..924616ec --- /dev/null +++ b/docs/docs/comty-js/models/post/create-post.md @@ -0,0 +1,91 @@ +--- +sidebar_position: 8 +--- + +# Create a post +Creates a new post with the given payload. + +
+
+```js +async function PostModel.create(payload) +``` + +### [Object] Payload +| Parameter | Type | Optional | Default | Description | +| --- | --- | --- | --- | --- | +| message | String | false | undefined | The message of the post | +| attachments | Array | true | [] | A list of attachments | +| timestamp | String | true | DateTime.local().toISO() | | +| reply_to | String | true | null | | + +
+ +### Success Response +| Parameter | Type | Content | +| --- | --- | --- | +| data | Object | [post-object](/docs/comty-js/definitions/post-object) | + +
+ +## Examples +### Basic usage +```js +const post = await PostModel.create({ + message: "Testing Comty.JS", + timestamp: new Date(), +}) + +console.log(post) + +// result: { +// _id_: "0000", +// message: "Testing Comty.JS", +// timestamp: "2024-01-01T17:00:00.000Z", +// } + +``` + +### Add attachments +```js +const post = await PostModel.create({ + message: "Look at this fox", + attachments: [ + { + url: "https://upload.wikimedia.org/wikipedia/commons/3/30/Vulpes_vulpes_ssp_fulvus.jpg", + } + ], +}) + +console.log(post) + +// result: { +// _id_: "0001", +// message: "Look at this fox", +// timestamp: "2024-01-01T17:00:00.000Z", +// attachments: [ +// { +// url: "https://upload.wikimedia.org/wikipedia/commons/3/30/Vulpes_vulpes_ssp_fulvus.jpg", +// } +// ] +// } + +``` + +### Reply to a post +```js +const post = await PostModel.create({ + reply_to: "0001", + message: "* pet pet *", +}) + +console.log(post) + +// result: { +// _id_: "0002", +// reply_to: "0001", +// message: "* pat pat*", +// timestamp: "2024-01-01T17:30:00.000Z", +// } + +``` \ No newline at end of file diff --git a/docs/docs/comty-js/models/post/delete-post.md b/docs/docs/comty-js/models/post/delete-post.md new file mode 100644 index 00000000..830cee63 --- /dev/null +++ b/docs/docs/comty-js/models/post/delete-post.md @@ -0,0 +1,45 @@ +--- +sidebar_position: 10 +--- + +# Delete a post +Delete a post with the given post ID. + +Only can delete your own posts. + +
+
+```js +async function PostModel.delete(payload) +``` + +### [Object] Payload +| Parameter | Type | Optional | Default | Description | +| --- | --- | --- | --- | --- | +| post_id | String | false | undefined | | + +
+ +### Success Response +| Parameter | Type | Content | +| --- | --- | --- | +| post_id | String | | +| deleted | Boolean | | + +
+ +## Examples +### Basic usage +```js +const post = await PostModel.delete({ + post_id: "0000", +}) + +console.log(post) + +// result: { +// post_id: "0000", +// deleted: true, +// } + +``` \ No newline at end of file diff --git a/docs/docs/comty-js/models/post/get-my-liked-posts.md b/docs/docs/comty-js/models/post/get-my-liked-posts.md new file mode 100644 index 00000000..e2746902 --- /dev/null +++ b/docs/docs/comty-js/models/post/get-my-liked-posts.md @@ -0,0 +1,45 @@ +--- +sidebar_position: 2 +--- + +# Get my liked posts +Retrieves the liked posts of current authed user. + +
+
+```js +async function PostModel.getLikedPosts(payload) +``` + +### [Object] Payload +| Parameter | Type | Optional | Default | Description | +| --- | --- | --- | --- | --- | +| trim | number | true | 0 | Trim the post index content | +| limit | number | true | 10 | Limit the number of posts to fetch | + +
+ +### Success Response +| Parameter | Type | Content | +| --- | --- | --- | +| data | Array | [[post_obj](/docs/comty-js/definitions/post-object), ...] | + +
+ +## Examples +### Basic usage +```js +const posts = await PostModel.getLikedPosts({ + trim: 0, + limit: 10, +}) + +console.log(posts) + +// result: [ +// { _id: "0000", user_id: "0000", message: "example text", ... }, +// { _id: "0001", user_id: "0000", message: "example text", ... }, +// ... +// ] + +``` \ No newline at end of file diff --git a/docs/docs/comty-js/models/post/get-post-data.md b/docs/docs/comty-js/models/post/get-post-data.md new file mode 100644 index 00000000..3d3e35e1 --- /dev/null +++ b/docs/docs/comty-js/models/post/get-post-data.md @@ -0,0 +1,44 @@ +--- +sidebar_position: 4 +--- + +# Get post data +Retrieves the data of a post. + +
+
+```js +async function PostModel.post(payload) +``` + +### [Object] Payload +| Parameter | Type | Optional | Default | Description | +| --- | --- | --- | --- | --- | +| post_id | string | false | | Defines the ID of the post to retrieve.| + +
+ +### Success Response +| Parameter | Type | Content | +| --- | --- | --- | +| data | object | [post_obj](/docs/comty-js/definitions/post-object) | + +
+ +## Examples +### Basic usage +```js +const post = await PostModel.post({ + post_id: "0000", +}) + +console.log(post) + +// result: { +// _id: "0000", +// user_id: "0000", +// message: "example text", +// ... +// } + +``` \ No newline at end of file diff --git a/docs/docs/comty-js/models/post/get-post-replies.md b/docs/docs/comty-js/models/post/get-post-replies.md new file mode 100644 index 00000000..342b728b --- /dev/null +++ b/docs/docs/comty-js/models/post/get-post-replies.md @@ -0,0 +1,47 @@ +--- +sidebar_position: 5 +--- + +# Get post replies +Retrieves replies of a post. + +
+
+```js +async function PostModel.replies(payload) +``` + +### [Object] Payload +| Parameter | Type | Optional | Default | Description | +| --- | --- | --- | --- | --- | +| post_id | string | false | | | +| trim | number | true | 0 | Trim the post index content | +| limit | number | true | 10 | Limit the number of posts to fetch | + +
+ +### Success Response +| Parameter | Type | Content | +| --- | --- | --- | +| data | Array | [[post_obj](/docs/comty-js/definitions/post-object), ...] | + +
+ +## Examples +### Basic usage +```js +const posts = await PostModel.replies({ + post_id: "0000", + trim: 0, + limit: 10, +}) + +console.log(posts) + +// result: [ +// { _id: "0000", user_id: "0000", message: "example text", ... }, +// { _id: "0001", user_id: "0000", message: "example text", ... }, +// ... +// ] + +``` \ No newline at end of file diff --git a/docs/docs/comty-js/models/post/get-saved-posts.md b/docs/docs/comty-js/models/post/get-saved-posts.md new file mode 100644 index 00000000..b8d4265a --- /dev/null +++ b/docs/docs/comty-js/models/post/get-saved-posts.md @@ -0,0 +1,45 @@ +--- +sidebar_position: 3 +--- + +# Get my saved posts +Retrieves the saved posts of current authed user. + +
+
+```js +async function PostModel.getSavedPosts(payload) +``` + +### [Object] Payload +| Parameter | Type | Optional | Default | Description | +| --- | --- | --- | --- | --- | +| trim | number | true | 0 | Trim the post index content | +| limit | number | true | 10 | Limit the number of posts to fetch | + +
+ +### Success Response +| Parameter | Type | Content | +| --- | --- | --- | +| data | Array | [[post_obj](/docs/comty-js/definitions/post-object), ...] | + +
+ +## Examples +### Basic usage +```js +const posts = await PostModel.getSavedPosts({ + trim: 0, + limit: 10, +}) + +console.log(posts) + +// result: [ +// { _id: "0000", user_id: "0000", message: "example text", ... }, +// { _id: "0001", user_id: "0000", message: "example text", ... }, +// ... +// ] + +``` \ No newline at end of file diff --git a/docs/docs/comty-js/models/post/get-user-posts.md b/docs/docs/comty-js/models/post/get-user-posts.md new file mode 100644 index 00000000..c244bb3b --- /dev/null +++ b/docs/docs/comty-js/models/post/get-user-posts.md @@ -0,0 +1,47 @@ +--- +sidebar_position: 1 +--- + +# Get user posts +Retrieves the public posts of a user. + +
+
+```js +async function PostModel.getUserPosts(payload) +``` + +### [Object] Payload +| Parameter | Type | Optional | Default | Description | +| --- | --- | --- | --- | --- | +| user_id | string | false | | | +| trim | number | true | 0 | Trim the post index content | +| limit | number | true | 10 | Limit the number of posts to fetch | + +
+ +### Success Response +| Parameter | Type | Content | +| --- | --- | --- | +| data | Array | [[post_obj](/docs/comty-js/definitions/post-object), ...] | + +
+ +## Examples +### Basic usage +```js +const posts = await PostModel.getUserPosts({ + user_id: "0000", + trim: 0, + limit: 10, +}) + +console.log(posts) + +// result: [ +// { _id: "0000", user_id: "0000", message: "example text", ... }, +// { _id: "0001", user_id: "0000", message: "example text", ... }, +// ... +// ] + +``` \ No newline at end of file diff --git a/docs/docs/comty-js/models/post/toggle-like.md b/docs/docs/comty-js/models/post/toggle-like.md new file mode 100644 index 00000000..db9567c5 --- /dev/null +++ b/docs/docs/comty-js/models/post/toggle-like.md @@ -0,0 +1,60 @@ +--- +sidebar_position: 6 +--- + +# Toggle post like +Toggles the like status of a post. + +
+
+```js +async function PostModel.toggleLike(payload) +``` + +### [Object] Payload +| Parameter | Type | Optional | Default | Description | +| --- | --- | --- | --- | --- | +| post_id | string | false | | | +| to | Boolean | true | | Set like to true or false | + +
+ +### Success Response +| Parameter | Type | Content | +| --- | --- | --- | +| data | Object | [like-status-object](/docs/comty-js/definitions/like-status-object) | + +
+ +## Examples +### Basic usage +```js +const like = await PostModel.toggleLike({ + post_id: "0000", +}) + +console.log(like) + +// result: { +// post_id: "0000", +// liked: true, +// count: 1, +// } + +``` +### Specify status +```js +const like = await PostModel.toggleLike({ + post_id: "0000", + to: false +}) + +console.log(like) + +// result: { +// post_id: "0000", +// liked: false, +// count: 0, +// } + +``` \ No newline at end of file diff --git a/docs/docs/comty-js/models/post/toggle-save.md b/docs/docs/comty-js/models/post/toggle-save.md new file mode 100644 index 00000000..b9a8d1ce --- /dev/null +++ b/docs/docs/comty-js/models/post/toggle-save.md @@ -0,0 +1,60 @@ +--- +sidebar_position: 7 +--- + +# Toggle post save +Toggles the save status of a post. + +
+
+```js +async function PostModel.toggleSave(payload) +``` + +### [Object] Payload +| Parameter | Type | Optional | Default | Description | +| --- | --- | --- | --- | --- | +| post_id | string | false | | | +| to | Boolean | true | | Set save to true or false | + +
+ +### Success Response +| Parameter | Type | Content | +| --- | --- | --- | +| data | Object | [save-status-object](/docs/comty-js/definitions/save-status-object) | + +
+ +## Examples +### Basic usage +```js +const save = await PostModel.toggleSave({ + post_id: "0000", +}) + +console.log(save) + +// result: { +// post_id: "0000", +// saved: true, +// count: 1, +// } + +``` +### Specify status +```js +const save = await PostModel.toggleSave({ + post_id: "0000", + to: false +}) + +console.log(save) + +// result: { +// post_id: "0000", +// saved: false, +// count: 0, +// } + +``` \ No newline at end of file diff --git a/docs/docs/comty-js/models/post/update-post.md b/docs/docs/comty-js/models/post/update-post.md new file mode 100644 index 00000000..e674de36 --- /dev/null +++ b/docs/docs/comty-js/models/post/update-post.md @@ -0,0 +1,76 @@ +--- +sidebar_position: 9 +--- + +# Update a post +Updates a post with the given post ID and update payload. + +Only can update your own posts. + +
+
+```js +async function PostModel.update(post_id, payload) +``` + +### [String] post_id +Defines the ID of the post to update. + +### [Object] Payload +| Parameter | Type | Optional | Default | Description | +| --- | --- | --- | --- | --- | +| message | String | false | undefined | The message of the post | +| attachments | Array | true | [] | A list of attachments | + +
+ +### Success Response +| Parameter | Type | Content | +| --- | --- | --- | +| data | Object | [post-object](/docs/comty-js/definitions/post-object) | + +
+ +## Examples +### Basic usage +```js +const post = await PostModel.update({ + post_id: "0000", + message: "Updated message", +}) + +console.log(post) + +// result: { +// _id_: "0000", +// message: "Updated message", +// timestamp: "2024-01-01T17:00:00.000Z", +// } + +``` + +### Modify or remove attachments +```js +const post = await PostModel.update({ + post_id: "0000", + attachments: [ + { + url: "https://upload.wikimedia.org/wikipedia/commons/3/30/Vulpes_vulpes_ssp_fulvus.jpg", + } + ], +}) + +console.log(post) + +// result: { +// _id_: "0000", +// message: "Updated message", +// timestamp: "2024-01-01T17:00:00.000Z", +// attachments: [ +// { +// url: "https://upload.wikimedia.org/wikipedia/commons/3/30/Vulpes_vulpes_ssp_fulvus.jpg", +// } +// ] +// } + +``` \ No newline at end of file diff --git a/docs/docs/comty-js/models/search.md b/docs/docs/comty-js/models/search.md new file mode 100644 index 00000000..6aaea9fe --- /dev/null +++ b/docs/docs/comty-js/models/search.md @@ -0,0 +1 @@ +# Search \ No newline at end of file diff --git a/docs/docs/comty-js/models/session.md b/docs/docs/comty-js/models/session.md new file mode 100644 index 00000000..1abcb971 --- /dev/null +++ b/docs/docs/comty-js/models/session.md @@ -0,0 +1 @@ +# Session \ No newline at end of file diff --git a/docs/docs/comty-js/models/user.md b/docs/docs/comty-js/models/user.md new file mode 100644 index 00000000..80fd4137 --- /dev/null +++ b/docs/docs/comty-js/models/user.md @@ -0,0 +1 @@ +# User \ No newline at end of file diff --git a/docs/docs/spectrum-api/_category_.json b/docs/docs/spectrum-api/_category_.json new file mode 100644 index 00000000..6ab5187c --- /dev/null +++ b/docs/docs/spectrum-api/_category_.json @@ -0,0 +1,7 @@ +{ + "label": "Spectrum™ API", + "position": 4, + "link": { + "type": "generated-index" + } +} diff --git a/docs/docs/spectrum-api/getting-started.md b/docs/docs/spectrum-api/getting-started.md new file mode 100644 index 00000000..a736f04d --- /dev/null +++ b/docs/docs/spectrum-api/getting-started.md @@ -0,0 +1,6 @@ +--- +sidebar_position: 1 +--- + +# Getting Started +Me pica el splungus \ No newline at end of file diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js new file mode 100644 index 00000000..bb89c927 --- /dev/null +++ b/docs/docusaurus.config.js @@ -0,0 +1,114 @@ +// @ts-check +// `@type` JSDoc annotations allow editor autocompletion and type checking +// (when paired with `@ts-check`). +// There are various equivalent ways to declare your Docusaurus config. +// See: https://docusaurus.io/docs/api/docusaurus-config + +import { themes as prismThemes } from "prism-react-renderer" + +/** @type {import("@docusaurus/types").Config} */ +const config = { + title: "Comty Documentation", + tagline: "The place for developers", + favicon: "img/favicon.ico", + + // Set the production url of your site here + url: "https://comty.app", + // Set the // pathname under which your site is served + // For GitHub pages deployment, it is often "//" + baseUrl: "/", + + // GitHub pages deployment config. + // If you aren"t using GitHub pages, you don"t need these. + organizationName: "ragestudio", // Usually your GitHub org/user name. + projectName: "comty", // Usually your repo name. + + onBrokenLinks: "throw", + onBrokenMarkdownLinks: "warn", + + // Even if you don"t use internationalization, you can use this field to set + // useful metadata like html lang. For example, if your site is Chinese, you + // may want to replace "en" with "zh-Hans". + i18n: { + defaultLocale: "en", + locales: ["en"], + }, + + presets: [ + [ + "classic", + /** @type {import("@docusaurus/preset-classic").Options} */ + ({ + docs: { + sidebarPath: "./sidebars.js", + //editUrl: "https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/", + }, + theme: { + customCss: "./src/css/custom.css", + }, + }), + ], + ], + + themeConfig: + /** @type {import("@docusaurus/preset-classic").ThemeConfig} */ + ({ + // Replace with your project"s social card + image: "img/docusaurus-social-card.jpg", + navbar: { + title: "Comty Developers", + logo: { + alt: "Comty Logo", + src: "https://storage.ragestudio.net/rstudio/branding/comty/iso/logo_alt.svg", + }, + items: [ + { + type: "docSidebar", + sidebarId: "docs", + position: "left", + label: "Docs", + }, + { + type: "docSidebar", + sidebarId: "legal", + position: "left", + label: "Legal", + }, + { + href: "https://github.com/ragestudio/comty", + label: "GitHub", + position: "right", + }, + ], + }, + footer: { + style: "dark", + links: [ + { + title: "Community", + items: [ + { + label: "Discord", + href: "https://discordapp.com/invite/docusaurus", + }, + { + label: "GitHub", + href: "https://github.com/ragestudio/comty", + }, + { + label: "Comty", + href: "https://comty.app/@ragestudio", + } + ], + }, + ], + copyright: `Copyright © ${new Date().getFullYear()} RageStudio. Built with Docusaurus.`, + }, + prism: { + theme: prismThemes.github, + darkTheme: prismThemes.dracula, + }, + }), +} + +export default config diff --git a/docs/legal/tos.md b/docs/legal/tos.md new file mode 100644 index 00000000..d33889c5 --- /dev/null +++ b/docs/legal/tos.md @@ -0,0 +1 @@ +# Meet or TOS \ No newline at end of file diff --git a/docs/package.json b/docs/package.json new file mode 100644 index 00000000..9869ecb8 --- /dev/null +++ b/docs/package.json @@ -0,0 +1,45 @@ +{ + "name": "docs", + "version": "0.0.0", + "private": true, + "scripts": { + "docusaurus": "docusaurus", + "start": "docusaurus start", + "build": "docusaurus build", + "swizzle": "docusaurus swizzle", + "deploy": "docusaurus deploy", + "clear": "docusaurus clear", + "serve": "docusaurus serve", + "write-translations": "docusaurus write-translations", + "write-heading-ids": "docusaurus write-heading-ids" + }, + "dependencies": { + "@docusaurus/core": "3.5.2", + "@docusaurus/preset-classic": "3.5.2", + "@mdx-js/react": "^3.0.0", + "clsx": "^2.0.0", + "prism-react-renderer": "^2.3.0", + "react": "^18.0.0", + "react-dom": "^18.0.0" + }, + "devDependencies": { + "@docusaurus/module-type-aliases": "3.5.2", + "@docusaurus/types": "3.5.2", + "jsdoc-to-mdx": "^1.2.1" + }, + "browserslist": { + "production": [ + ">0.5%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 3 chrome version", + "last 3 firefox version", + "last 5 safari version" + ] + }, + "engines": { + "node": ">=18.0" + } +} diff --git a/docs/sidebars.js b/docs/sidebars.js new file mode 100644 index 00000000..02a5810c --- /dev/null +++ b/docs/sidebars.js @@ -0,0 +1,21 @@ +/** + * Creating a sidebar enables you to: + - create an ordered group of docs + - render a sidebar for each doc of that group + - provide next/previous navigation + + The sidebars can be generated from the filesystem, or explicitly defined here. + + Create as many sidebars as you want. + */ + +// @ts-check + +/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */ +const sidebars = { + // By default, Docusaurus generates a sidebar from the docs folder structure + docs: [{type: 'autogenerated', dirName: '.'}], + legal: [{type: 'autogenerated', dirName: '.'}], +} + +export default sidebars; diff --git a/docs/src/components/HomepageFeatures/index.js b/docs/src/components/HomepageFeatures/index.js new file mode 100644 index 00000000..acc76219 --- /dev/null +++ b/docs/src/components/HomepageFeatures/index.js @@ -0,0 +1,64 @@ +import clsx from 'clsx'; +import Heading from '@theme/Heading'; +import styles from './styles.module.css'; + +const FeatureList = [ + { + title: 'Easy to Use', + Svg: require('@site/static/img/undraw_docusaurus_mountain.svg').default, + description: ( + <> + Docusaurus was designed from the ground up to be easily installed and + used to get your website up and running quickly. + + ), + }, + { + title: 'Focus on What Matters', + Svg: require('@site/static/img/undraw_docusaurus_tree.svg').default, + description: ( + <> + Docusaurus lets you focus on your docs, and we'll do the chores. Go + ahead and move your docs into the docs directory. + + ), + }, + { + title: 'Powered by React', + Svg: require('@site/static/img/undraw_docusaurus_react.svg').default, + description: ( + <> + Extend or customize your website layout by reusing React. Docusaurus can + be extended while reusing the same header and footer. + + ), + }, +]; + +function Feature({Svg, title, description}) { + return ( +
+
+ +
+
+ {title} +

{description}

+
+
+ ); +} + +export default function HomepageFeatures() { + return ( +
+
+
+ {FeatureList.map((props, idx) => ( + + ))} +
+
+
+ ); +} diff --git a/docs/src/components/HomepageFeatures/styles.module.css b/docs/src/components/HomepageFeatures/styles.module.css new file mode 100644 index 00000000..b248eb2e --- /dev/null +++ b/docs/src/components/HomepageFeatures/styles.module.css @@ -0,0 +1,11 @@ +.features { + display: flex; + align-items: center; + padding: 2rem 0; + width: 100%; +} + +.featureSvg { + height: 200px; + width: 200px; +} diff --git a/docs/src/css/custom.css b/docs/src/css/custom.css new file mode 100644 index 00000000..4b946e3a --- /dev/null +++ b/docs/src/css/custom.css @@ -0,0 +1,40 @@ +/** + * Any CSS included here will be global. The classic template + * bundles Infima by default. Infima is a CSS framework designed to + * work well for content-centric websites. + */ + +/* You can override the default Infima variables here. */ +:root { + --ifm-color-primary: #ff6064; + --ifm-color-primary-dark: #ff60644c; + --ifm-color-primary-darker: #ff6064; + --ifm-color-primary-darkest: #ff6064; + --ifm-color-primary-light: #ff6064; + --ifm-color-primary-lighter: #ff6064; + --ifm-color-primary-lightest: #ff6064; + --ifm-code-font-size: 95%; + --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1); +} + +/* For readability concerns, you should choose a lighter palette in dark mode. */ +[data-theme='dark'] { + --ifm-color-primary: #ff6064; + --ifm-color-primary-dark: #ff6064; + --ifm-color-primary-darker: #ff6064; + --ifm-color-primary-darkest: #ff6064; + --ifm-color-primary-light: #ff6064; + --ifm-color-primary-lighter: #ff6064; + --ifm-color-primary-lightest: #ff6064; + --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3); +} + + +.divider { + width: 100%; + height: 2px; + + border-radius: 12px; + + background-color: #E5E5E5; +} \ No newline at end of file diff --git a/docs/src/pages/index.js b/docs/src/pages/index.js new file mode 100644 index 00000000..4ae8b97d --- /dev/null +++ b/docs/src/pages/index.js @@ -0,0 +1,32 @@ +import clsx from "clsx" +import Link from "@docusaurus/Link" +import useDocusaurusContext from "@docusaurus/useDocusaurusContext" +import Layout from "@theme/Layout" +import HomepageFeatures from "@site/src/components/HomepageFeatures" + +import Heading from "@theme/Heading" +import styles from "./index.module.css" + +function HomepageHeader() { + const { siteConfig } = useDocusaurusContext() + + return
+
+ + {siteConfig.title} + + +

{siteConfig.tagline}

+
+
+} + +export default function Home() { + return + + +
+ +
+
+} diff --git a/docs/src/pages/index.module.css b/docs/src/pages/index.module.css new file mode 100644 index 00000000..9f71a5da --- /dev/null +++ b/docs/src/pages/index.module.css @@ -0,0 +1,23 @@ +/** + * CSS files with the .module.css suffix will be treated as CSS modules + * and scoped locally. + */ + +.heroBanner { + padding: 4rem 0; + text-align: center; + position: relative; + overflow: hidden; +} + +@media screen and (max-width: 996px) { + .heroBanner { + padding: 2rem; + } +} + +.buttons { + display: flex; + align-items: center; + justify-content: center; +} diff --git a/docs/src/pages/markdown-page.md b/docs/src/pages/markdown-page.md new file mode 100644 index 00000000..9756c5b6 --- /dev/null +++ b/docs/src/pages/markdown-page.md @@ -0,0 +1,7 @@ +--- +title: Markdown page example +--- + +# Markdown page example + +You don't need React to write simple standalone pages. diff --git a/docs/static/.nojekyll b/docs/static/.nojekyll new file mode 100644 index 00000000..e69de29b diff --git a/docs/static/img/docusaurus-social-card.jpg b/docs/static/img/docusaurus-social-card.jpg new file mode 100644 index 00000000..ffcb4482 Binary files /dev/null and b/docs/static/img/docusaurus-social-card.jpg differ diff --git a/docs/static/img/docusaurus.png b/docs/static/img/docusaurus.png new file mode 100644 index 00000000..f458149e Binary files /dev/null and b/docs/static/img/docusaurus.png differ diff --git a/docs/static/img/favicon.ico b/docs/static/img/favicon.ico new file mode 100755 index 00000000..2156b823 Binary files /dev/null and b/docs/static/img/favicon.ico differ diff --git a/docs/static/img/logo.svg b/docs/static/img/logo.svg new file mode 100644 index 00000000..9db6d0d0 --- /dev/null +++ b/docs/static/img/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/static/img/undraw_docusaurus_mountain.svg b/docs/static/img/undraw_docusaurus_mountain.svg new file mode 100644 index 00000000..af961c49 --- /dev/null +++ b/docs/static/img/undraw_docusaurus_mountain.svg @@ -0,0 +1,171 @@ + + Easy to Use + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/static/img/undraw_docusaurus_react.svg b/docs/static/img/undraw_docusaurus_react.svg new file mode 100644 index 00000000..94b5cf08 --- /dev/null +++ b/docs/static/img/undraw_docusaurus_react.svg @@ -0,0 +1,170 @@ + + Powered by React + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/static/img/undraw_docusaurus_tree.svg b/docs/static/img/undraw_docusaurus_tree.svg new file mode 100644 index 00000000..d9161d33 --- /dev/null +++ b/docs/static/img/undraw_docusaurus_tree.svg @@ -0,0 +1,40 @@ + + Focus on What Matters + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +