Skip to content

Commit

Permalink
🚧Add state type for issue and pr models (#96)
Browse files Browse the repository at this point in the history
* Start work for issue #82

* enhance: create new type to represent the state of an issue or pr

* enhance: update models to use state type
  • Loading branch information
CalvinWilkinson authored Oct 15, 2024
1 parent d41f178 commit fe672b6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion core/Models/IssueModel.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { State } from "../Types.ts";
import type { LabelModel } from "./mod.ts";
import type { MilestoneModel } from "./mod.ts";
import type { UserModel } from "./mod.ts";
Expand Down Expand Up @@ -29,7 +30,7 @@ export interface IssueModel {
/**
* Gets or sets the state of the issue.
*/
state?: string;
state?: State;

/**
* Gets or sets the URL to the html page of the issue.
Expand Down
3 changes: 2 additions & 1 deletion core/Models/PullRequestModel.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { State } from "../Types.ts";
import type { LabelModel } from "./mod.ts";
import type { MilestoneModel } from "./mod.ts";
import type { PullRequestHeadOrBaseModel } from "./mod.ts";
Expand Down Expand Up @@ -51,7 +52,7 @@ export interface PullRequestModel {
/**
* Gets or sets the state of the pull request.
*/
state?: string;
state?: State;

/**
* Gets or sets the URL to the pull request.
Expand Down
5 changes: 5 additions & 0 deletions core/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ import type { PullRequestModel } from "../deps.ts";
*/
export type ItemType = "issue" | "pull-request";

/**
* Represents the state of a GitHub issue or pull request.
*/
export type State = "open" | "closed";

/**
* Represents a GitHub issue or pull request.
*/
Expand Down

0 comments on commit fe672b6

Please sign in to comment.