Documentation
¶
Overview ¶
Package urlarg provides utilities for parsing Basecamp URLs into IDs. This allows users to paste URLs from the browser as command arguments.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractCommentWithProject ¶
ExtractCommentWithProject extracts a comment ID and project ID from an argument. For URLs with a fragment (e.g., #__recording_789), returns the comment ID. For URLs without a fragment, returns the recording ID (same as ExtractWithProject). Returns (commentOrRecordingID, projectID).
func ExtractID ¶
ExtractID extracts the primary ID from an argument. If the argument is a Basecamp URL, extracts the recording ID. Otherwise, returns the argument as-is (assumed to be an ID).
func ExtractIDs ¶
ExtractIDs extracts IDs from multiple arguments, handling URLs and comma-separated values (e.g. "123,456,789").
func ExtractProjectID ¶
ExtractProjectID extracts the project (bucket) ID from an argument. If the argument is a Basecamp URL, extracts the bucket ID. Otherwise, returns the argument as-is.
func ExtractWithProject ¶
ExtractWithProject extracts both the recording ID and project ID from an argument. Returns (recordingID, projectID). If projectID is empty, it wasn't in the URL.
Types ¶
type Parsed ¶
type Parsed struct {
AccountID string
ProjectID string // BucketID in Basecamp terminology
Type string // e.g., "todos", "messages", "cards"
RecordingID string
CampfireID string // parent campfire ID for chat-line URLs (chats/{campfireId}/lines/{lineId})
CommentID string
IsCollection bool // URL points to a list of items, not an individual resource
OccurrenceDate string // date from schedule_entries/{id}/occurrences/{date} URLs
}
Parsed represents components extracted from a Basecamp URL.
func Parse ¶
Parse extracts IDs from a Basecamp URL. Returns nil if the input is not a valid Basecamp URL.
Supported URL patterns:
- https://3.basecamp.com/{account}/buckets/{bucket}/{type}/{id}
- https://3.basecamp.com/{account}/buckets/{bucket}/{type}/{id}#__recording_{comment}
- https://3.basecamp.com/{account}/buckets/{bucket}/card_tables/cards/{id}
- https://3.basecamp.com/{account}/buckets/{bucket}/chats/{id}@{lineId}
- https://3.basecamp.com/{account}/buckets/{bucket}/schedule_entries/{id}/occurrences/{date}
- https://3.basecamp.com/{account}/projects/{project}