Skip to content
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI

# Runs on PRs and pushes to the default branch. We use `pull_request` (never
# `pull_request_target`), so secrets are NOT exposed to pull requests from forks.
on:
pull_request:
push:
branches: [main, master]

permissions:
contents: read

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
# Run the core module's tests from the repo root (multi-module settings.gradle) so the
# generated client builds as a dependency and the hand-written SSO unit + integration
# tests run. Running from inside core/ resolves to the wrong (client) project.
- name: Run tests
run: |
chmod +x core/gradlew
./core/gradlew :core:test --no-daemon
env:
FASTCOMMENTS_API_KEY: ${{ secrets.FASTCOMMENTS_API_KEY }}
FASTCOMMENTS_TENANT_ID: ${{ secrets.FASTCOMMENTS_TENANT_ID }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@ gradle-app.setting
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath
# Eclipse Buildship (Gradle) project settings
.settings/

.idea
openapi-generator-cli.jar
29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,14 @@ to make working with the API easier, and the `pubsub` module which is a library

### Public vs Secured APIs

For the API client, there are two classes, `DefaultApi` and `PublicApi`. The `DefaultApi` contains methods that require your API key, and `PublicApi` contains api calls
For the API client, there are three classes, `DefaultApi`, `PublicApi`, and `ModerationApi`. The `DefaultApi` contains methods that require your API key, and `PublicApi` contains methods
that can be made directly from a browser/mobile device/etc without authentication.

The `ModerationApi` powers the moderator dashboard. It contains methods for comment moderation (list, count, search, logs, and export), moderation actions (remove/restore,
flag, set review/spam/approval status, votes, and reopen/close thread), bans (ban from comment, undo a ban, pre-ban summaries, ban status and preferences, and banned-user counts),
and badges & trust (award/remove a badge, manual badges, get/set trust factor, and user internal profile). Every `ModerationApi` method accepts an `sso` parameter so the call can be
performed on behalf of an SSO-authenticated moderator.

## Quick Start

### Using Authenticated APIs (DefaultApi)
Expand Down Expand Up @@ -146,6 +151,28 @@ try {
}
```

### Using Moderation APIs (ModerationApi)

The `ModerationApi` drives the moderator dashboard. Each method accepts an `sso` parameter identifying the SSO-authenticated moderator on whose behalf the request is made:

```java
import com.fastcomments.api.ModerationApi;
import com.fastcomments.invoker.ApiException;
import com.fastcomments.model.*;

ModerationApi moderationApi = new ModerationApi();

try {
// List comments awaiting moderation
ModerationAPIGetCommentsResponse response = moderationApi.getApiComments()
.sso("YOUR_SSO_TOKEN")
.execute();
System.out.println(response);
} catch (ApiException e) {
e.printStackTrace();
}
```

### Common Issues

1. **401 "missing-api-key" error**: Make sure you call `apiClient.setApiKey("YOUR_KEY")` before creating the DefaultApi instance.
Expand Down
Loading
Loading