Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions docs/capabilities/creating_custom_post.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ await reddit.submitCustomPost({
"backgroundColor": "#FFFFFFFF", // white, fully opaque
"backgroundColorDark": "#000000FF", // black, fully opaque
"height": "TALL",
"shareImageUrl": "https://reddi.it/12345.png"
"shareImageUrl": "https://i.redd.it/o0h58lzmax6a1.png"
}
})
```
Expand All @@ -90,9 +90,7 @@ Use `post.setCustomPostStyles()` to update styles on an existing post. Only inc
```javascript
const post = await reddit.getPostById(context.postId);
await post.setCustomPostStyles({
"styles": {
"shareImageUrl": "https://example.com/new-preview.png"
}
"shareImageUrl": "https://i.redd.it/o0h58lzmax6a1.png"
});
```

Expand Down
11 changes: 3 additions & 8 deletions docs/capabilities/server/reddit-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,11 @@ Auto-comments should be used to spark conversation in the post comments, but you


```ts
import { context, reddit } from '@devvit/web/server';
import { reddit } from '@devvit/web/server';

export const createComment = async () => {
const { subredditName } = context;
if (!subredditName) {
throw new Error('subredditName is required');
}

reddit.submitComment({
postId: 't3_123456', // Replace with the actual post ID
return await reddit.submitComment({
id: 't3_123456', // Replace with the actual post ID
text: 'This is a comment from a Devvit app',
runAs: 'USER' // Optional: specify the user to run as
});
Expand Down
10 changes: 5 additions & 5 deletions docs/capabilities/server/userActions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ If `runAs` is not specified, the API will use `runAs: 'APP'` by default.
| Parameter | Description |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| `runAs` | The type of account to perform the action on behalf of: `'USER'` or `'APP'`. Defaults to `'APP'`. |
| `userGeneratedContent` | Text or images submitted by the user. Required for `submitPost()` with `runAs: 'USER'` for safety and compliance review. |
| `userGeneratedContent` | Text or images submitted by the user. Required for `submitCustomPost()` with `runAs: 'USER'` for safety and compliance review. |

### Differences during playtesting

Expand All @@ -96,7 +96,7 @@ Your app version needs to be approved in order for user actions to be enabled fo
<TabItem value="hono">

```tsx title="server/index.ts"
import { reddit } from '@devvit/web/server';
import { context, reddit } from '@devvit/web/server';

// ...

Expand All @@ -106,7 +106,7 @@ app.post('/internal/post-create', async (c) => {
return c.json({ status: 'error', message: 'subredditName is required' }, 400);
}

reddit.submitPost({
await reddit.submitCustomPost({
runAs: 'USER',
userGeneratedContent: {
text: "Hello there! This is a new post from the user's account",
Expand All @@ -124,7 +124,7 @@ app.post('/internal/post-create', async (c) => {
<TabItem value="express">

```tsx title="server/index.ts"
import { reddit } from '@devvit/web/server';
import { context, reddit } from '@devvit/web/server';

// ...

Expand All @@ -135,7 +135,7 @@ router.post('/internal/post-create', async (_req, res) => {
return;
}

reddit.submitPost({
await reddit.submitCustomPost({
runAs: 'USER',
userGeneratedContent: {
text: "Hello there! This is a new post from the user's account",
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/migrate/public-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ const { postId } = context;
if (!postId) throw new Error("Run on a post.");

const pinned = await reddit.submitComment({
postId,
id: postId,
text: "Pinned notice.",
runAs: "APP",
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ await reddit.submitCustomPost({
"backgroundColor": "#FFFFFFFF", // white, fully opaque
"backgroundColorDark": "#000000FF", // black, fully opaque
"height": "TALL",
"shareImageUrl": "https://reddi.it/12345.png"
"shareImageUrl": "https://i.redd.it/o0h58lzmax6a1.png"
}
})
```
Expand All @@ -90,9 +90,7 @@ Use `post.setCustomPostStyles()` to update styles on an existing post. Only inc
```javascript
const post = await reddit.getPostById(context.postId);
await post.setCustomPostStyles({
"styles": {
"shareImageUrl": "https://example.com/new-preview.png"
}
"shareImageUrl": "https://i.redd.it/o0h58lzmax6a1.png"
});
```

Expand Down
11 changes: 3 additions & 8 deletions versioned_docs/version-0.12/capabilities/server/reddit-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,11 @@ Auto-comments should be used to spark conversation in the post comments, but you


```ts
import { context, reddit } from '@devvit/web/server';
import { reddit } from '@devvit/web/server';

export const createComment = async () => {
const { subredditName } = context;
if (!subredditName) {
throw new Error('subredditName is required');
}

reddit.submitComment({
postId: 't3_123456', // Replace with the actual post ID
return await reddit.submitComment({
id: 't3_123456', // Replace with the actual post ID
text: 'This is a comment from a Devvit app',
runAs: 'USER' // Optional: specify the user to run as
});
Expand Down
10 changes: 5 additions & 5 deletions versioned_docs/version-0.12/capabilities/server/userActions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ If `runAs` is not specified, the API will use `runAs: 'APP'` by default.
| Parameter | Description |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| `runAs` | The type of account to perform the action on behalf of: `'USER'` or `'APP'`. Defaults to `'APP'`. |
| `userGeneratedContent` | Text or images submitted by the user. Required for `submitPost()` with `runAs: 'USER'` for safety and compliance review. |
| `userGeneratedContent` | Text or images submitted by the user. Required for `submitCustomPost()` with `runAs: 'USER'` for safety and compliance review. |

### Differences during playtesting

Expand All @@ -96,7 +96,7 @@ Your app version needs to be approved in order for user actions to be enabled fo
<TabItem value="hono">

```tsx title="server/index.ts"
import { reddit } from '@devvit/web/server';
import { context, reddit } from '@devvit/web/server';

// ...

Expand All @@ -106,7 +106,7 @@ app.post('/internal/post-create', async (c) => {
return c.json({ status: 'error', message: 'subredditName is required' }, 400);
}

reddit.submitPost({
await reddit.submitCustomPost({
runAs: 'USER',
userGeneratedContent: {
text: "Hello there! This is a new post from the user's account",
Expand All @@ -124,7 +124,7 @@ app.post('/internal/post-create', async (c) => {
<TabItem value="express">

```tsx title="server/index.ts"
import { reddit } from '@devvit/web/server';
import { context, reddit } from '@devvit/web/server';

// ...

Expand All @@ -135,7 +135,7 @@ router.post('/internal/post-create', async (_req, res) => {
return;
}

reddit.submitPost({
await reddit.submitCustomPost({
runAs: 'USER',
userGeneratedContent: {
text: "Hello there! This is a new post from the user's account",
Expand Down
2 changes: 1 addition & 1 deletion versioned_docs/version-0.12/guides/migrate/public-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ const { postId } = context;
if (!postId) throw new Error("Run on a post.");

const pinned = await reddit.submitComment({
postId,
id: postId,
text: "Pinned notice.",
runAs: "APP",
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ await reddit.submitCustomPost({
"backgroundColor": "#FFFFFFFF", // white, fully opaque
"backgroundColorDark": "#000000FF", // black, fully opaque
"height": "TALL",
"shareImageUrl": "https://reddi.it/12345.png"
"shareImageUrl": "https://i.redd.it/o0h58lzmax6a1.png"
}
})
```
Expand All @@ -90,9 +90,7 @@ Use `post.setCustomPostStyles()` to update styles on an existing post. Only inc
```javascript
const post = await reddit.getPostById(context.postId);
await post.setCustomPostStyles({
"styles": {
"shareImageUrl": "https://example.com/new-preview.png"
}
"shareImageUrl": "https://i.redd.it/o0h58lzmax6a1.png"
});
```

Expand Down
11 changes: 3 additions & 8 deletions versioned_docs/version-0.13/capabilities/server/reddit-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,11 @@ Auto-comments should be used to spark conversation in the post comments, but you


```ts
import { context, reddit } from '@devvit/web/server';
import { reddit } from '@devvit/web/server';

export const createComment = async () => {
const { subredditName } = context;
if (!subredditName) {
throw new Error('subredditName is required');
}

reddit.submitComment({
postId: 't3_123456', // Replace with the actual post ID
return await reddit.submitComment({
id: 't3_123456', // Replace with the actual post ID
text: 'This is a comment from a Devvit app',
runAs: 'USER' // Optional: specify the user to run as
});
Expand Down
10 changes: 5 additions & 5 deletions versioned_docs/version-0.13/capabilities/server/userActions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ If `runAs` is not specified, the API will use `runAs: 'APP'` by default.
| Parameter | Description |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| `runAs` | The type of account to perform the action on behalf of: `'USER'` or `'APP'`. Defaults to `'APP'`. |
| `userGeneratedContent` | Text or images submitted by the user. Required for `submitPost()` with `runAs: 'USER'` for safety and compliance review. |
| `userGeneratedContent` | Text or images submitted by the user. Required for `submitCustomPost()` with `runAs: 'USER'` for safety and compliance review. |

### Differences during playtesting

Expand All @@ -96,7 +96,7 @@ Your app version needs to be approved in order for user actions to be enabled fo
<TabItem value="hono">

```tsx title="server/index.ts"
import { reddit } from '@devvit/web/server';
import { context, reddit } from '@devvit/web/server';

// ...

Expand All @@ -106,7 +106,7 @@ app.post('/internal/post-create', async (c) => {
return c.json({ status: 'error', message: 'subredditName is required' }, 400);
}

reddit.submitPost({
await reddit.submitCustomPost({
runAs: 'USER',
userGeneratedContent: {
text: "Hello there! This is a new post from the user's account",
Expand All @@ -124,7 +124,7 @@ app.post('/internal/post-create', async (c) => {
<TabItem value="express">

```tsx title="server/index.ts"
import { reddit } from '@devvit/web/server';
import { context, reddit } from '@devvit/web/server';

// ...

Expand All @@ -135,7 +135,7 @@ router.post('/internal/post-create', async (_req, res) => {
return;
}

reddit.submitPost({
await reddit.submitCustomPost({
runAs: 'USER',
userGeneratedContent: {
text: "Hello there! This is a new post from the user's account",
Expand Down
2 changes: 1 addition & 1 deletion versioned_docs/version-0.13/guides/migrate/public-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ const { postId } = context;
if (!postId) throw new Error("Run on a post.");

const pinned = await reddit.submitComment({
postId,
id: postId,
text: "Pinned notice.",
runAs: "APP",
});
Expand Down
Loading