Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -663,11 +663,30 @@ The following sets of tools are available (all are on by default):
- `owner_type`: Owner type (string, required)
- `project_number`: The project's number (number, required)

- **get_project_field** - Get project field
- `field_id`: The field's id. (number, required)
- `owner`: If owner_type == user it is the handle for the GitHub user account. If owner_type == org it is the name of the organization. The name is not case sensitive. (string, required)
- `owner_type`: Owner type (string, required)
- `project_number`: The project's number. (number, required)

- **get_project_item** - Get project item
- `item_id`: The item's ID. (number, required)
- `owner`: If owner_type == user it is the handle for the GitHub user account. If owner_type == org it is the name of the organization. The name is not case sensitive. (string, required)
- `owner_type`: Owner type (string, required)
- `project_number`: The project's number. (number, required)

- **list_project_fields** - List project fields
- `owner`: If owner_type == user it is the handle for the GitHub user account. If owner_type == org it is the name of the organization. The name is not case sensitive. (string, required)
- `owner_type`: Owner type (string, required)
- `per_page`: Number of results per page (max 100, default: 30) (number, optional)
- `projectNumber`: The project's number. (string, required)
- `project_number`: The project's number. (number, required)

- **list_project_items** - List project items
- `owner`: If owner_type == user it is the handle for the GitHub user account. If owner_type == org it is the name of the organization. The name is not case sensitive. (string, required)
- `owner_type`: Owner type (string, required)
- `per_page`: Number of results per page (max 100, default: 30) (number, optional)
- `project_number`: The project's number. (number, required)
- `query`: Search query to filter items (string, optional)

- **list_projects** - List projects
- `owner`: If owner_type == user it is the handle for the GitHub user account. If owner_type == org it is the name of the organization. The name is not case sensitive. (string, required)
Expand Down
39 changes: 39 additions & 0 deletions pkg/github/__toolsnaps__/get_project_field.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"annotations": {
"title": "Get project field",
"readOnlyHint": true
},
"description": "Get Project field for a user or org",
"inputSchema": {
"properties": {
"field_id": {
"description": "The field's id.",
"type": "number"
},
"owner": {
"description": "If owner_type == user it is the handle for the GitHub user account. If owner_type == org it is the name of the organization. The name is not case sensitive.",
"type": "string"
},
"owner_type": {
"description": "Owner type",
"enum": [
"user",
"org"
],
"type": "string"
},
"project_number": {
"description": "The project's number.",
"type": "number"
}
},
"required": [
"owner_type",
"owner",
"project_number",
"field_id"
],
"type": "object"
},
"name": "get_project_field"
}
39 changes: 39 additions & 0 deletions pkg/github/__toolsnaps__/get_project_item.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"annotations": {
"title": "Get project item",
"readOnlyHint": true
},
"description": "Get a specific Project item for a user or org",
"inputSchema": {
"properties": {
"item_id": {
"description": "The item's ID.",
"type": "number"
},
"owner": {
"description": "If owner_type == user it is the handle for the GitHub user account. If owner_type == org it is the name of the organization. The name is not case sensitive.",
"type": "string"
},
"owner_type": {
"description": "Owner type",
"enum": [
"user",
"org"
],
"type": "string"
},
"project_number": {
"description": "The project's number.",
"type": "number"
}
},
"required": [
"owner_type",
"owner",
"project_number",
"item_id"
],
"type": "object"
},
"name": "get_project_item"
}
6 changes: 3 additions & 3 deletions pkg/github/__toolsnaps__/list_project_fields.snap
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
"description": "Number of results per page (max 100, default: 30)",
"type": "number"
},
"projectNumber": {
"project_number": {
"description": "The project's number.",
"type": "string"
"type": "number"
}
},
"required": [
"owner_type",
"owner",
"projectNumber"
"project_number"
],
"type": "object"
},
Expand Down
42 changes: 42 additions & 0 deletions pkg/github/__toolsnaps__/list_project_items.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"annotations": {
"title": "List project items",
"readOnlyHint": true
},
"description": "List Project items for a user or org",
"inputSchema": {
"properties": {
"owner": {
"description": "If owner_type == user it is the handle for the GitHub user account. If owner_type == org it is the name of the organization. The name is not case sensitive.",
"type": "string"
},
"owner_type": {
"description": "Owner type",
"enum": [
"user",
"org"
],
"type": "string"
},
"per_page": {
"description": "Number of results per page (max 100, default: 30)",
"type": "number"
},
"project_number": {
"description": "The project's number.",
"type": "number"
},
"query": {
"description": "Search query to filter items",
"type": "string"
}
},
"required": [
"owner_type",
"owner",
"project_number"
],
"type": "object"
},
"name": "list_project_items"
}
89 changes: 89 additions & 0 deletions pkg/github/minimal_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,97 @@ type MinimalResponse struct {
URL string `json:"url"`
}

type MinimalProject struct {
ID *int64 `json:"id,omitempty"`
NodeID *string `json:"node_id,omitempty"`
Owner *MinimalUser `json:"owner,omitempty"`
Creator *MinimalUser `json:"creator,omitempty"`
Title *string `json:"title,omitempty"`
Description *string `json:"description,omitempty"`
Public *bool `json:"public,omitempty"`
ClosedAt *github.Timestamp `json:"closed_at,omitempty"`
CreatedAt *github.Timestamp `json:"created_at,omitempty"`
UpdatedAt *github.Timestamp `json:"updated_at,omitempty"`
DeletedAt *github.Timestamp `json:"deleted_at,omitempty"`
Number *int `json:"number,omitempty"`
ShortDescription *string `json:"short_description,omitempty"`
DeletedBy *MinimalUser `json:"deleted_by,omitempty"`
}

type MinimalProjectItem struct {
ID *int64 `json:"id,omitempty"`
NodeID *string `json:"node_id,omitempty"`
ProjectNodeID *string `json:"project_node_id,omitempty"`
ContentNodeID *string `json:"content_node_id,omitempty"`
ProjectURL *string `json:"project_url,omitempty"`
ContentType *string `json:"content_type,omitempty"`
Creator *MinimalUser `json:"creator,omitempty"`
CreatedAt *github.Timestamp `json:"created_at,omitempty"`
UpdatedAt *github.Timestamp `json:"updated_at,omitempty"`
ArchivedAt *github.Timestamp `json:"archived_at,omitempty"`
ItemURL *string `json:"item_url,omitempty"`
Fields []*projectV2Field `json:"fields,omitempty"`
}

// Helper functions

func convertToMinimalProject(fullProject *github.ProjectV2) *MinimalProject {
if fullProject == nil {
return nil
}

return &MinimalProject{
ID: github.Ptr(fullProject.GetID()),
NodeID: github.Ptr(fullProject.GetNodeID()),
Owner: convertToMinimalUser(fullProject.GetOwner()),
Creator: convertToMinimalUser(fullProject.GetCreator()),
Title: github.Ptr(fullProject.GetTitle()),
Description: github.Ptr(fullProject.GetDescription()),
Public: github.Ptr(fullProject.GetPublic()),
ClosedAt: github.Ptr(fullProject.GetClosedAt()),
CreatedAt: github.Ptr(fullProject.GetCreatedAt()),
UpdatedAt: github.Ptr(fullProject.GetUpdatedAt()),
DeletedAt: github.Ptr(fullProject.GetDeletedAt()),
Number: github.Ptr(fullProject.GetNumber()),
ShortDescription: github.Ptr(fullProject.GetShortDescription()),
DeletedBy: convertToMinimalUser(fullProject.GetDeletedBy()),
}
}

func convertToMinimalUser(user *github.User) *MinimalUser {
if user == nil {
return nil
}

return &MinimalUser{
Login: user.GetLogin(),
ID: user.GetID(),
ProfileURL: user.GetHTMLURL(),
AvatarURL: user.GetAvatarURL(),
}
}

func convertToMinimalProjectItem(item *projectV2Item) *MinimalProjectItem {
if item == nil {
return nil
}

return &MinimalProjectItem{
ID: item.ID,
NodeID: item.NodeID,
ProjectNodeID: item.ProjectNodeID,
ContentNodeID: item.ContentNodeID,
ProjectURL: item.ProjectURL,
ContentType: item.ContentType,
Creator: convertToMinimalUser(item.Creator),
CreatedAt: item.CreatedAt,
UpdatedAt: item.UpdatedAt,
ArchivedAt: item.ArchivedAt,
ItemURL: item.ItemURL,
Fields: item.Fields,
}
}

// convertToMinimalCommit converts a GitHub API RepositoryCommit to MinimalCommit
func convertToMinimalCommit(commit *github.RepositoryCommit, includeDiffs bool) MinimalCommit {
minimalCommit := MinimalCommit{
Expand Down
Loading
Loading