Skip to content

Add Project API moderation and meta support#43

Merged
alxgsv merged 1 commit into
masterfrom
project-api-2026-04-updates
May 27, 2026
Merged

Add Project API moderation and meta support#43
alxgsv merged 1 commit into
masterfrom
project-api-2026-04-updates

Conversation

@alxgsv

@alxgsv alxgsv commented May 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Update Project API feature structs for the April 2026 schema, including the mime_type_filtering.is_enabled rename and new billing-related feature fields.
  • Add moderation threshold endpoints with separate request and response threshold types so server-owned timestamps are not sent in PUT requests.
  • Add Project API meta endpoints for MIME types and moderation categories.

Validation

  • go test ./projectapi
  • go list ./... | grep -v '/test$' | xargs go test

Note: the full go test ./... still requires integration credentials for the test package (SECRET_KEY and PUBLIC_KEY).

Summary by CodeRabbit

  • New Features

    • Added moderation thresholds management (get/set) for projects
    • Added APIs to list supported MIME types and moderation categories
    • Expanded project features with new toggles: GIF→video conversion, malware protection, SVG validation, unsafe content detection, adaptive bitrate streaming, document conversion, EXIF metadata removal
  • Tests

    • Added coverage for project feature JSON, moderation thresholds, meta endpoints, and path validation
  • Chores

    • Updated changelog to reflect expanded Project API capabilities

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 20, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2f5ae802-c47a-40d5-bc14-94b712d0065a

📥 Commits

Reviewing files that changed from the base of the PR and between f7a067a and 14bce1e.

📒 Files selected for processing (6)
  • CHANGELOG.md
  • projectapi/meta.go
  • projectapi/moderation.go
  • projectapi/projectapi.go
  • projectapi/service.go
  • projectapi/service_test.go
✅ Files skipped from review due to trivial changes (1)
  • CHANGELOG.md

Walkthrough

Adds moderation-threshold management and meta-listing APIs to projectapi: new types and Service methods, implementations for Get/Set moderation thresholds and ListMimeTypes/ListModerationCategories, CHANGELOG update, and tests covering JSON serialization, meta endpoints, moderation GET/PUT behavior, and path validation.

Changes

Moderation thresholds and meta reference APIs

Layer / File(s) Summary
Core data structures and service interface
projectapi/projectapi.go, projectapi/service.go, CHANGELOG.md
Expands ProjectFeatures and related types, renames MimeTypeFiltering JSON field to is_enabled, adds UnsafeContentDetection and AutoModerationMode, introduces moderation threshold/category and MIME-type types, and extends the Service interface with Get/Set moderation thresholds and meta listing methods. CHANGELOG updated to reflect expanded projectapi scope.
Moderation thresholds API implementation
projectapi/moderation.go
Implements GetModerationThresholds (GET) and SetModerationThresholds (PUT) with pub-key validation, moderationThresholdsPath helper, and setModerationThresholdsParams for encoding PUT request bodies.
Meta reference API implementation
projectapi/meta.go
Adds ListMimeTypes and ListModerationCategories methods that call meta endpoints and unmarshal responses into MimeTypes and ModerationCategories containers via ResourceOp.
Test coverage for new behavior
projectapi/service_test.go
Adds TestProjectFeatureJSON, TestModerationThresholds, TestMeta, and extends TestPathValidation to cover JSON serialization, moderation GET/PUT request/response semantics (including omission of timestamp fields and nil handling), meta endpoints, and invalid pub-key cases.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant ProjectAPIService
  participant ResourceOp
  participant UploadcareAPI
  Client->>ProjectAPIService: GetModerationThresholds(pubKey)
  ProjectAPIService->>ResourceOp: ResourceOp(GET, /projects/{pubKey}/moderation/thresholds/)
  ResourceOp->>UploadcareAPI: HTTP GET /projects/{pubKey}/moderation/thresholds/
  UploadcareAPI-->>ResourceOp: 200 JSON (ModerationThresholds)
  ResourceOp-->>ProjectAPIService: decoded ModerationThresholds
  ProjectAPIService-->>Client: ModerationThresholds
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add Project API moderation and meta support' directly and concisely summarizes the main changes: adding moderation threshold endpoints and meta endpoints (MIME types, moderation categories) to the Project API.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch project-api-2026-04-updates

Comment @coderabbitai help to get the list of available commands and usage tips.

@alxgsv alxgsv requested a review from ckcnik May 20, 2026 05:31
@alxgsv alxgsv force-pushed the project-api-2026-04-updates branch from f7a067a to 14bce1e Compare May 20, 2026 06:02
Comment thread projectapi/projectapi.go

type MimeTypeFiltering struct {
MimeTypes []string `json:"mime_types,omitempty"`
IsMimeFilteringEnabled *bool `json:"is_mime_filtering_enabled,omitempty"`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we add rename to BREAKING CHANGES ?

MimeTypeFiltering (is_mime_filtering_enabled → is_enabled)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Project API wasn't released yet, so I think we can just edit it

@alxgsv alxgsv merged commit 85e4db1 into master May 27, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants