|
| 1 | +import { FieldDataType, Request } from './generated'; |
| 2 | +type FieldsResult = Record<string, { |
| 3 | + value: string | number | undefined; |
| 4 | + type: 'TEXT' | 'SINGLE_SELECT' | 'NUMBER' | 'DATE' | 'ITERATION'; |
| 5 | + id: string; |
| 6 | + unsupported?: false; |
| 7 | +} | { |
| 8 | + value?: never; |
| 9 | + id: string; |
| 10 | + type: FieldDataType; |
| 11 | + unsupported: true; |
| 12 | +}>; |
| 13 | +export declare class Octo { |
| 14 | + octokit: import("@octokit/core").Octokit & import("@octokit/plugin-rest-endpoint-methods/dist-types/types").Api & { |
| 15 | + paginate: import("@octokit/plugin-paginate-rest").PaginateInterface; |
| 16 | + }; |
| 17 | + requests: Record<Request, string>; |
| 18 | + constructor(token: string); |
| 19 | + private _request; |
| 20 | + /** |
| 21 | + * Gets info about a field in a project |
| 22 | + * @param projectOwner The user or organization that owns the project |
| 23 | + * @param projectNumber The number of the project |
| 24 | + * @param fieldName The name of the field |
| 25 | + * @returns Info about the field |
| 26 | + */ |
| 27 | + getField(projectOwner: string, projectNumber: number, fieldName: string): Promise<{ |
| 28 | + id: string; |
| 29 | + dataType: "SINGLE_SELECT"; |
| 30 | + options: { |
| 31 | + id: string; |
| 32 | + name: string; |
| 33 | + }[]; |
| 34 | + } | { |
| 35 | + id: string; |
| 36 | + dataType: "ITERATION"; |
| 37 | + configuration: { |
| 38 | + iterations: { |
| 39 | + id: string; |
| 40 | + title: string; |
| 41 | + }[]; |
| 42 | + completedIterations: { |
| 43 | + id: string; |
| 44 | + title: string; |
| 45 | + }[]; |
| 46 | + }; |
| 47 | + } | { |
| 48 | + id: string; |
| 49 | + dataType: Exclude<FieldDataType, "SINGLE_SELECT" | "ITERATION">; |
| 50 | + }>; |
| 51 | + /** |
| 52 | + * Gets the field values for a project item |
| 53 | + * @param resourceUrl The link to the issue or PR |
| 54 | + * @param projectId The ID of the project |
| 55 | + * @returns An object with each field name as a key and the field value as the value |
| 56 | + */ |
| 57 | + getFieldValues(resourceUrl: string, projectId: string): Promise<FieldsResult>; |
| 58 | + /** |
| 59 | + * Gets the id of a project item |
| 60 | + * @param resourceUrl The link to the issue or PR |
| 61 | + * @param projectId The ID of the project |
| 62 | + * @returns The item ID |
| 63 | + */ |
| 64 | + getItemId(resourceUrl: string, projectId: string): Promise<string>; |
| 65 | + /** |
| 66 | + * Gets the ID of a project |
| 67 | + * @param projectOwner The user or organization that owns the project |
| 68 | + * @param projectNumber The number of the project |
| 69 | + * @returns The project ID |
| 70 | + */ |
| 71 | + getProjectId(projectOwner: string, projectNumber: number): Promise<string>; |
| 72 | + clearFieldValue(projectId: string, itemId: string, fieldId: string): Promise<void>; |
| 73 | + setFieldValue(projectId: string, itemId: string, fieldId: string, value: { |
| 74 | + text: string; |
| 75 | + } | { |
| 76 | + number: number; |
| 77 | + } | { |
| 78 | + date: string; |
| 79 | + } | { |
| 80 | + singleSelectOptionId: string; |
| 81 | + } | { |
| 82 | + iterationId: string; |
| 83 | + }): Promise<void>; |
| 84 | +} |
| 85 | +export {}; |
0 commit comments