| Crates.io | clickup_v2 |
| lib.rs | clickup_v2 |
| version | 0.1.1 |
| created_at | 2025-11-10 15:39:32.20419+00 |
| updated_at | 2025-11-10 15:49:29.718118+00 |
| description | A comprehensive Rust client library and CLI for ClickUp API v2 with OAuth2 authentication, task management, and custom fields support |
| homepage | https://github.com/nextlw/crate_clickup_v2 |
| repository | https://github.com/nextlw/crate_clickup_v2 |
| max_upload_size | |
| id | 1925729 |
| size | 368,733 |
A comprehensive Rust client library and CLI for the ClickUp API v2, featuring OAuth2 authentication, full task management with custom fields support, and intelligent caching.
Add to your Cargo.toml:
[dependencies]
clickup_v2 = "0.1.0"
Install directly from crates.io:
cargo install clickup_v2
Or build from source:
# Using cargo install directly from git
cargo install --git https://github.com/nextlw/crate_clickup_v2.git
# Or clone and build locally
git clone https://github.com/nextlw/crate_clickup_v2.git
cd crate_clickup_v2
cargo install --path .
use clickup_v2::{ClickUpClient, auth::OAuthFlow};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Authenticate and get access token
let oauth = OAuthFlow::new()?;
let token = oauth.authenticate().await?;
// Create client
let client = ClickUpClient::new(token, None);
// Get user info
let user = client.get_authorized_user().await?;
println!("Authenticated as: {}", user["username"]);
// Create a task with custom fields
let task = client.create_task(
"list_id",
CreateTaskRequest::builder()
.name("New Feature")
.content("Implement OAuth2 flow")
.priority(2)
.custom_field("field_id", CustomFieldValue::Text("In Progress".to_string()))
.build()
).await?;
Ok(())
}
# Authenticate (first time setup)
clickup_v2 login
# Get user info
clickup_v2 user
# List all workspaces
clickup_v2 list-teams
# Create a task
clickup_v2 create-task \
--list-id "123456" \
--name "New Feature" \
--content "Implement new functionality" \
--priority 2 \
--custom-field "field_123:text:In Progress"
# Search for entities
clickup_v2 search --name "My Project" --type folder
# Get tasks from a list
clickup_v2 get-tasks --list-id "123456"
Create a .env file in your project root:
# OAuth2 Credentials (required)
CLICKUP_CLIENT_ID=your_client_id
CLICKUP_CLIENT_SECRET=your_client_secret
CLICKUP_REDIRECT_URI=http://localhost:8888/callback
# Optional
CLICKUP_TEAM_ID=your_default_team_id
CLICKUP_API_URL=https://api.clickup.com/api/v2 # Custom API URL if needed
# Auto-populated after authentication
CLICKUP_ACCESS_TOKEN=your_access_token
The crate will automatically generate a template .env file if missing when you run it.
Set environment variables directly:
export CLICKUP_CLIENT_ID=your_client_id
export CLICKUP_CLIENT_SECRET=your_client_secret
export CLICKUP_REDIRECT_URI=https://your-app.com/callback
export CLICKUP_ACCESS_TOKEN=your_token # Pre-authorized token
The crate automatically detects cloud environments (Google Cloud, AWS, Azure) and adjusts behavior accordingly.
The library supports all ClickUp custom field types:
use clickup_v2::CustomFieldValue;
// Text field
CustomFieldValue::Text("In Progress".to_string())
// Number field
CustomFieldValue::Number(42.5)
// Date field (Unix timestamp in milliseconds)
CustomFieldValue::Date(1704067200000)
// Dropdown
CustomFieldValue::DropdownOption("option_id".to_string())
// Multiple options
CustomFieldValue::DropdownOptions(vec!["id1".to_string(), "id2".to_string()])
// Checkbox
CustomFieldValue::Checkbox(true)
// Rating (1-5)
CustomFieldValue::Rating(4)
// And more: Email, Phone, URL, Location, etc.
This project uses GitHub Actions for continuous integration and deployment:
The crate is automatically published to crates.io when:
Cargo.tomlFor manual releases:
Cargo.tomlAdd these secrets to your GitHub repository:
CRATES_IO_TOKEN: Your crates.io API tokenCLICKUP_CLIENT_ID: For running tests (optional)CLICKUP_CLIENT_SECRET: For running tests (optional)CLICKUP_ACCESS_TOKEN: For running tests (optional)The workflows will automatically run on:
# Clone the repository
git clone https://github.com/nextlw/crate_clickup_v2.git
cd crate_clickup_v2
# Build the project
cargo build
# Run tests
cargo test
# Run with logging
RUST_LOG=debug cargo run
# Run clippy
cargo clippy
# Format code
cargo fmt
# Run all tests
cargo test
# Run with output
cargo test -- --nocapture
# Run specific test
cargo test test_create_task
# Run integration tests (requires .env)
cargo test --features integration-tests
Enable debug logging to troubleshoot authentication:
RUST_LOG=debug cargo run
Key log markers:
🔑 Starting authentication - Auth flow begins🌐 Authorization URL generated - OAuth URL created⏳ Waiting for authorization - Callback server ready✅ Authorization code received - Callback successful🔄 Exchanging code for token - Token exchangesrc/
├── auth/
│ ├── oauth.rs # OAuth2 flow orchestration
│ ├── callback.rs # Local callback server
│ └── token.rs # Token management
├── client/
│ └── api.rs # ClickUp API client
├── config/
│ └── env.rs # Environment configuration
├── error/
│ └── auth_error.rs # Error types
├── lib.rs # Library interface
└── main.rs # CLI implementation
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
cargo fmt and cargo clippyThis project is licensed under the MIT License - see the LICENSE file for details.
Built with these amazing Rust crates:
See CHANGELOG.md for version history.