|
| 1 | +import { BaseResource } from "../BaseResource"; |
| 2 | +import { Configuration } from "../../Configuration"; |
| 3 | +import { InitiativeLabel, CreateInitiativeLabel, UpdateInitiativeLabel, ListInitiativeLabelsParams } from "../../models/InitiativeLabel"; |
| 4 | +import { PaginatedResponse } from "../../models/common"; |
| 5 | +import { AddInitiativeLabelsRequest, RemoveInitiativeLabelsRequest } from "../../models/Initiative"; |
| 6 | + |
| 7 | +/** |
| 8 | + * Initiative Labels API resource |
| 9 | + * Handles initiative label relationships |
| 10 | + */ |
| 11 | +export class Labels extends BaseResource { |
| 12 | + constructor(config: Configuration) { |
| 13 | + super(config); |
| 14 | + } |
| 15 | + |
| 16 | + /** |
| 17 | + * Create a new initiative label |
| 18 | + */ |
| 19 | + async create(workspaceSlug: string, createInitiativeLabel: CreateInitiativeLabel): Promise<InitiativeLabel> { |
| 20 | + return this.post<InitiativeLabel>(`/workspaces/${workspaceSlug}/initiatives/labels/`, createInitiativeLabel); |
| 21 | + } |
| 22 | + |
| 23 | + /** |
| 24 | + * Retrieve an initiative label by ID |
| 25 | + */ |
| 26 | + async retrieve(workspaceSlug: string, initiativeLabelId: string): Promise<InitiativeLabel> { |
| 27 | + return this.get<InitiativeLabel>(`/workspaces/${workspaceSlug}/initiatives/labels/${initiativeLabelId}/`); |
| 28 | + } |
| 29 | + |
| 30 | + /** |
| 31 | + * Update an initiative label |
| 32 | + */ |
| 33 | + async update(workspaceSlug: string, initiativeLabelId: string, updateInitiativeLabel: UpdateInitiativeLabel): Promise<InitiativeLabel> { |
| 34 | + return this.patch<InitiativeLabel>(`/workspaces/${workspaceSlug}/initiatives/labels/${initiativeLabelId}/`, updateInitiativeLabel); |
| 35 | + } |
| 36 | + |
| 37 | + /** |
| 38 | + * Delete an initiative label |
| 39 | + */ |
| 40 | + async delete(workspaceSlug: string, initiativeLabelId: string): Promise<void> { |
| 41 | + return this.httpDelete(`/workspaces/${workspaceSlug}/initiatives/labels/${initiativeLabelId}/`); |
| 42 | + } |
| 43 | + |
| 44 | + /** |
| 45 | + * List initiative labels with optional filtering |
| 46 | + */ |
| 47 | + async list(workspaceSlug: string, params?: ListInitiativeLabelsParams): Promise<PaginatedResponse<InitiativeLabel>> { |
| 48 | + return this.get<PaginatedResponse<InitiativeLabel>>(`/workspaces/${workspaceSlug}/initiatives/labels/`, params); |
| 49 | + } |
| 50 | + |
| 51 | + /** |
| 52 | + * Add labels to an initiative |
| 53 | + */ |
| 54 | + async addLabels(workspaceSlug: string, initiativeId: string, addLabels: AddInitiativeLabelsRequest): Promise<InitiativeLabel[]> { |
| 55 | + return this.post<InitiativeLabel[]>(`/workspaces/${workspaceSlug}/initiatives/${initiativeId}/labels/`, addLabels); |
| 56 | + } |
| 57 | + |
| 58 | + /** |
| 59 | + * Remove labels from an initiative |
| 60 | + */ |
| 61 | + async removeLabels(workspaceSlug: string, initiativeId: string, removeLabels: RemoveInitiativeLabelsRequest): Promise<void> { |
| 62 | + return this.httpDelete(`/workspaces/${workspaceSlug}/initiatives/${initiativeId}/labels/`, removeLabels); |
| 63 | + } |
| 64 | + |
| 65 | + /** |
| 66 | + * Get labels associated with an initiative |
| 67 | + */ |
| 68 | + async listLabels(workspaceSlug: string, initiativeId: string, params?: { limit?: number; offset?: number }): Promise<PaginatedResponse<InitiativeLabel>> { |
| 69 | + return this.get<PaginatedResponse<InitiativeLabel>>(`/workspaces/${workspaceSlug}/initiatives/${initiativeId}/labels/`, params); |
| 70 | + } |
| 71 | + |
| 72 | +} |
| 73 | + |
0 commit comments